1 Numerical Differentiation Jyun-Ming Chen
2 Contents Forward, Backward, Central Difference Richardson Extrapolation
3 Taylor’s Expansion
4 Forward Difference Formula for Geometrically h
5 Backward Difference Formula for Similarly h Geometrically
6 Central Difference Formula for –)–)
7 2h Geometrically
8 Example, Calculate f’(1) using FD, BD, CD
9 Example (cont) h=0.1 h=0.05 FD: BD: CD:
10 Example (cont) Remarks: –FD, BD, CD each involves 2 function calls, 1 subtraction, and 1 division: same computation time –CD is the most accurate (hence, the most recommended method) –However, sometimes, CD cannot be applied
11 Forward Difference Formula for –2 )
12 Backward Difference Formula for –2 )
13 Central Difference Formula for +)+) Similar remark on the selection of FD|BD|CD applies for f”(x)
14 More Accurate FD Formula for
15 Better accuracy can be achieved using this formula But, it involves more computations: –3 function calls, two +/–, one division Trade-off: –More computation is the price you paid for better accuracy Similar idea applies to more accurate BD formula More Accurate FD Formula (cont)
16 Richardson Extrapolation Idea: exact = computed+ error The truncation error is of the form: ch k –where c is some constant Use different h to estimate the truncation error Use extrapolation to get more accurate result
17 Example: CD for f’(x) Using Different h (h 1, h 2 ) : c 1 and c 2 could be different Richardson Extrapolation (cont)
18 If Richardson Extrapolation (cont)
19 f(x) = x 3. Use CD with Richardson extrapolation to compute f’(1) Example Magic? Coincidence?
20 Revisit CD Formula for –)–) Change notation:
21 Error Analysis Assuming Eliminate a 1 to get better accuracy
22 Error Analysis (cont) 44 –) O(h4)O(h4)
23 Revisit Previous Example f(x) = x 3. Use CD with Richardson extrapolation to compute f’(1) a 2 involves f (5) (x), hence, the exact solution is no surprise.
24 Remark How much effort did we use to get this level of accuracy? –F(h): f(x+h), f(x-h); one –, one –F(h/2): f(x+h/2), f(x-h/2); one –, one –R.E.: two , one –
25 Summary (Textbook p.373)
26
27 אקסטרפולציית ריצ'רדסון לביטול איבר השגיאה המוביל