Lecture 8 Numerical Differentiation Formulae By

Lecture 8 Numerical Differentiation Formulae By

CE 30125 - Lecture 8 LECTURE 8 NUMERICAL DIFFERENTIATION FORMULAE BY INTERPOLATING POLY- NOMIALS Relationship Between Polynomials and Finite Difference Derivative Approximations • We noted that Nth degree accurate Finite Difference (FD) expressions for first derivatives have an associated error N + 1 N d f Eh ---------------- dxN + 1 •If f(x) is an Nth degree polynomial then, dN + 1f ----------------= 0 N + 1 dx and the FD approximation to the first derivative is exact! • Thus if we know that a FD approximation to a polynomial function is exact, we can derive the form of that polynomial by integrating the previous equation. N N – 1 fx a1x +++a2x aN + 1 p. 8.1 CE 30125 - Lecture 8 • This implies that a distinct relationship exists between polynomials and FD expressions for derivatives (different relationships for higher order derivatives). • We can in fact develop FD approximations from interpolating polynomials Developing Finite Difference Formulae by Differentiating Interpolating Polynomials Concept th • The approximation for the p derivative of some function fx can be found by th taking the p derivative of a polynomial approximation, gx, of the function fx. Procedure • Establish a polynomial approximation gx of degree N such that Np •gx is forced to be exactly equal to the functional value at N + 1 data points or nodes th th • The p derivative of the polynomial gx is an approximation to the p derivative of fx p. 8.2 CE 30125 - Lecture 8 Approximations to First and Second Derivatives Using Quadratic Interpolation • We will illustrate the use of interpolation to derive FD approximations to first and second derivatives using a 3 node quadratic interpolation function • For first derivatives p=1 and we must establish at least an interpolating polynomial of degree N=1 with N+1=2 nodes • For second derivatives p=2 and we must establish at least an interpolating polyno- mial of degree N=2 with N+1=3 nodes • Thus a quadratic interpolating function will allow us to establish both first and second derivative approximations • Apply a shifted coordinate system to simplify the derivation without affecting the gener- ality of the derivation f0 f1 f2 x x0 h x1 h x2 0 h h shifted x axis p. 8.3 CE 30125 - Lecture 8 Develop a quadratic interpolating polynomial • We apply the Power Series method to derive the appropriate interpolating polynomial • Alternatively we could use either Lagrange basis functions or Newton forward or backward interpolation approaches in order to establish the interpolating polyno- mial • The 3 node quadratic interpolating polynomial has the form 2 gx= aox ++a1xa2 • The approximating Lagrange polynomial must match the functional values at all N + 1 data points or nodes (xo = 0 , x1 = h, x2 = 2h) 2 gxo = fo ao0 ++a10 a2 = fo 2 gx1 = f1 aoh ++a1ha2 = f1 2 gx2 = f2 ao2h ++a12h a2 = f2 p. 8.4 CE 30125 - Lecture 8 • Setting up the constraints as a system of simultaneous equations 0 0 1 ao fo 2 h h 1 a1 = f1 2 4h 2h 1 a2 f2 • Solve for ao , a1 , a2 f – 2f + f 4f –3f – f a = ---------------------------2 1 o- , a = ------------------------------1 2 o- , a = f o 2 1 2 o 2h 2h • The interpolating polynomial and its derivative are equal to: f2 – 2f1 + fo 2 4f1 – f2 – 3fo gx= ----------------------------- x ++-------------------------------- xfo 2h2 2h 1 f – 2f + f 4f – f – 3f gx = ----------------------------2 1 o- x + -------------------------------1 2 o- 2 h 2h p. 8.5 CE 30125 - Lecture 8 (1) Evaluating g ( x o ) to obtain a forward difference approximation to the first derivative • Evaluating the derivative of the interpolating function at xo = 0 1 1 g xo = g 0 1 –43fo + f1 – f2 g x = ------------------------------------ o 2h • Since the function fx is approximated by the interpolating function gx 1 1 f g xo xo 1 • Substituting in for the expression for g xo 1 –43fo + f1 – f2 f ------------------------------------ xo 2h p. 8.6 CE 30125 - Lecture 8 • Generalize the node numbering for the approximation x0 x1 x2 i i+1 i+2 generalized nodal numbering • This results in the generic 3 node forward difference approximation to the first deriva- tive at node i 1 – 3fi + 4fi + 1 – fi + 2 f ------------------------------------------------ i 2h p. 8.7 CE 30125 - Lecture 8 (1) Evaluating g ( x 1 ) to obtain a central difference approximation to the first derivative • Evaluating the derivative of the interpolating function at x1 = h 1 1 g x1 = g h 1 f2 – 2f1 + fo 4f1 – f2 – 3fo g x = ---------------------------------h + ------------------------------- 1 2 h 2h 1 f2 – fo g x = -------------- 1 2h • Again since the function fx is approximated by the interpolating function gx 1 1 f g x1 x1 1 • Substituting in for the expression for g x1 1 f2 – fo f -------------- x1 2h p. 8.8 CE 30125 - Lecture 8 • Generalize the node numbering x0 x1 x2 i-1 i i+1 • This results in the generic expression for the three node central difference approxima- tion to the first derivative 1 fi + 1 – fi – 1 f -------------------------- i 2h p. 8.9 CE 30125 - Lecture 8 (1) Evaluating g ( x 2 ) to obtain a backward difference approximation to the first derivative • Evaluating the derivative of the interpolating function at x2 = 2h 1 1 g x2 = g 2h 1 f – 2f + f 4f – f – 3f gx = --------------------------------2 1 o-2h + ------------------------------1 2 o- 2 2 h 2h 1 3f2 – 4f1 + fo g x = ------------------------------- 2 2h • Again since the function fx is approximated by the interpolating function gx 1 1 f g x2 x2 1 • Substituting in for the expression for g x2 1 3f2 – 4f1 + fo f ------------------------------- x2 2h p. 8.10 CE 30125 - Lecture 8 • Generalizing the node numbering x0 x1 x2 i-2 i-1 i • This results in the generic expression for a three node backward difference approxima- tion to the first derivative 1 3fi – 4fi – 1 + fi – 2 f ------------------------------------------- i 2h p. 8.11 CE 30125 - Lecture 8 (2) Evaluating g ( x o ) to obtain a forward difference approximation to the second derivative 2 • We note that in general g x can be computed as: f – 2f + f g2 x = ----------------------------2 1 o- 2 h • Evaluating the second derivative of the interpolating function at xo = 0 : 2 2 g xo = g 0 2 f2 – 2f1 + fo g xo = ---------------------------- h2 • Again since the function fx is approximated by the interpolating function gx, the second derivative at node xo is approximated as: 2 2 f g xo xo p. 8.12 CE 30125 - Lecture 8 2 • Substituting in for the expression for g xo f – 2f + f f2 ---------------------------2 1 o- x 2 o h • Generalizing the node numbering i i+1 i+2 x0 x1 x2 • This results in the generic expression for a three node forward difference approximation to the second derivative f – 2f + f f2 ---------------------------------------i + 2 i + 1 -i i 2 h p. 8.13 CE 30125 - Lecture 8 (2) Evaluating g ( x 1 ) to obtain a central difference approximation to the second derivative • Evaluating the second derivative of the interpolating function at x1 = h : 2 2 g x1 = g h 2 f2 – 2f1 + fo g x1 = ---------------------------- h2 • Again since the function fx is approximated by the interpolating function gx, the second derivative at node x1 is approximated as: 2 2 f g x1 x1 2 • Substituting in for the expression for g x1 f – 2f + f f2 ---------------------------2 1 o- x 1 h2 p. 8.14 CE 30125 - Lecture 8 • Generalizing node numbering i-1 i i+1 x0 x1 x2 • This results in the generic expression for a three node central difference approximation to the second derivative 2 f – 2f + f f ---------------------------------------i + 1 i i – 1- i 2 h Notes on developing differentiation formulae by interpolating polynomials • In general we can use any of the interpolation techniques to develop an interpolation function of degree Np . We can then simply differentiate the interpolating function and evaluate it at any of the nodal points used for interpolation in order to derive an approximation for the pth derivative. • Orders of accuracy may vary due to the accuracy of the interpolating function varying. • Exact accuracy can be obtained by substituting in Taylor series expansions or by consid- ering the accuracy of the approximating polynomial g(x). p. 8.15 CE 30125 - Lecture 8 Approximations and Associated Error Estimates to First and Second Derivatives Us- ing Quadratic Interpolation • We can derive an error estimate when using interpolating polynomials to establish finite difference formulae by simply differentiating the error estimate associated with the interpolating function. • We will illustrate the use of a 3 node Newton forward interpolation formula to derive: • A central approximation to the first derivative with its associated error estimate • A forward approximation to the second derivative with its associated error estimate Developing a 3 node interpolating function using Newton forward interpolation • A quadratic interpolating polynomial (N = 2 ) has 3 associated nodes (N +31 = ) or interpolating points. We again assume that the nodes are evenly distributed as: f0 f1 f2 x x0 x1 x2 hh • With a quadratic interpolating polynomial, we can derive differentiation formulae for both the first and second derivatives but no higher p. 8.16 CE 30125 - Lecture 8 • The approximating or interpolating function is defined using Newton forward interpola- tion as: fx= gx+ ex 2 f 1 f gx = f ++xx– -------o- ----- xx– xx– ----------o o o o 1 2 h 2! h xx– o xx– 1 xx– 2 3 ex= -------------------------------------------------------- f x x 3! o 2 • The error can be approximately expressed in either of the following forms: xx– o xx– 1 xx– 2 3 ex -------------------------------------------------------- f 3! o 3 xx– xx– xx– f ex --------------------------------------------------------o 1 2 ----------o 3 3! h • These latter two forms which do not involve are more suitable for the necessary differ- entiation w.r.t.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    27 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us