MAK202E Numerical Methods Formula-Sheet-V3-20230606 (ATÇ)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Formula Sheet for MAK 202E – Numerical Methods Kaan CEBE 2016 v3:20230606(ATÇ)

ERRORS: 5. Systems of Nonlinear Equation Tridiagonal Systems (Thomas Algorithm)


5a. Simple Fixed Iteration: ⋱
True percent relative error:
𝑎𝑛−1 𝑥𝑛−2 + 𝑑𝑛−1 𝑥𝑛−1 + 𝑐𝑛−1 𝑥𝑛 = 𝑏𝑛−1
𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟. 𝑣𝑎𝑙𝑢𝑒 𝑢(𝑥, 𝑦) = 0 𝑎𝑛𝑑 𝑣(𝑥, 𝑦) = 0 𝑐𝑛 𝑥𝑛−1 + 𝑑𝑛 𝑥𝑛 = 𝑏𝑛
𝜀𝑡 = | | 100%
𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 𝑎1 = 0 , 𝑐𝑛 = 0
𝑥 = 𝑢(𝑥, 𝑦) ⇒ 𝑥𝑖+1 = 𝑢(𝑥𝑖 , 𝑦𝑖 )
Approximate relative error: 𝑐𝑘−1 𝛾𝑘−1
𝑦 = 𝑣(𝑥, 𝑦) ⇒ 𝑦𝑖+1 = 𝑣(𝑥𝑖 , 𝑦𝑖 ) 𝛼𝑘 = 𝑑𝑘 − 𝑎𝑘 ; 𝛾 = 𝑏𝑘 − 𝑎𝑘
𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝑎𝑝𝑝𝑟. −𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝑎𝑝𝑝𝑟. 𝛼𝑘−1 𝑘 𝛼𝑘−1
𝜀𝑎 = | | 100% Convergency:
𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 𝛼1 = 𝑑1 ; 𝛾1 = 𝑏1 ; 𝑘 = 2, … , 𝑛
𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
| | + | | < 1 𝑎𝑛𝑑 | | + | | < 1 𝛾𝑛 𝛾𝑘 − 𝑐𝑘 𝑥𝑘+1
TAYLOR SERIES: 𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦 𝑥𝑛 = , 𝑥𝑘 =
𝑓 ′ (𝑥𝑖 ) 𝑓 ′′ (𝑥𝑖 ) 2 𝛼𝑛 𝛼𝑘
𝑓(𝑥𝑖+1 ) = 𝑓(𝑥𝑖 ) + ℎ+ ℎ +⋯ 5b. Newton-Raphson (Jacobian) Method:
1! 2!
𝑓 (𝑛) (𝑥𝑖 ) 𝑛 Jacobi Iteration Method
+ ℎ + 𝑅𝑛 𝑢(𝑥, 𝑦) = 0 𝑎𝑛𝑑 𝑣(𝑥, 𝑦) = 0 𝑎11 𝑥1 + ⋯ + 𝑎1𝑖 𝑥𝑖 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏𝑛
𝑛! ⋮
𝜕𝑣𝑖 𝜕𝑢 𝑎𝑛1 𝑥1 + ⋯ + 𝑎𝑛𝑖 𝑥𝑖 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛
𝑓 (𝑛+1) (𝜉) 𝑛+1 − 𝑣𝑖 𝑖
𝑢𝑖
ℎ = 𝑥𝑖+1 − 𝑥𝑖 ; 𝑅𝑛 = ℎ 𝜕𝑦 𝜕𝑦
(𝑛 + 1)! 𝑥𝑖+1 = 𝑥𝑖 − 1
𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢𝑖 𝜕𝑣𝑖 (𝑚)
𝑥𝑖 =
(𝑚−1)
[𝑏 − (𝑎𝑖,1 𝑥1 + ⋯+
∗ − ∗ 𝑎𝑖𝑖 𝑖
𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥
ROOTS OF EQUATIONS: (𝑚−1) (𝑚−1)
𝑎𝑖,𝑖−1 𝑥𝑖−1 + 𝑎𝑖,𝑖+1 𝑥𝑖+1 + ⋯ + 𝑎𝑖,𝑛 𝑥𝑛
(𝑚−1)
)]
𝜕𝑢 𝜕𝑣
𝑣𝑖 𝑖 − 𝑢𝑖 𝑖
Closed (Bracketing) Methods: 𝑦𝑖+1 = 𝑦𝑖 − 𝜕𝑥 𝜕𝑥
𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢𝑖 𝜕𝑣𝑖 Gauss-Seidel Iteration Method
∗ − ∗
1. Graphical Method 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥 𝑖−1 𝑛
(𝑚+1) 1 (𝑚+1) (𝑚)
2. Bisection (Bolzano) Method 𝑥𝑖 = [𝑏 − ∑ 𝑎𝑖𝑗 𝑥𝑗 − ∑ 𝑎𝑖𝑗 𝑥𝑗 ]
𝑎𝑖𝑖 𝑖
𝑗=1 𝑗=𝑖+1
LINEAR ALGEBRAIC EQUATIONS:
𝑥𝑒 + 𝑥𝑢 𝑎 𝑎12 1 𝑎22 −𝑎12
𝑓(𝑥𝑒 ) ∗ 𝑓(𝑥𝑢 ) < 0 ⇒ 𝑥𝑟 = [𝐴] = [𝑎11 −1
2 21 𝑎22 ] → [𝐴] = det 𝐴 [−𝑎21 𝑎11 ] Gauss-Seidel SOR (relaxation) Method
(𝑚) (𝑚−1) (𝑚)
𝑥𝑖 = (1 − 𝜆)𝑥𝑖 + 𝜆 ∙ 𝑥𝑖
𝑓(𝑥𝑒 ) ∗ 𝑓(𝑥𝑟 ) < 0 ⇒ 𝑥𝑢 = 𝑥𝑟 Gauss Elimination

