Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 4

Numerical Differentiation

Approximation:
f’(x0) = f(1)(x0)

Two-Point Formula

Lagrange Taylor
Three-Point Formula Series
Interpolation
Polynomial
Five-Point Formula

Difference
Difference Formulas
Formulas for
for f’(x)
f’(x) ≈≈ Approx
Approx error
error ξξ

Forward-difference f(x0+h) - f(x0) - f(2) (ξ) [x0 , x0+h]


Two- Forward-difference f(x0+h) - f(x0) f(2)(ξ) [x0 , x0+h]
Two-
Point
Point
Formula
Formula Backward-difference f(x0) - f(x0-h) + f(2) (ξ) [x0 , x0 -h]
Backward-difference f(x0) - f(x0-h) f(2)(ξ) [x0 , x0 -h]

-3f(x0) + 4f(x0+h) - f(x0+2h) f(3) (ξ) [x0 , x0+2h]


Forward-difference -3f(x0) + 4f(x0+h) - f(x0+2h) + f(3)(ξ)
Forward-difference [x0 , x0+2h]
Three-
Three-
Point Midpoint f(x0+h) - f(x0-h) - f(3) (ξ) [x0-h , x0 -h]
Point
Formula Midpoint f(x0+h) - f(x0-h) f(3)(ξ) [x0-h , x0 -h]
Formula
Backward-difference f(x0-2h) -4f(x0-h) +3f(x0) [x0-2h , x0 ]
Backward-difference
(Endpoint) + f(3) (ξ)
(Endpoint)
f(x0-2h) -4f(x0-h) +3f(x0) f(3)(ξ) [x0-2h , x0 ]

Five- Forward-difference -25f(x0) + 48f(x0+h) -36f(x0+2h) +16f(x0+3h) -3f(x0+4h) + f(5) (ξ) [x0 , x0+4h]
Five- Forward-difference -25f(x0) + 48f(x0+h) -36f(x0+2h) +16f(x0+3h) -3f(x0+4h) f(5)(ξ) [x0 , x0+4h]
Point
Point
Formula
Formula [x0-2h ,
Midpoint f(x0-2h) - 8f(x0-h) +8f(x0+h) -f(x0+2h) + f(5) (ξ) [x 0-2h ,
x0+2h]
Midpoint f(x0-2h) - 8f(x0-h) +8f(x0+h) -f(x0+2h) f(5)(ξ)
x0+2h]

Second Derivative Formula Approx error ξ


Second Derivative Formula Approx error ξ
Three- f(x0-h) -2f(x0) +f(x0-h) [x0-h , x0+h]
Three- Midpoint - f(4) (ξ)
Point Midpoint f(x0-h) -2f(x0) +f(x0-h) f(4)(ξ) [x0-h , x0+h]
Point

The Second Lagrange Polynomial


( 𝑥 − 𝑥 1 )( 𝑥 − 𝑥 2 ) ( 𝑥 − 𝑥 0 )( 𝑥 − 𝑥 2 ) ( 𝑥 − 𝑥 0) ( 𝑥 − 𝑥 1)
𝑓 2 ( 𝑥 )= 𝑓 ( 𝑥 0) + 𝑓 ( 𝑥 1 )+ 𝑓 ( 𝑥 2)
  ( 𝑥 0 − 𝑥 1 )( 𝑥 0− 𝑥 2 ) ( 𝑥 1 − 𝑥 0 )( 𝑥 1 − 𝑥 2 ) ( 𝑥 2 − 𝑥 0 ) ( 𝑥 2− 𝑥 1 ) x0
x1 = x0 + 1h
x2 = x0 + 2h
 
Differentiate
both side
( 𝑥 − 𝑥 0 −h )+ ( 𝑥 − 𝑥 0 − 2h ) ( 𝑥 − 𝑥 0 ) + ( 𝑥 − 𝑥 0 −2 h ) ( 𝑥 − 𝑥 0 ) + ( 𝑥 − 𝑥 0 −h )
𝑓 ′ ( x)= 𝑓 ( 𝑥 0 )+ 𝑓 (𝑥 0+h)+ 𝑓 ( 𝑥 0+ 2h )
  2h2 −h2 2h2
