1 / 41

Lecture 18 - Numerical Differentiation

Lecture 18 - Numerical Differentiation. CVEN 302 July 19, 2002. Lecture’s Goals. Finite Difference Schemes Taylor Series Expansion for Differentiation Basic Numerical Integration Trapezoidal Rule Simpson’s Rule Midpoint Gaussian Quadrature. v. v. dv. dt. t. t. a. y. t.

Download Presentation

Lecture 18 - Numerical Differentiation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 18 - Numerical Differentiation CVEN 302 July 19, 2002

  2. Lecture’s Goals • Finite Difference Schemes • Taylor Series Expansion for Differentiation • Basic Numerical Integration • Trapezoidal Rule • Simpson’s Rule • Midpoint • Gaussian Quadrature

  3. v v dv dt t t a y t Calculus - Numerical Methods Differentiation Integration

  4. Numerical Differentiation • Estimate the derivatives (slope, curvature, etc.) of a function by using the function values at only a set of discrete points • Ordinary differential equation (ODE) • Partial differential equation (PDE)

  5. Numerical Differentiation • Represent the function by Taylor polynomials or Lagrange interpolation • Evaluate the derivatives of the interpolation polynomial at selected nodal points

  6. Numerical Differentiation A Taylor series or Lagrange interpolation of points can be used to find the derivatives. The Taylor series expansion is defined as:

  7. First Derivative at a Point i-2 i-1 i i+1 i+2

  8. Numerical Differentiation Use the Taylor series expansion to represent three points about single location:

  9. Numerical Differentiation Assume that the data points are “equally spaced” and the equations can be written as:

  10. Forward Differentiation For a forward first derivative, subtract eqn[2] from eqn[1]: Rearrange the equation:

  11. Forward Differentiation As the Dx gets smaller the error will get smaller The error is defined as:

  12. Backward Differentiation Subtract eqn[3] from eqn[2]: The error is defined as:

  13. Central Differentiation Subtract eqn[3] from eqn[1]: The error is defined as:

  14. Differential Error Notice that the errors of the forward and backward 1st derivative of the equations have an error of the order of O(Dx) and the central differentiation has an error of order O(Dx2). The central difference has an better accuracy and lower error that the others. This can be improved by using more terms to model the first derivative.

  15. = 0 = 0 0 Numerical Differentiation If you want to improve the accuracy and decrease the error you will need to eliminate terms :

  16. Higher Order Errors in Differentiation The terms become : The terms become A=-3, B= 4 and C=-1

  17. Forward difference Backward difference Higher Order 1st Derivative Parabolic curve i-2 i-1 i i+1 i+2

  18. Higher Order Derivatives To find higher derivatives, use the Taylor series expansions of term and eliminate the terms from the sum of equations. To improve the error in the problem add additional terms.

  19. = 0 = 0 = # 2nd Derivative of the Function It will require three terms to get a central 2nd derivative of discrete set of data.

  20. 2nd Order Central Difference The terms become : The terms become A=1,B=-2 and C=1. Therefore

  21. Lagrange Differentiation Another form of differentiation is to use the Lagrange interpolation between three points. The values can be determine for unevenly spaced points. Given:

  22. Lagrange Differentiation Differentiate the Lagrange interpolation Assume a constant spacing

  23. Lagrange Differentiation Differentiate the Lagrange interpolation Variouslocations

  24. Lagrange Differentiation To find a higher order derivative from the Lagrange interpolation for a three point Lagrange Take the derivative

  25. Partial Derivatives • Straightforward extension of one-dimensional formula (i, j+2) (i-1, j+1) (i, j+1) (i+1, j+1) (i-2, j) (i-1, j) (i, j) (i+1, j) (i+2, j) (i-1, j-1) (i, j-1) (i+1, j-1) (i, j-2)

  26. (i, j+2) (i-1, j+1) (i, j+1) (i+1, j+1) (i-2, j) (i-1, j) (i, j) (i+1, j) (i+2, j) (i-1, j-1) (i, j-1) (i+1, j-1) (i, j-2)

  27. Partial Derivatives Laplacian Operator j+1 j j-1 i-1 i i+1

  28. Partial Derivatives Mixed Derivative j+1 j j-1 i-1 i i+1

  29. Bi-harmonic Operator j+2 j+1 j j-1 j-2 i-2 i-1 i+1 i+2 i

  30. Richardson Extrapolation This technique uses the concept of variable grid sizes to reduce the error. The technique uses a simple method for eliminating the error. Consider a second order central difference technique. Write the equation in the form:

  31. Richardson Extrapolation The central difference can be defined as Write the equation with different grid sizes

  32. Richardson Extrapolation Expand the terms:

  33. Richardson Extrapolation Multiply eqn [2] by 4 and subtract eqn [1] from it.

  34. Richardson Extrapolation The equation can be rewritten as: It can be rewritten in the form

  35. Richardson Extrapolation The technique can be extrapolated to include the higher order error elimination by using a finer grid.

  36. Richardson Extrapolation Example The function is given: Find the first derivative at x=1.25 using a central difference scheme and Dh = 0.25. The exact solution:

  37. Richardson Extrapolation Example The data points are: The derivatives using central difference

  38. Richardson Extrapolation Example The results of the central difference scheme are: The Richardson Extrapolation uses these results to find a better solution

  39. Summary • Finite Difference Techniques • Taylor Series • Lagrange Polynomials • Error Calculation

  40. Summary • Finite Difference Techniques • Forward Difference Scheme • Backward Difference Scheme • Central Difference Scheme

  41. Homework • Check the Homework webpage

More Related