𝑓(𝑥𝑒 ) ∗ 𝑓(𝑥𝑟 ) > 0 ⇒ 𝑥𝑒 = 𝑥𝑟 1. Cramer’s Rule Diagonally dominant:


𝑛

3. The False Position (Regula Falsi) 𝑎11 𝑎12 𝑎13 |𝒂𝒊𝒊 | > ∑ |𝑎𝑖𝑗 |
Method [𝐴] ∗ {𝑋} = [𝐵] ; [𝐴] = [𝑎21 𝑎22 𝑎23 ] 𝑗=1,𝑗≠𝑖
𝑎31 𝑎32 𝑎33
𝑓(𝑥𝑢 )(𝑥𝑒 − 𝑥𝑢 ) INTERPOLATION:
𝑥𝑟 = 𝑥𝑢 − 𝑏1 𝑎12 𝑎13
𝑓(𝑥𝑒 ) − 𝑓(𝑥𝑢 ) 1.
Linear Interpolation:
|𝑏2 𝑎22 𝑎23 |
𝑏3 𝑎32 𝑎33 𝑓(𝑥𝑘+1 ) − 𝑓(𝑥𝑘 )
Open Methods 𝑥1 = 𝑓(𝑥) = 𝑓(𝑥𝑘 ) + (𝑥 − 𝑥𝑘 )
det 𝐴 𝑥𝑘+1 − 𝑥𝑘
1. Simple Fixed-Point Iteration
2. Naive Gauss Elimination 2. Lagrange Interpolation Polynomial
𝑓(𝑥) = 0 ⟹ 𝑥 = 𝑔(𝑥); 𝑥𝑖+1 = 𝑔(𝑥𝑖 ) 𝑓(𝑥); 𝑥0 , 𝑥1 , … , 𝑥𝑛 ⇒ (𝑛 + 1) 𝑝𝑜𝑖𝑛𝑡𝑠 𝑖𝑛 [𝑎, 𝑏]
-Back Substitution Step:
𝑛
Convergency: |𝑔̇ (𝑥)| < 1 (𝑖−1) (𝑖−1)
(𝑛−1)
𝑏𝑛 𝑏𝑖 − ∑𝑛𝑗=𝑖+1 𝑎𝑖𝑗 𝑥𝑗 𝑃𝑛 (𝑥) = ∑ 𝑓(𝑥𝑘 )𝐼𝑘 (𝑥)
Divergency: |𝑔̇ (𝑥)| > 1 𝑥𝑛 = (𝑛−1)
; 𝑥𝑖 = (𝑖−1) 𝑘=0
𝑎𝑛𝑛 𝑎𝑖𝑖
𝑛
2. Newton-Raphson Method 𝑥 − 𝑥𝑖
𝑖 = (𝑛 − 1), (𝑛 − 2), … ,1 𝐼𝑘 (𝑥) = ∏ ; (𝑖 = 0, … , 𝑛)
𝑥𝑘 − 𝑥𝑖
𝑓(𝑥𝑖 ) 𝑖=0,𝑖≠𝑘
𝑥𝑖+1 = 𝑥𝑖 − LU Decomposition
𝑓′(𝑥𝑖 )
3. Newton’s Divided Difference
[𝐴] ∗ {𝑋} = {𝐵}
3. Secant Method Interpolating Polynomials
[𝐴] = [𝐿] ∗ [𝑈] 𝑓𝑛 (𝑥) = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 ) + ⋯ + 𝑏𝑛 (𝑥 −
𝑓(𝑥𝑖 ) ∗ (𝑥𝑖−1 − 𝑥𝑖 ) 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
𝑥𝑖+1 = 𝑥𝑖 −
𝑓(𝑥𝑖−1 ) − 𝑓(𝑥𝑖 ) [𝐿] ∗ {𝐷} = {𝐵}
𝑓[𝑥𝑛 , 𝑥𝑛−1 , … , 𝑥0 ] = 𝑏𝑛
3a. Modified Secant Method: [𝑈] ∗ {𝑋} = {𝐷} ⇒ {𝑋}
𝑛
𝑓(𝑥𝑖 )
𝛿𝑥𝑖 𝑓(𝑥𝑖 ) 𝑎11 𝑎12 𝑎13 1 0 0 𝑓[𝑥𝑛 , … , 𝑥0 ] = ∑
𝑥𝑖+1 = 𝑥𝑖 − [𝑈] = [ 0 𝑎22 ′ 𝑎23 ′ ] [𝐿] = [𝑓21 1 0] ∏𝑛𝑗=0,𝑗≠𝑖(𝑥𝑖 − 𝑥𝑗 )
𝑓(𝑥𝑖 + 𝛿𝑥𝑖 ) − 𝑓(𝑥𝑖 ) 𝑖=0
0 0 𝑎33 ′′ 𝑓31 𝑓32 1
𝑓[𝑥𝑖+1 , … , 𝑥𝑛 ] − 𝑓[𝑥𝑖 , … , 𝑥𝑛−1 ]
4. Multiple Roots 𝑎21 𝑎31 𝑎32 ′ 𝑓[𝑥𝑛 , … , 𝑥𝑖 ] =
𝑓21 = , 𝑓31 = , 𝑓32 = 𝑥𝑛 − 𝑥𝑖
Newton-Raphson Alternative Formula: 𝑎11 𝑎11 𝑎22 ′

𝑓(𝑥𝑖 ) ∗ 𝑓′(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 −
[𝑓′(𝑥𝑖 )]2 − 𝑓(𝑥𝑖 ) ∗ 𝑓′′(𝑥𝑖 )

1/2
Formula Sheet for MAK 202E – Numerical Methods Kaan CEBE 2016 v3:20230606(ATÇ)
4. Simple Polynomial Interpolation NUMERICAL DIFFERENTIATION: 6. Gauss-Legendre Integration
𝑛
(Coefficients of an Interpolating Finite Divided Differences (FDD) 𝑏
𝑏−𝑎 𝑏−𝑎 𝑏+𝑎
∫ 𝑓(𝑥)𝑑𝑥 ≈ ∑ 𝑤𝑘 𝑓 [ 𝑥𝑘 + ]
Polynomials) ℎ = 𝑥𝑖+1 − 𝑥𝑖 𝑎 2 2 2
𝑘=1
𝑛
𝑗
3 points:
∑ 𝑎𝑗 𝑥𝑖 = 𝑓(𝑥𝑖 ) ; (𝑖 = 0, … , 𝑛) 1. Forward FDD
3 5 8 3 5
𝑗=0 𝑥1 = −√ , 𝑤1 = , 𝑥2 = 0, 𝑤2 = , 𝑥3 = √ , 𝑤3 =
𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖 ) 5 9 9 5 9
5. Cubic Spline Interpolation 𝑓′(𝑥𝑖 ) ≈ 𝑏
𝑏−𝑎 𝑏−𝑎 𝑏+𝑎
ℎ ∫ 𝑓(𝑥)𝑑𝑥 = ∙ [𝑤1 𝑓 ( 𝑥1 + )
𝑆𝑖 (𝑥) = 𝑎𝑖 + 𝑏𝑖 (𝑥 − 𝑥𝑖 ) + 𝑐𝑖 (𝑥 − 𝑥𝑖 )2 𝑎 2 2 2
2. Backward FDD 𝑏−𝑎 𝑏+𝑎
+ 𝑑𝑖 (𝑥 − 𝑥𝑖 )3 + 𝑤2 𝑓 ( 𝑥2 + )
2 2
𝑓(𝑥𝑖 ) − 𝑓(𝑥𝑖−1 ) 𝑏−𝑎 𝑏+𝑎
𝑖 = 0, … , (𝑛 − 1) 𝑓′(𝑥𝑖 ) ≈ + 𝑤3 𝑓 ( 𝑥3 + )]
ℎ 2 2
𝑎𝑖 = 𝑓𝑖 FIRST-ORDER ORDINARY DIFFERENTIAL
3. Centered FDD
EQUATIONS:
ℎ𝑖 = 𝑥𝑖+1 − 𝑥𝑖 a. with 2 points
1. Euler Method
ℎ𝑖−1 𝑐𝑖−1 + 2(ℎ𝑖 + ℎ𝑖−1 )𝑐𝑖 + ℎ𝑖 𝑐𝑖+1 = 𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖−1 )
𝑓′(𝑥𝑖 ) ≈ ℎ = 𝑥𝑖+1 − 𝑥𝑖
2ℎ
3 3
= (𝑎𝑖+1 − 𝑎𝑖 ) − (𝑎 − 𝑎𝑖−1 ) 𝑓(𝑥𝑖+1 ) − 2𝑓(𝑥𝑖 ) + 𝑓(𝑥𝑖−1 ) 𝑦𝑖+1 = 𝑦𝑖 + ℎ𝑦̇ 𝑖 = 𝑦𝑖 + ℎ𝑓(𝑥𝑖 ; 𝑦𝑖 )
ℎ𝑖 ℎ𝑖−1 𝑖 𝑓′′(𝑥𝑖 ) ≈
ℎ2 2. Generalized Runge-Kutta Expressions
𝑐𝑖+1 − 𝑐𝑖
𝑑𝑖 = b. with 4 points
3ℎ𝑖
𝑡: Order of the Runga-Kutta method
𝑎𝑖+1 − 𝑎𝑖 ℎ𝑖 −𝑓(𝑥𝑖+2) + 8𝑓(𝑥𝑖+1) − 8𝑓(𝑥𝑖−1) + 𝑓(𝑥𝑖−2)
𝑓′(𝑥𝑖 ) ≈ 𝑡
𝑏𝑖 = − (2𝑐𝑖 + 𝑐𝑖+1 ) 12ℎ 𝑏−𝑎
ℎ𝑖 3 ℎ= , 𝑦𝑖+1 = 𝑦𝑖 + ℎ (∑ 𝛼𝑖 𝑘𝑖 )
𝑓′′(𝑥𝑖 ) 𝑛
𝑖=1
Natural Boundary Conditions: −𝑓(𝑥𝑖+2) + 16𝑓(𝑥𝑖+1) − 30𝑓(𝑥𝑖 ) + 16𝑓(𝑥𝑖−1) − 𝑓(𝑥𝑖−2)

