Maths iii quick review by Dr Asish K Mukhopadhyay
-
Upload
dr-asish-k-mukhopadhyay -
Category
Science
-
view
65 -
download
0
Transcript of Maths iii quick review by Dr Asish K Mukhopadhyay
1
Unit – IV: Numerical Techniques•Zeroes of transcendental and polynomial equations using •Bisection method, •Regula-falsi method•Newton-Raphson method,• Rate of convergence.• Interpolation:• Finite differences,•Newton’s forward and backward interpolation,• Lagrange’s and Newton’s divided difference formula forunequal intervals.
2
A root, r, of function f occurs when f(r) = 0.For example:
f(x) = x2 – 2x – 3has two roots at r = -1 and r = 3.
f(-1) = 1 + 2 – 3 = 0f(3) = 9 – 6 – 3 = 0
We can also look at f in its factored form.
f(x) = x2 – 2x – 3 = (x + 1)(x – 3)
3
Bisection MethodInitial two values of x taken: x1=a & x2=b such that if
y(a) is +ve then y(b) is –ve. Then new value c=(a+b)/2
a bc
f(a)>0
f(b)<0
f(c)>0
If c is +ve, then replace the value of a by c. If c is –ve, then replace the value of b by c.Then continue to find the next value of c (End of 1st iteration) with c=(a+b)/2Guaranteed to converge to a root if one exists within these initial two values.
4
Regula Falsi
a bc
( ) ( )( ) ( )
( ) ( )( ) 0 ( )
0 ( )( ) ( )
( )( ) ( )
f a f by x f b x ba bf a f by c f b c ba b
a bf b c bf a f bf b a b
c bf a f b
f(c)<0
5
Newton-Raphson Method• Only one current guess of x .• Consider some point x0.– If we approximate f(x) as a line about x0,
then we can again solve for the root of the line.
0 0 0( ) ( )( ) ( )l x f x x x f x Solving, leads to the following
iteration:0
1 00
1
( ) 0( )( )( )( )i
i ii
l xf xx xf xf xx xf x
6
Unit – V: Numerical Techniques –II
•Solution of system of linear equations, •Matrix Decomposition methods, •Jacobi method,• Gauss- Seidal method.• Numerical differentiation, •Numerical integration, •Trapezoidal rule, •Simpson’s one third and three-eight rules,• Solution of ordinary differential equations (first order,second order and simultaneous)•by Euler’s, Picard’s and• fourth-order Runge- Kutta methods.
7
Systems of Non-linear EquationsConsider the set of equations:
1 1 2
2 1 2
1 2
, , , 0
, , , 0
, , , 0
n
n
n n
f x x x
f x x x
f x x x
11 1 12 2 1 1
21 1 22 2 2 2
1 1 2 2
The system of equations:
N N
N N
N N NN N N
a T a T a T Ca T a T a T C
a T a T a T C
A total of N algebraic equations for the N nodal points and the system can be expressed as a matrix formulation: [A][T]=[C]
11 12 1 1 1
21 22 2 2 2
1 2
= , ,
N
N
N N NN N N
a a a T Ca a a T C
where A T C
a a a T C
8
Jacobi Iteration
nnnnnn
nn
nn
bxaxaxa
bxaxaxabxaxaxa
2211
22222121
11212111
0
02
01
0
nx
xx
x
)(1 01
02121
11
11 nnxaxaba
x
1
1 1
1 1 i
j
n
ij
kjij
kjiji
ii
ki xaxab
ax
)(1 011
022
011
1 nnnnnn
nnn xaxaxaba
x
)(1 02
0323
01212
22
12 nnxaxaxaba
x
9
Gauss-Siedel Method
33
23213131
22
32312122
11
31321211
axaxabx
axaxabx
axaxabx
3333232131
2323222121
1313212111
bxaxaxa
bxaxaxa
bxaxaxa
Now we can start the solution process by choosing guesses for the x’s. A simple way to obtain initial guesses is to assume that they are zero. These zeros can be substituted into x1 equation to calculate a new x1=b1/a11.
10
Gauss-Seidel (GS) iteration
nnnnnn
nn
nn
bxaxaxa
bxaxaxabxaxaxa
2211
22222121
11212111
0
02
01
0
nx
xx
x
1
1 1
11 1 i
j
n
ij
kjij
kjiji
ii
ki xaxab
ax)(1 0
102121
11
11 nnxaxaba
x
)(1 111
122
111
1 nnnnnn
nnn xaxaxaba
x
)(1 02
0323
11212
22
12 nnxaxaxaba
x
Use the latestupdate
11
Difference between the Gauss-Seidel and the Jacobi iterative methods
The Gauss-Seidel method
The Jacobi iteration method
12
ExampleSolve the following system of equations using (a) the Jacobi methos, (b) the Gauss Seidel iteration method.
4 2 112 0 3
2 4 16
X Y ZX Y ZX Y Z
,* ,
(a) Jacobi method: use initial guess X0=Y0=Z0=1, stop when maxXk-Xk-1,Yk-Yk-1,Zk-Zk-1 0.1First iteration: X1= (11/4) - (1/2)Y0 - (1/4)Z0 = 2Y1= (3/2) + (1/2)X0 = 2Z1= 4 - (1/2) X0 - (1/4)Y0 = 13/4
Reorganize into new form:
X = 114
- 12
Y - 14
Z
Y = 32
+ 12
X + 0 * Z
Z = 4 - 12
X - 14
Y
4 2 1 111 2 0 3
2 1 4 16
XYZ
13
Second iteration: use the iterated values X1=2, Y1=2, Z1=13/4X2 = (11/4) - (1/2)Y1 - (1/4)Z1 = 15/16Y2 = (3/2) + (1/2)X1 = 5/2Z2 = 4 - (1/2) X1 - (1/4)Y1 = 5/2
Final solution [1.014, 2.02, 2.996] Exact solution [1, 2, 3]
5 4 5 4 5 4
Converging Process:13 15 5 5 7 63 93 133 31 393[1,1,1], 2,2, , , , , , , , , ,4 16 2 2 8 32 32 128 16 128
519 517 767, , . Stop the iteration when 512 256 256
max , , 0.1X X Y Y Z Z
14
Example (cont.)(b) Gauss-Seidel iteration: Substitute the iterated values into the iterative process immediately after they are computed.
0 0 0
1 0 0
1 1
1 1 1
Use initial guess X 111 1 1 3 1 1 1, , 44 2 4 2 2 2 4
11 1 1First iteration: X = ( ) ( ) 24 2 43 1 3 1 5(2)2 2 2 2 2
1 1 1 1 5 194 4 (2)2 4 2 4 2 8
5 19Converging process: [1,1,1], 2, ,2 8
Y Z
X Y Z Y X Z X Y
Y Z
Y X
Z X Y
29 125 783 1033 4095 24541, , , , , ,32 64 256 1024 2048 8192
The iterated solution [1.009, 1.9995, 2.996] and it converges faster
Immediate substitution
15
Numerical Differentiation: [Find dy/dx or f’(x)]
Forward DifferenceBackward Difference
hhxfhxfxf
2)()()(
Central Difference
hhxfhxfxf
2)()()(
hxfhxfxf )()()(
3-points Difference Formulas (More Accurate )
hxfhxfhxfxf
2)(3)(4)2()(
Forward Difference :
Backward Difference: h
xfhxfhxfxf2
)()(4)2(3)(
2-Points Difference Formulas
16
Example:Find estimates for the derivative with the data set given to the right. We notice the x values are evenly spaced.Two-Point Estimates:
i xi yi
1 3 1
2 5 4
3 7 3
21
5743)5('
23
3514)3('
f
f
21
5743)7('
23
3514)5('
f
f
Forward Backward
21
42
3713)5('
f
Central
Three Point Estimates:
25
410
37)1(3)4(43)3('
f23
46
37)1(1)4(4)3(3)7('
f
Forward Backward
1441)4(23
21)5('' 2
f
Second Derivative (h=2)
17
Numerical Integration
Simpson’s 1/3rd rule
nn
nnn
b
an
b
a
xaxaxaaxf
dxxfdxxfI
1
110)(
)()(
Trapezoidal rule
2
)()(4)(3 210
abhxfxfxfhI
1
10
12110
)(2)()(2
2)()(
2)()(
2)()(
n
iin
nn
xfxfxfnabI
xfxfhxfxfhxfxfhI
)()(3)(3)(83
3210 xfxfxfxfhI Simpson’s 3/8th rule 3abh
1818
Integration with Unequal Segments
Example 21.7
2)()(
2)()(
2)()( 121
210
1nn
nxfxfhxfxfhxfxfhI
x f(x) x f(x)0.0 0.2 0.44 2.8420.12 1.309 0.54 3.5070.22 1.305 0.64 3.1810.32 1.743 0.70 2.3630.36 2.074 0.80 0.2320.40 2.456
594.112975.01307.00905.0 2
363.2232.010.02
181.3363.006.02
309.1305.110.02
2.0309.112.0
I
Data for f(x)= 0.2+25x-200x2+675x3-
900x4+400x5
Using Trapezoidal Rule
19
Example: xxexf Find the approximate value of
2f
1.9 12.703199
2.0 14.778112
2.1 17.148957
2.2 19.855030
x xf
with
10.h
Using the 1st Three-point formula:
032310.22 855030.19
148957.174778112.1432.0
1
)2.2()1.2(4)2(31.02
12
ffff
hxfhxfxfh
xf 24321
0000
Using the 2nd Three-point formula:
228790.22
703199.12148957.172.0
1
)9.1()1.2(1.02
12
fff
The exact value of 22.167168 :is 2f
hxfhxfh
xf 000 21
20
by dividing the interval into 20 subintervals.
Find π
sin0
(x)dx
2021020
20
20
....., , , , ,π
π
kkkhax
nabh
n
k
995886120
2040
22
19
1
1
10
.
πsinπsinsinπ
)()()sin(π
k
n
kk
k
bfxfafhdxx
000006220
124
20220
6010
1
9
10
.
)πsin(π)(sin
πsinsinπ)sin(π
k
k
k
kdxx
By Simpson’s Rule
By Trapizoidal Rule
Example-2
21
Numerical Solutions for Partial Differential Equations by 4th order Runga-Kutta Method
hkkkkyy ii )22(61
43211
),(
)21,
21(
)21,
21(
),(
34
23
12
1
hkyhxfk
hkyhxfk
hkyhxfk
yxfkwhere
ii
ii
ii
ii
Consider Exact SolutionInitial condition :Step size :
2txdtdx
t222 ettx
10 x1.0h
104829.1226
109499.0104988.1,1.01.0,
104988.02/.1,05.01.021,
21
10475.005.1,05.01.021,
21
1.0011.01,01.0,
432101
34
223
12
21
kkkkhxx
fkxhtfhhk
kfkxhtfhhk
fkxhtfhhk
fxtfhhk