today’s class numerical differentiation finite difference methods numerical methods lecture 14...
TRANSCRIPT
Today’s class
• Numerical Differentiation• Finite Difference Methods
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
1
Numerical Differentiation
• Finite Difference Methods• Forward• Backward• Centered
• Error Magnitude• O(h) for forward and backward• O(h2) for centered
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
2
Forward First Derivative
• Consider a function f(x) which can be expanded in a Taylor series in the neighborhood of a point x
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
3
Forward First Derivative
Numerical MethodLecture 14
Prof. Jinbo BiCSE, UConn
4
Backward First Derivative
• Consider a function f(x) which can be expanded in a Taylor series in the neighborhood of a point x
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
5
Backward First Derivative
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
6
Central First Derivative
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
7
Central First Derivative
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
8
Numerical Differentiation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
9
2nd-order Forward Difference
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
10
High-Accuracy Differentiation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
11
Forward Finite-Divided Difference
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
12
Backward Difference Scheme
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
13
+
Backward Finite-Divided Difference
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
14
Centered Difference Scheme
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
15
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
16
Centered Divided Difference
• Example:
• Find derivative at x=0.5, h=0.25• True
• Forward
Basic Differentiation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
17
• Example:• Backward
• Centered
Basic Differentiation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
18
• Forward
• Backward
• Centered
High-Accuracy Differentiation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
19
• Forward Divided Difference method uses the value of points in front of or at the point where the derivative is calculated.
• Backward Divided Difference method uses the value of points behind of or at the point where the derivative is calculated.
Summary
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
20
• Centered Divided Difference uses the value of points both in front and behind of the point where the derivative is calculated.
• Centered method is usually more accurate than forward & backward methods
• Accurate formulas use more points in the calculations.
Summary
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
21
• As with integration, use two approximations to arrive at a better approximation
• D is the true value but unknown and D(h1) is an approximation based on the step size h1. Reducing the step size to half, h2 =h1/2, we obtained another approximation D(h2).
• By properly combining the two approximations, D(h1) & D(h2), the error is reduced to O(h4).
Richardson Extrapolation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
22
Richardson Extrapolation
2)( hhE
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
23
Richardson Extrapolation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
24
Richardson Extrapolation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
25
• Example:• h=0.5
• h=0.25
• Extrapolate
Richardson’s Extrapolation
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
26
Unevenly Spaced Data
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
27
Unevenly Spaced Data
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
28
Unevenly Spaced Data
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
29
Unevenly Spaced Data
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
30
Unevenly Spaced Data
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
31
Next class
• Ordinary Differential Equations• Read Chapter PT7, 25
Numerical MethodsLecture 14
Prof. Jinbo BiCSE, UConn
32