Set x = x0
′ −h −2 h − 2h −h −3 2 −1
𝑓 ( x 0 )= 𝑓 ( 𝑥 0 )+ 𝑓 ( 𝑥 0+ h ) + 𝑓 ( 𝑥 0+2 h ) = 𝑓 ( 𝑥 0 ) + 𝑓 ( 𝑥 0+ h)+ 𝑓 ( 𝑥 0+2 h )
  2h2 − h2 2h2 2h h 2h

The Taylor Series

( 𝑥 − 𝑎 ) (1) ( 𝑥 − 𝑎 ) 2 ( 2) ( 𝑥 − 𝑎) 𝑛
𝑓 𝑛 ( 𝑥 )= 𝑓 ( 𝑎 )+ . 𝑓 (𝑎)+ . 𝑓 ( 𝑎 ) +…+ .𝑓 (𝑛 )
( 𝑎 )=¿
  1! 2! 𝑛! x = x0 + k
a = x0
(error)

=
 
= B[

= C[

BC (BC)*h *h2 *h3 𝐴+ 𝐵+𝐶=1 ⇒ 𝐴 =−3/2 h


( B+2 C )∗ h  =1 ❑ 𝐵=+2 /1 h
( B / 2+2 C ) ∗ h 2 =0 𝐶  =−1/2 h {
Dùng Đa thức nộ i suy Lagrange suy ra các công thức
tính gần đúng đạo hàm và tích phân

( 𝑥 − 𝑥 1)( 𝑥 − 𝑥 2) ( 𝑥 − 𝑥 0 )( 𝑥 − 𝑥 2) ( 𝑥 − 𝑥 0) ( 𝑥 − 𝑥 1)
𝑓 The
 2(𝑥 Second Lagrange
)= 𝑓 ( 𝑥 0)+ 𝑓 ( 𝑥 1 )+ 𝑓 ( 𝑥 2)
( 𝑥 0 − 𝑥 1 ) ( 𝑥 0− 𝑥 2 )
Polynomial ( 𝑥 1 − 𝑥 0 ) ( 𝑥 1 − 𝑥 2) ( 𝑥 2 − 𝑥 0 ) ( 𝑥 2− 𝑥 1 )

 
1. Công thức tính đạo hàm theo 3 điểm đầu:

Differentiate both side:


( 𝑥 − 𝑥 0 −h )+ ( 𝑥 − 𝑥 0 − 2h ) ( 𝑥 − 𝑥 0 ) + ( 𝑥 − 𝑥 0 −2 h ) ( 𝑥 − 𝑥 0 ) + ( 𝑥 − 𝑥 0 −h ) 1 𝐷 { ( 𝑥 − 𝑥 0 ) ( 𝑥 − 𝑥 0− h ) ( 𝑥 − 𝑥 0− 2 h ) } ∗ 𝑓 (3 ) ( ξ ( 𝑥 ))
𝑓 ′ ( x)=
  2h2
𝑓 ( 𝑥 0 )+
−h2
𝑓 (𝑥 0+h)+
2h2
𝑓 ( 𝑥 0+ 2h )+
[
6 + ( 𝑥 − 𝑥 0 ) ( 𝑥 − 𝑥 0 − h ) ( 𝑥 − 𝑥 0 − 2h ) ∗ 𝐷 {𝑓 ( 3 ) ( ξ ( 𝑥 ) ) } ]
Set x = x0:

  𝐷{(𝑥− 𝑥0)(𝑥−𝑥0−h)(𝑥−𝑥0−2h)}=(𝑥−𝑥0−h)(𝑥−𝑥0−2h)+(𝑥−𝑥0)(𝑥−𝑥0−2h)+(𝑥−𝑥0)(𝑥−𝑥0−h)

 
2. Công thức tính đạo hàm cho 3 điểm giữa:

Differentiate both side:


( 𝑥 − 𝑥 0 ) + ( 𝑥 − 𝑥 0 −h ) ( 𝑥 − 𝑥 0+h )+ ( 𝑥 − 𝑥 0 − h ) ( 𝑥 − 𝑥 0+ h ) + ( 𝑥 − 𝑥 0 ) 1 𝐷 { ( 𝑥 − 𝑥 0+ h ) ( 𝑥 − 𝑥 0 )( 𝑥 − 𝑥 0 −h ) }∗ 𝑓 3 ( ξ ( 𝑥 ) )
( )
𝑓 ′ ( x)=
  2h2
𝑓 (𝑥 0 −h)+
−h2
𝑓 ( 𝑥 0) +
2h2
𝑓 ( 𝑥 0+h ) +
[
6 + ( 𝑥 − 𝑥 0+h )( 𝑥 − 𝑥 0 ) ( 𝑥 − 𝑥 0 −h ) ∗ 𝐷 { 𝑓 (3) ( ξ ( 𝑥 ) ) } ]
Set x = x0:

  𝐷{(𝑥 −𝑥0+h)(𝑥−𝑥0)(𝑥−𝑥0−h)}=(𝑥−𝑥0)(𝑥−𝑥0−h)+(𝑥−𝑥0+h)(𝑥−𝑥0−h)+(𝑥−𝑥0+h)(𝑥−𝑥0)
Product of two functions Product of three functions

  Dx[(x x1)(x x2)] = (x x2) + (x x1)


  Dx[(x x1)(x x2)(x x3)] = (x x2)(x x3) + (x x1)(x x3) + (x x1)(x x2)

 
3. Công thức tính tích phân cho 3 điểm (Quy tắc Simpson):

Integrate both sides:


( 𝑥 − 𝑥 0) 3 h ( 𝑥 − 𝑥 0) 2 ( 𝑥 − 𝑥 0) 3 h 2 ( 𝑥 − 𝑥 0) ( 𝑥 − 𝑥 0) 3 h ( 𝑥 − 𝑥 0) 2
− − +
∫  𝑓 ( x ) d 𝑥=
3 2 3 1 3 2
𝑓 ( 𝑥 0− h ) + 𝑓 ( 𝑥 0) + 𝑓 ( 𝑥 0+h )+ …
2 h2 −h2 2h2
x: x0 – h → x0 + h

 
Dùng Đa thức nộ i suy Taylor suy ra các công thức tính
gần đúng đạo hàm và tích phân

The Taylor Polynomial


(error)

= B[

= C[

BC (BC)*h *h2 *h3 A B C

0 1 0 -3/2h 2/h -1/2h

0 0 0 1/h 2
-2/h 2
1/h2
A B C

0 1 0 -3/2h 2/h -1/2h

0 0 0 1/h 2
-2/h 2
1/h2

Simpson’s
rule

Simpson’s
rule
Polynomical Interpolation [Nộ i suy đa thức]

Taylor Polynomial

If f has n derivatives at a, then the polynomial


 
is called the nth Taylor polynomial for f at a. A Taylor polynomial is said to be centered at a.
If a = 0, then

is called the nth Maclaurin polynomial for f at a. A Maclaurin polynomial is a Taylor polynomial centered at a.

Largrange Interpolating Polynomial

Give k points from a function f(x) you can write a polynomial of k-1 degrees called Largrange Polynomial
 

𝑓 𝑛+1(ξ ( 𝑥 ))
𝐸 𝑛 ( 𝑥) = ∗ ( 𝑥 − 𝑥 0 )( 𝑥 − 𝑥 1 ) …(𝑥 − 𝑥𝑛)
  ( 𝑛+1 ) !

1st-order 2nd-order

   

(𝑥 −𝑥0) (𝑥 − 𝑥 0 ) ( 𝑥 − 𝑥 0) ( 𝑥 − 𝑥 1) 𝑓 ( 𝑥 2) − 𝑓 ( 𝑥 1) 𝑓 (𝑥 1) − 𝑓 ( 𝑥 0)
𝑓 1 ( 𝑥 )=𝑓 ( 𝑥 0 ) +
  ( 𝑥 1− 𝑥 0 )
[𝑓 ( 𝑥 1 ) − 𝑓 ( 𝑥 0 ) ] 𝑓 2 ( 𝑥 )=𝑓 ( 𝑥 0 ) +
  (𝑥1−𝑥0)
[𝑓 ( 𝑥 1 ) − 𝑓 ( 𝑥 0 )]+
( 𝑥 2− 𝑥 0 ) [ 𝑥2− 𝑥1

𝑥 1− 𝑥 0 ]
Newton’s Interpolating Polynomial
  +…..
Quadratic Interpolation

Linear Interpolation
𝑓 1 (𝑥 ) − 𝑓 (𝑥 0) 𝑓 ( 𝑥 1 )− 𝑓 ( 𝑥 0 )
 
  ( 𝑥 − 𝑥 0)
=
( 𝑥 1 − 𝑥 0)

You might also like