12ℎ2
′ 𝑖−1
𝑆𝑜′′ (𝑥𝑜 ) = 0 𝑎𝑛𝑑 𝑆𝑛−1 (𝑥𝑛 ) = 0 ⇒ 𝑐0 = 𝑐𝑛 = 0
NUMERICAL INTEGRATION: 𝑘𝑖 = 𝑓 (𝑥𝑖 + ℎ𝜇𝑖 ; 𝑦𝑖 + ℎ ( ∑ 𝜆𝑖𝑚 𝑘𝑚 ))
Clamped Boundary Conditions: 1. Trapezoidal Rule
𝑚=1

𝑏 𝑚−1

𝑆𝑜′ (𝑥𝑜 ) = 𝑓𝑜′ 𝑎𝑛𝑑 𝑆𝑛−1 (𝑥𝑛 ) = 𝑓𝑛′ ℎ a. Improved Euler Method
∫ 𝑓(𝑥)𝑑𝑥 ≈ [𝑓(𝑎) + 𝑓(𝑏)] + ℎ ∑ 𝑓(𝑥𝑘 )
𝑎 2
3 𝑎1 − 𝑎𝑜 𝑐1 𝑘=1 1 1
𝑐𝑜 = [ − 𝑆𝑜′ (𝑥𝑜 )] − 𝑡 = 2 , 𝛼1 = 0 , 𝛼2 = 1 , 𝜇2 = ,𝜆 =
2ℎ𝑜 ℎ𝑜 2 𝑏−𝑎 2 21 2
ℎ= , 𝑥𝑘 = 𝑎 + 𝑘ℎ ( 𝑘 = 1, … , 𝑚 − 1)
3 𝑎𝑛 − 𝑎𝑛−1 𝑐𝑛−1 𝑚 ℎ ℎ
𝑐𝑛 = [ 𝑆 ′ (𝑥 ) − ]− 𝑘1 = 𝑓(𝑥𝑖 ; 𝑦𝑖 ) , 𝑘2 = 𝑓 (𝑥𝑖 + ; 𝑦𝑖 + 𝑘1 )
2ℎ𝑛−1 𝑛−1 𝑛 ℎ𝑛−1 2 Simpson 𝟏/𝟑 Rule
2. 2 2
𝑥2
ℎ 𝑦𝑖+1 = 𝑦𝑖 + ℎ𝑘2
CURVE FITTING-REGRESSION: ∫ 𝑓(𝑥)𝑑𝑥 ≈ [𝑓(𝑥0 ) + 4𝑓(𝑥1 ) + 𝑓(𝑥2 )]
𝑥0 3
1. Linear Regression b. Developed Euler Method
𝑥2 − 𝑥0
𝑦 = 𝑎𝑥 + 𝑏 ℎ=
2 1 3 2 2
𝑡 = 2 , 𝛼1 = ,𝛼 = ,𝜇 = ,𝜆 =
4 2 4 2 3 21 3
(∑ 𝑥𝑖2 ) 𝑎 + (∑ 𝑥𝑖 ) 𝑏 = ∑ 𝑥𝑖 𝑦𝑖 3. Simpson 𝟑/𝟖 Rule
𝑥3
3ℎ 𝑘1 = 𝑓(𝑥𝑖 ; 𝑦𝑖 )
∫ 𝑓(𝑥)𝑑𝑥 ≈ [𝑓(𝑥0 ) + 3𝑓(𝑥1 ) + 3𝑓(𝑥2 ) + 𝑓(𝑥3 )]
(∑ 𝑥𝑖 ) 𝑎 + 𝑛𝑏 = ∑ 𝑦𝑖 8
𝑥0 2ℎ 2ℎ
𝑘2 = 𝑓 (𝑥𝑖 + ;𝑦 + 𝑘 )
𝑥3 − 𝑥0 3 𝑖 3 1
2. Least Square Parabola ℎ=
3 1 3
𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 𝑦𝑖+1 = 𝑦𝑖 + ℎ ( 𝑘1 + 𝑘2 )
4. Boole’s Rule 4 4
(∑ 𝑥𝑖4 ) 𝑎 + (∑ 𝑥𝑖3 ) 𝑏 + (∑ 𝑥𝑖2 ) 𝑐 = ∑ 𝑥𝑖2 𝑦𝑖 𝑥4
∫ 𝑓(𝑥)𝑑𝑥 ≈ 3. Classical Runge-Kutta Method (RK-4)
𝑥0
(∑ 𝑥𝑖3 ) 𝑎 + (∑ 𝑥𝑖2 ) 𝑏 + (∑ 𝑥𝑖 ) 𝑐 = ∑ 𝑥𝑖 𝑦𝑖 ℎ
2ℎ 𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
[7𝑓(𝑥0 ) + 32𝑓(𝑥1 ) + 12𝑓(𝑥2 ) + 32𝑓(𝑥3 ) 6
(∑ 𝑥𝑖2 ) 𝑎 + (∑ 𝑥𝑖 ) 𝑏 + 𝑛𝑐 = ∑ 𝑦𝑖 45
+ 7𝑓(𝑥4 )] 𝑘1 = 𝑓(𝑥𝑖 ; 𝑦𝑖 )

