Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical differentiation

Similar presentations


Presentation on theme: "Numerical differentiation"— Presentation transcript:

1 Numerical differentiation
Recall finite differences from first week Derived from Taylor series

2 Neglecting all tersms higher than first order
That’s the forward difference - also backwards and centered difference

3 Why is centered finite difference O(h2)?
Subtract second equation from first

4 We can combine Taylor series expansions in many different ways to get estimates of derivatives
Example: backwards second derivative, O(h2) Start with

5 Multiply first equation by -5, second equation by 4 and add together
+

6 Multiply third equation by -1 and add to above result
+ Rearrange

7 Where did I get -5, 4,-1? We multiply 1st equation by a, second by b, third by c

8 Now sum all equations and collect terms
Decide what derivatives we want to make disappear - want a second derivative only - eliminate first and third

9 Three unknowns - 2 equations - make an assumption
Let c=-1 Can solve by hand

10 If we have more derivatives to get rid of, use matrix methods - always one assumption

11 More Richardson extrapolation
Recall Can do the same thing with derivatives

12 Use same approach as Romberg integration with halving the step size
Example: Formula for active lateral pressure coefficient Ka with internal angle of friction f and wall with slope b and flat top is Use Richardson/Romberg approach to estimate at b=10 degrees and f=15 degrees

13 Use O(h2) estimates to get O(h6) estimate

14 Now do Richardson/Romberg trick

15 Derivatives of unequally spaced data
Can use matrix approach with different amounts of h Example: given values of f at x=(1,2,5.5,9) determine f’’ at 2

16 Let h=1, x=2 (values at 1,2,5.5,9) Equations to get rid of f’ and f’’’ are and assume a value for c

17 Let c=1, then a= , b= then or

18 Derivatives of unequally spaced data
Another way is to take derivative of interpolating polynomial Lagrange polynomial - second order in this case

19 Derivatives and integrals with errors in data
Errors in data points can cause problems esp. with differentiation Example: with and without noise True derivative is 2x-6

20 Look at ratio of noise in y to noise in dy/dx
For differentiation, fit a smooth line to the data, then take derivative


Download ppt "Numerical differentiation"

Similar presentations


Ads by Google