Professional Documents
Culture Documents
Sec:4.1 Numerical Differentiation
Sec:4.1 Numerical Differentiation
Numerical
Differentiation
Sec:4.1 Numerical Differentiation Approximation
Two-Point Formula
Example
Use table 4.2 and forward-difference formula to
approximate with
1
𝒉=𝟎. 𝟏 𝑓 ′ (2) ≈ { 𝑓 ( 2.1 ) − 𝑓 (2) }
(0.1)
Use table 4.2 and backward-difference formula to
approximate with
1
𝑓 ′ (2) ≈ { 𝑓 ( 2 ) − 𝑓 (1.8) }
𝒉=𝟎 . 𝟐 (0.2)
Sec:4.1 Numerical Differentiation Approximation
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
𝒙 𝟎 −𝟐 𝐡 𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 +𝟑 𝐡 𝒙 𝟎 +𝟒 𝐡
𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
Sec:4.1 Numerical Differentiation Approximation
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
Example
Use table 4.2 and three-point endpoint formula to
approximate with
𝑓 ′ (2)≈
= 22.032310
Sec:4.1 Numerical Differentiation Approximation
𝒙 𝟎 −𝟐 𝐡 𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 +𝟑 𝐡 𝒙 𝟎 +𝟒 𝐡
Example
Use table 4.2 and five-point midpoint formula to
approximate with
𝑓 ′ (2) ≈
𝒙 𝟎 −𝟐 𝐡 𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 +𝟑 𝐡 𝒙 𝟎 +𝟒 𝐡
Example
Use table 4.2 and five-point midpoint formula to
approximate with
𝑓 ′ (2) ≈ = 22.166999
𝒙 𝟎 −𝟐 𝐡 𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 +𝟑 𝐡 𝒙 𝟎 +𝟒 𝐡
Example
Use table 4.2 and five-point midpoint formula to
approximate with
𝑓 ′ (2) ≈ = 22.166999
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
Example
Use table 4.2 and three-point midpoint formula to
approximate (consider all possible cases)
1
𝒉=𝟎. 𝟏 𝑓 ′ (2) ≈ { 𝑓 ( 2.1 ) − 𝑓 (1.9) }
2(0.1)
1
𝑓 ′ (2) ≈ { 𝑓 ( 2.2 ) − 𝑓 (1.8) }
𝒉=𝟎. 𝟐 2(0.2)
Sec:4.1 Numerical Differentiation Approximation
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
Example
Use table 4.2 and three-point endpoint formula to
approximate (consider all possible cases)
𝒉=− 𝟎.𝟏
1
𝑓 ′ (2.2) ≈ { − 3 𝑓 ( 2.2 ) + 4 𝑓 ( 2.1 ) − 𝑓 (2)}
2(−0.1)
𝒉=− 𝟎.𝟐
1
𝑓 ′ (2.2)≈ { − 3 𝑓 ( 2.2 ) + 4 𝑓 ( 2 ) − 𝑓 (1.8) }
2(−0.2)
Sec:4.1 Numerical Differentiation Approximation
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
𝒙 𝟎 −𝟐 𝐡 𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡 𝒙𝟎 +𝟑 𝐡 𝒙 𝟎 +𝟒 𝐡
𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
Sec:4.1 Numerical Differentiation
Comparison Study
Example
True Error
The true value 22.167168
Three-point endpoint with h = 0.1 22.03231 e−1 × 1.35
Three-point endpoint with h = −0.1 22.054525 e−1 1.13
Three-point midpoint with h = 0.1 22.22879 e-2 6.16−
Three-point midpoint with h = 0.2 22.414163 e-1 2.47−
Five-point midpoint with h = 0.1 22.166999 e-4 1.69
Table 4.2 represents
values of
If we had no other information we would accept the five-point
midpoint approximation using h = 0.1 as the most accurate, and expect
the true value to be between that approximation and the three-point
mid-point approximation that is in the interval [22.166, 22.229].
Sec:4.1 Numerical Differentiation Approximation
𝒙𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡
Example
Use table 4.2 and Second Derivative Midpoint Formula to approximate with
𝑓 ′ ′(2)≈ 𝑓 ′ ′(2)≈
= =
= 29.593200 = 29.704275
True Error
The true value 29.556224
midpoint with h = 0.1 29.5932 e-2 3.70−
midpoint with h = 0.2 29.704275 e-1 1.48−
Sec:4.1 Numerical Differentiation 𝑫𝒆𝒓𝒊𝒗𝒂𝒕𝒊𝒐𝒏𝒔
𝐿𝑎𝑔𝑟𝑎𝑛𝑔𝑒 𝐼𝑛𝑡𝑒𝑟𝑝𝑜𝑙𝑎𝑡𝑖𝑜𝑛 𝑝𝑜𝑙𝑦𝑛𝑜𝑚𝑖𝑎𝑙
𝑇𝑎𝑦𝑙𝑜𝑟 𝑠𝑒𝑟𝑖𝑒𝑠
𝑫 𝒙 [ ( 𝒙 − 𝒙 𝟏 )( 𝒙 − 𝒙 𝟐 ) ( 𝒙 − 𝒙 𝟑 ) ] =¿
Sec:4.1 Numerical Differentiation 𝑫𝒆𝒓𝒊𝒗𝒂𝒕𝒊𝒐𝒏𝒔
Three-Point Midpoint Formula Three-Point Endpoint Formula
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
= (+ +
Set
Sec:4.1 Numerical Differentiation
𝒙 𝟎 −𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 𝒙 𝟎 +𝐡 𝒙𝟎 +𝟐 𝐡
= (+ +
Set
Sec:4.1 Numerical Differentiation 𝑫𝒆𝒓𝒊𝒗𝒂𝒕𝒊𝒐𝒏𝒔
𝑇𝑎𝑦𝑙𝑜𝑟 𝑠𝑒𝑟𝑖𝑒𝑠
𝑻𝒂𝒚𝒍𝒐𝒓 𝒔𝒆𝒓𝒊𝒆𝒔
1 2 1 3 1 4
𝑓 ( 𝑥 0 +𝑘 )= 𝑓 ( 𝑥 0 ) +𝑘𝑓 ′ ( 𝑥 0 ) + 𝑘 𝑓 ′ ′ ( 𝑥0 )+ 𝑘 𝑓 ′ ′ ′ ( 𝑥 0 )+ 𝑘 𝑓 ′ ′ ′ ′ ( 𝑥 0 )+ ⋯
2 6 24
𝒔𝒆𝒕 𝒌=𝒉
1 2 1 3 1 4
𝑓 ( 𝑥 0 +h ) = 𝑓 ( 𝑥0 ) + h𝑓 ′ ( 𝑥0 ) + h 𝑓 ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ′ ( 𝑥0 ) + ⋯
2 6 24
𝒔𝒆𝒕 𝒌=𝟐 𝒉
2 4 3 4 4
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h𝑓 ′ ( 𝑥 0 ) +2 h 𝑓 ′ ′ ( 𝑥0 )+ h 𝑓 ′ ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ′ ( 𝑥 0 ) +⋯
3 3
𝒔𝒆𝒕 𝒌=−𝒉
1 2 1 3 1 4
𝑓 ( 𝑥 0 −h )= 𝑓 ( 𝑥0 ) − h 𝑓 ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ( 𝑥 0 ) − h 𝑓 ′ ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ′ ( 𝑥0 ) + ⋯
2 6 24
𝒔𝒆𝒕 𝒌=−𝟐 𝒉
4 3 4
𝑓 ( 𝑥 0 −2 h ) = 𝑓 ( 𝑥 0 ) −2 h𝑓 ′ ( 𝑥 0 ) +2 h2 𝑓 ′ ′ ( 𝑥 0 ) − h 𝑓 ′ ′ ′ (𝑥0 )+ h4 𝑓 ′ ′ ′ ′ (𝑥0 )+ ⋯
3 3
Sec:4.1 Numerical Differentiation
Example
Derive a three-point formula to approximate f’(x0) that uses f (x0), f (x0 + h), f (x0 +
2h). Then find the error term [what is the order of the error O(
𝒇 ′ ( 𝒙 𝟎 )= 𝑨 𝒇 ( 𝒙 𝟎 ) + 𝑩 𝒇 ( 𝒙 𝟎 + 𝒉 ) + 𝑪 𝒇 ( 𝒙 𝟎 +𝟐 𝒉 ) + 𝑬𝒓𝒓𝒐𝒓
𝑨 𝑓 ( 𝑥0)= 𝑓 ( 𝑥0)
𝑩 ′
𝑓 ( 𝑥 0 +h ) = 𝑓 ( 𝑥0 ) + h 𝑓 ( 𝑥0 )+
1 2 ′′
2
1 3 ′′ ′
h 𝑓 ( 𝑥 0 ) + h 𝑓 ( 𝑥 0 ) +⋯
6
𝑪 4
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h 𝑓 ′ ( 𝑥 0 ) +2 h2 𝑓 ′ ′ ( 𝑥0 )+ h3 𝑓 ′ ′ ′ ( 𝑥 0 ) + ⋯
3
¿
( 𝐴+ 𝐵 + 𝐶 ) 𝑓 ( 𝑥0 ) + h ( 𝐵 +2 𝐶 ) 𝑓 ′ ( 𝑥 0 ) +h
3
2
( 1
2 )
𝐵+2 𝐶 𝑓 ′ ′ ( 𝑥 0 )
1 4
+( 𝐵𝑓 ′ ′ ′ ( 𝑥 0 ) + 𝐶𝑓 ′ ′ ′ ( 𝑥0 ))h
6 3
h ( 𝐵+2 𝐶 )=1
h
1
2
2 (
𝐵+2 𝐶 =0 ) ′
𝑨=
𝒇 ( 𝒙 𝟎 )≈ −
𝟐𝒉
𝟑
𝟐𝒉
𝑩=
𝟐
𝒉
𝑪=
𝒇 ( 𝒙 𝟎 ) + 𝒇 ( 𝒙 𝟎+ 𝒉 ) −
𝒉
𝟐𝒉
𝟏
𝟐𝒉
𝒇 ( 𝒙 𝟎 +𝟐 𝒉 )
Sec:4.1 Numerical Differentiation
Example
Derive a three-point formula to approximate f’(x0) that uses f (x0), f (x0 + h), f (x0 +
2h). Then find the error term [what is the order of the error O(
𝒇 ′ ( 𝒙 𝟎 )= 𝑨 𝒇 ( 𝒙 𝟎 ) + 𝑩 𝒇 ( 𝒙 𝟎 + 𝒉 ) + 𝑪 𝒇 ( 𝒙 𝟎 +𝟐 𝒉 ) + 𝑬𝒓𝒓𝒐𝒓
𝑨 𝑓 ( 𝑥0)= 𝑓 ( 𝑥0)
𝑩 𝑓 ( 𝑥 0 +h ) = 𝑓 ( 𝑥0 ) + h 𝑓 ( 𝑥0 )+
1 2 ′′
2
′ 1 3 ′′ ′
h 𝑓 ( 𝑥 0 ) + h 𝑓 ( 𝑥 0 ) +⋯
6
𝑪 ′ 2 ′′ 4 3 ′′ ′
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h 𝑓 ( 𝑥 0 ) +2 h 𝑓 ( 𝑥0 )+ h 𝑓 ( 𝑥 0 ) + ⋯
3
¿
( 𝐴+ 𝐵 + 𝐶 ) 𝑓 ( 𝑥0 ) + h ( 𝐵 +2 𝐶 ) 𝑓 ′ ( 𝑥 0 ) +h
3
2
( 1
2 )
𝐵+2 𝐶 𝑓 ′ ′ ( 𝑥 0 )
1 4
+( 𝐵𝑓 ′ ′ ′ ( 𝑥 0 ) + 𝐶𝑓 ′ ′ ′ ( 𝑥0 ))h
6 3
𝒇 ′ ′ ( 𝒙 𝟎 ) = 𝑨 𝒇 ( 𝒙 𝟎 ) + 𝑩 𝒇 ( 𝒙 𝟎+𝒉 ) + 𝑪 𝒇 ( 𝒙 𝟎 +𝟐 𝒉 ) + 𝑬𝒓𝒓𝒐𝒓
𝑨 𝑓 ( 𝑥0)= 𝑓 ( 𝑥0)
𝑩 ′
𝑓 ( 𝑥 0 +h ) = 𝑓 ( 𝑥0 ) + h 𝑓 ( 𝑥0 )+
1 2 ′′
2
1 3 ′′ ′
h 𝑓 ( 𝑥 0 ) + h 𝑓 ( 𝑥 0 ) +⋯
6
𝑪 4
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h 𝑓 ′ ( 𝑥 0 ) +2 h2 𝑓 ′ ′ ( 𝑥0 )+ h3 𝑓 ′ ′ ′ ( 𝑥 0 ) + ⋯
3
¿
( 𝐴+ 𝐵 + 𝐶 ) 𝑓 ( 𝑥0 ) + h ( 𝐵 +2 𝐶 ) 𝑓 ′ ( 𝑥 0 ) +h
3
2
( 1
2 )
′′
𝐵+2 𝐶 𝑓 ( 𝑥 0 )
1 4
+( 𝐵𝑓 ′ ′ ′ ( 𝑥 0 ) + 𝐶𝑓 ′ ′ ′ ( 𝑥0 ))h
6 3
𝑓 ′ ( 𝑥 0 )= 𝑨 𝑓 ( 𝑥 0 − h ) + 𝑩 𝑓 ( 𝑥 0 ) + 𝑪 𝑓 ( 𝑥 0 +h )+ 𝑫 𝑓 ( 𝑥 0 +2 h ) + 𝑬 𝑓 ( 𝑥 0 +3 h ) + 𝑬𝒓𝒓𝒐𝒓
1 2 1 3 1 4
𝑨 𝑓 ( 𝑥 0 −h )= 𝑓 ( 𝑥0 ) − h 𝑓 ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ( 𝑥 0 ) − h 𝑓 ′ ′ ′ ( 𝑥 0 ) +
2 6 24
h 𝑓 ′ ′ ′ ′ ( 𝑥0 ) + ⋯
𝑩 𝑓 ( 𝑥0)= 𝑓 ( 𝑥0)
1 2 1 3 1 4
𝑪 𝑓 ( 𝑥 0 +h ) = 𝑓 ( 𝑥0 ) + h𝑓 ′ ( 𝑥0 ) +
2
h 𝑓 ′ ′ ( 𝑥0)+ h 𝑓 ′ ′ ′ ( 𝑥0)+
6 24
h 𝑓 ′ ′ ′ ′ ( 𝑥0 ) + ⋯
4 3 4 4
𝑫
2
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h𝑓 ′ ( 𝑥 0 ) +2 h 𝑓 ′ ′ ( 𝑥0 )+ h 𝑓 ′ ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ′ ( 𝑥 0 ) +⋯
3 3
𝑬 2
𝑓 ( 𝑥 0 +2 h ) = 𝑓 ( 𝑥 0 ) +2 h𝑓 ′ ( 𝑥 0 ) +2 h 𝑓 ′ ′ ( 𝑥0 )+
4 3
3
4 4
h 𝑓 ′ ′ ′ ( 𝑥 0 ) + h 𝑓 ′ ′ ′ ′ ( 𝑥 0 ) +⋯
3
𝑳𝑯𝑺=¿
Sec:4.1 Numerical Differentiation