MATH 4073 Numerical Analysis in Test Notes (Cheat Cheat Sheet) v4.0

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

 Error Estimation vii) Error: max f ( x)  S ( x )  5M * max ( x j 1  x j ) 4 (where max f ( 4)

( x)  M )
• ea  p  p * a  x b 384 0  j  n 1 a  x b

p  p*
• er 
p

 Fixed Point Iteration


• g ( x)  x
• g ' ( x)  k  1
• p n  g  p n 1  n 1
 Newton Method
• An efficient method belonging to FP Iteration
f ( x)
• g ( x)  x 
f ' ( x)
• g ' ( p )  0 (slope is 0 at the root g ( x )  x )
• f ' ( x)  0 (otherwise, Newton Method is undefined)

• f  pn 1 
p n  p n1 
f '  pn 1 

 Cubic Spline Interpolation


• Piecewise Linear Approximation
i) Easy
ii) No assurance of differentiability
iii) No assurance of smoothness
• Piecewise Quadratic Approximation
i) Continuously differentiable on the interval
ii) Smooth
iii) Can’t satisfy endpoint conditions
• Piecewise Cubic Approximation
i) Also called Cubic Spline Interpolation
ii) Continuously 1st & 2nd differentiable on the interval
iii) Smooth
iv) Meet Endpoint Conditions as:
(1) Free Boundary: S " ( x 0 )  S " ( x n )  0
(2) Clamped Boundary: S ' ( x 0 )  f ' ( x n ) & S ' ( x n )  f ' ( x n )
v) Form:
S j ( x)  a j  b j  x  x j   c j  x  x j   d j  x  x j 
2 3

vi) Rationale
(1) S j-1 ( x j )  S j ( x j )  f ( x j ) (give 2 equations)
(2) S j-1 ' ( x j )  S j ' ( x j ) (give 1 equation)
(3) S j-1 " ( x j )  S j " ( x j ) (give 1 equation)
(4) Boundary Conditions (give 2 equations)
h  (b  a ) h 2
b n 1
i) Trapezoidal Rule  ba
 Numerical Differentiation  f ( x)dx  
2
f ( a )  2  f ( x j )  f (b ) 
12
f " ( ) h 


n 
a j 1 
• 1st Derivative

i) Forward-Difference Formula: f ' ( x0 )  f ( x0  h)  f ( x0 )  h f " ( ( x0 )) 


h 
ba
h 2 b
h m1 m  (b  a)h ( 4)
4

ii) Simpson’s
 f ( x)dx  3  f (a)  2 f ( x 2j )  4 f ( x2 j 1 )  f (b) 
180
f ( ) 
n
2m
ii) Backward-Difference Formula: f ' ( x0 )  f ( x0 )  f ( x0  h)  h f " ( ( x0 )) a j 1 j 1  m 
h 2  2
b m
(b  a ) h 2 ba 
iii) 3P Forward: f ' ( x0 )   3 f ( x0 )  4 f ( x0  h)  f ( x0  2h)  h f (3) ( 0 ) 
2
iii) Midpoint Rule  f ( x)dx  2h f ( x2 j )  f " ( ) h  
2h 3 a j 0 6  2m 2

iv) 3P Midpoint: f ' ( x0 )  f ( x0  h)  f ( x0  h)  h f ( 3) ( 0 )


2

2h 6

v) 5P Forward: f ' ( x0 )   25 f ( x0 )  48 f ( x0  h)  36 f ( x0  2h)  16 f ( x0  3h)  3 f ( x0  4h)  h f (5) ( 0 )


4

12h 5

vi) 5P Midpoint: f ' ( x0 )  f ( x0  2h)  8 f ( x0  h)  8 f ( x0  h)  f ( x0  2h)  h f (5) ( 0 )


4

12h 30
nd
• 2 Derivative:
f ( x0  h)  2 f ( x0 )  f ( x0  2 h) h 2
f " ( x0 )   f ( 4 )

h 2 12

 Numerical Integration

• Simple Closed Newton-Cotes Formulas  h  b  a 


 n 
x1 3
h
i) n=1: Trapezoidal Rule
 f ( x ) dx   f ( x0 )  f ( x1 )  h f " ( )
x0
2 12

x2 5
h
ii) n=2: Simpson’s Rule
 f ( x)dx   f ( x0 )  4 f ( x1 )  f ( x2 )  h f ( 4) ( )