3.
Linearization of Nonlinear 𝑥4 − 𝑥0 ℎ ℎ
ℎ= 𝑘2 = 𝑓 (𝑥𝑖 + ; 𝑦𝑖 + 𝑘1 )
Relationships 4 2 2
a. For the Power Equation 5. Multiple Integral ℎ ℎ
∑𝑁 𝑀 𝑘3 = 𝑓 (𝑥𝑖 + ; 𝑦𝑖 + 𝑘2 )
𝑘=1 𝑦𝑘 𝑥𝑘 𝑑 𝑏 𝑏 𝑑 2 2
𝑓(𝑥) = 𝐶𝑥 𝑀 ⇒ 𝐶 = 𝑁 2𝑀 ∫ ∫ 𝑓(𝑥, 𝑦)𝑑𝑥𝑑𝑦 = ∫ ∫ 𝑓(𝑥, 𝑦)𝑑𝑦𝑑𝑥
∑𝑘=1 𝑥𝑘
𝑐 𝑎 𝑎 𝑐 𝑘4 = 𝑓(𝑥𝑖 + ℎ; 𝑦𝑖 + ℎ𝑘3 )
b. For the Exponential Equation
𝑓(𝑥) = 𝐶𝑒 𝐴𝑥 ⇒ ln 𝑦 = 𝐴𝑥 + ln 𝐶
𝐶 = 𝑒 𝐵 ; 𝑌 = 𝐴𝑥 + 𝐵
2/2

You might also like