x0
3 90

x3 5
3h
iii) n=3: Simpson’s 3 Rule
 f ( x)dx   f ( x0 )  3 f ( x1 )  3 f ( x2 )  f ( x3 )  3h f (4) ( )
8 x0
8 80

• Simple Open Newton-Cotes Formulas  h  b  a 


 n 2
x1
i) n=0: Midpoint Rule h3

x1
f ( x ) dx  2hf ( x0 ) 
3
f " ( )

x2 3
3h
ii) n=1: xx Rule
 f ( x) dx   f ( x0 )  f ( x1 )  3h f " ( )
x1
2 4

• Composite
b n
• M  N 1 ( h)  K 1 h 2  K 2 h 4  K 3 h 6  ...
 Gaussian Quadrature  f ( x)dx   ci f ( xi )
i 1

a
h
b
 4 N 1 ( )  N 1 ( h)
• n  2:  f ( x)dx  f  0.5773502692  f   0.5773502692  N 2 ( h) 
2
3
a

b
 h
16 N 2 ( )  N 2 (h)
• n  3:  f ( x)dx  0.555556 f  0.7745966692  0.88889 f  0  0.555556 f   0.7745966692
a
i) Step of h 
  N 3 ( h)  2
b
2  15
h
• n  4:  f ( x)dx  0.347855 f  0.8611363116   0.652145 f  0.3399810436   4 j 1 N j 1 ( )  N j 1 (h)
a  N ( h)  2
 j j 1
4 1
 0.347855 f   0.8611363116  0.652145 f   0.3399810436

b 
• n  5:  f ( x)dx  0.236927 f  0.9061798459  0.47863 f  0.5384693101  0.568889 f  0

a
h
 0.236927 f   0.9061798459  0.47863 f   0.5384693101  16 N 1 ( )  N 1 (h)
4
 N 2 ( h) 
  b  a  t  (b  a)  b  a 
b 1
 15
• Transformation of Boundary:  f ( x)dx   f  2  2 dt  h
a 1 256 N 2 ( )  N 2 (h)
ii) Step of h  4
  N 3 ( h) 
4  255
 Richardson’s Extrapolation   h
16 N j 1 ( )  N j 1 (h)
j 1

• M  N1 (h)  K1h  K 2 h 2  K 3 h 3  ...  N ( h)  4


 j 16 j 1  1
 h 
2 N1 ( )  N 1 ( h ) 
 2
 N 2 ( h) 
 1
 h  Lipschitz Condition: A function f (t , y ) is said satisfy a Lipschitz condition in the variable y on a set
4 N 2 ( )  N 2 ( h)
i) Step of h  2
  N 3 ( h)  D  R 2 if a constant L  0 exists with
2  3
h f (t , y1 )  f (t , y 2 )  L y1  y 2
 2 j 1 N j 1 ( )  N j 1 (h)
 N ( h)  2 wherever (t , y1 ), (t , y 2 )  D . The constant L is called a Lipschitz constant for f
 j j 1
2 1  Suppose f (t , y ) is defined on a convex set D  R 2 . If a constant L  0 exists with


f , for all (t , y )  D ,
(t , y )  L
y
 h
 4 N 1 ( )  N 1 ( h) then f satisfies a Lipschitz condition on D in the variable y with Lipschitz constant L
4
 N 2 ( h) 
 3
 h
16 N 2 ( )  N 2 (h)
ii) Step of h  4
  N 3 ( h) 
4  15
  h
4 N j 1 ( )  N j 1 (h)
j 1
 N ( h)  4
 j 4 j 1  1


 Higher-Order Taylor Method
 1 n  n n f 
     t  t 0   y  y 0   t 0 , y0  
n j j
• dy n j
 f (t , y ), a  t  b, y (a )    n! j 0  j  t y j

dt

wi 1  wi  hT ( n ) (t i , wi )  1 n 1  n  1  n 1 f 
  
 
  t  t  n 1 j
 y  y  j
  ,   
  n  1! j 0  j 
0 0
t n1 j y j 
hn
• Local Truncation Error  O(h n )  f ( n)
i , y ( i ) 
( n  1)!
• Order 1 (n=1: Euler’s Method)
i)
wi 1  wi  hT (1) (t i , wi )

 wi  h f (t i , wi )
h1 h
ii) Local Truncation Error  O(h1 )  f '   i , y ( i )   f '   i , y ( i ) 
(1  1)! 2
• Order 2
i)
wi 1  wi  hT ( 2 ) (t i , wi )

 h 
 wi  h  f (t i , wi )  f ' (t i , wi ) 
 2 
ii) Local Truncation Error
h2 h2
 O(h 2 )  f " i , y ( i )   f " i , y ( i ) 
( 2  1)! 6
• Order 3
i)
wi 1  wi  hT (3) (t i , wi )
 h h2 
 wi  h f (t i , wi )  f ' (ti , wi )  f " (t i , wi )
 2 6 

h3 h3
ii) Local Truncation Error  O( h 3 )  f (3)
i , y ( i )   f (3)
i , y ( i ) 
(3  1)! 24
 Taylor’s Expansion of 2 variables
• f  t , y   Pn  t , y   Rn  t , y 

0 f  t 0 , y0    t  t 0  f
 t 0 , y0    y  y0  f  t 0 , y0  

  t  t 0  
 0!  1! t 1! y 

  t  t0  2  2 f 2 t  t 0  y  y0   2 f  y  y0  2  2 f  t , y  
  t 0 , y 0    t 0 , y 0   0 0 
 2! t 2 2! ty 2! y 2 

  t  t0  3  3 f 3 t  t 0   y  y0   3 f
2
3 t  t 0  y  y 0   3 f
2
 y  y0  3  3 f  t , y  
  t 0 , y 0    t 0 , y 0    t 0 , y 0   0 0 
 3! t 3 3! t 2 y 3! ty 2 3! y 3 


 Runge-Kutta Methods
 1
• Taylor Method Order 2  a1  4
 3
wi 1  wi  hT ( 2 ) (t i , wi )  O(h 2 )  a2 
 4  w  w  h  f (t , w )  3 f (t  2h , w  2h f (t , w

4
i 1
 h  h2 2h i

i i i
3
i
3
i
 wi  h  f (t i , wi )  f ' (t i , wi )   f "  i , y ( i )   2 
 2  6  3
  2h
 h df  h2
 wi  h  f (t i , wi )  * (t , y (t )) (t , y ( t )) ( ti , wi )   f "   i , y (

2
i ) 3
 2 dt  6
 h  f f •
dy  h2
 wi  h  f (t i , wi )  * (t , y (t ))  (t , y (t )) *    f "   i , y ( i ) 
2  
( t , y ( t ))( ti , wi ) ( t , y ( t )) ( ti , wi )
  t y dt  6
 h  f f  h2
 wi  h  f (t i , wi )  * (t , y (t ))  (t , y (t )) * f (t i , wi )    f "   i , y ( i ) 
2  
( t , y ( t )) ( ti , wi ) ( t , y ( t )) ( ti , wi )
  t y  6
• Runge-Kutta Manipulation I
i) Use a f  t   , y    to replace f (ti , wi )  h f ' (ti , wi ) of TM Order 2
1 1 1
2
ii) Taylor Polynomial of Degree 1 about  t , y  :
f
a1 f  t  1 , y  1   a1 f  t , y   a11  t , y   a11 f  t , y   a1R1 f  t  1 , y  1 
t y y

iii)
h h  f f 
f (ti , wi )  f ' (ti , wi )  f (ti , wi )  *  (t , y (t )) ( t , y ( t ))( ti , wi )  (t , y (t )) * f (ti , wi ) ( t , y ( t ))( ti , wi ) 
2 2  t y 
iv) Midpoint Method:

 a1  1

 h  h h  h2

 1   wi 1  wi  hf t i  , wi  f (t i , w )
i   f "   i , y ( i ) 
 2  2 2  6
 1  h f  t , y 

 2
• Runge-Kutta Manipulation II
i) Use a f  t , y   a f  t   , y   f  t , y   to replace f (ti , wi )  h f ' (ti , wi ) of TM Order 2
1 2 2 2
2
ii) M-Euler Method:
 1
 a1 
2

a 1 h h2
 2   wi 1  wi   f (ti , wi )  f (ti 1 , wi  hf (ti , wi ))  f "   i , y ( i ) 
 2 2 6
h
 2
 2
 h
iii) Heun’s Method:

You might also like