Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Numerical methods

  1. Jan 24, 2006 #1
    given five points of a function one can approximate the derivate of the function at some point. The standard five point formula is

    Derive an O(h^4) five point formula to approximate f'(x0) that uses
    [itex] f(x_{0}-h), f(x_{0}), f(x_{0} +h),f(x_{0} +2h),f(x_{0} +3h) [/itex].

    (Hint:Consider the expression [itex] Af(x_{0} -h) + Bf(x_{0} +h) + Cf(x_{0} + 2h) + Df(x_{0} + 3h) [/itex]. Expand in fourth Taylor polynomials and choose A,B,C and D appropriately.)

    im not sure how they expect me to expand that polynomial they gave because it would be a total mess!
    how would one go about deriving this formula?
    my idea is using taylor polynomials
    [tex] f'(x_{0}) = \frac{f(x_{0}) - f(x_{0} -h)}{h} + \frac{f''(x_{0}}{2} h - \frac{f^{(3)}(x_{0})}{6} h^2 + \frac{f^{(4)}(x_{0})}{24} h^3 + O(h^4) [/tex]
    but im not sure how ot proceed
    what to subsitute... i know its gonna take some algebraic gymnastics to get the answer...
    Last edited: Jan 24, 2006
  2. jcsd
  3. Jan 24, 2006 #2


    User Avatar
    Homework Helper

    I've never done this type of problem before, but the way I'd approach it, given the hint you have, would be to write:

    A f(x_0&-h)+B f(x_0+h)+ C f(x_0+2h) + D f(x_0+3h) = \\
    & f(x_0) (A+B+C+D) +\\
    & h f'(x_0) (-A+B+2C+3D)+\\
    & \frac{1}{2}h^2 f''(x_0) (A+B+4C+9D)+...

    Up to the fourth order, and then solve for a set of (A,B,C,D) that makes all the coefficients on the right side vanish except for the coefficient of f'(x_0). This will give you an O(h^4) approximation of f'(x_0).
    Last edited: Jan 24, 2006
  4. Jan 24, 2006 #3
    hmmm... seems there is no one who is in numerical methods on this site... strange that .. or maybe they just dont like to help on homework?
    well anyway... did some googling and got these equations
    [tex] f'(x) = \frac{f(x_{0}) - f((x_{0}-h)}{h} + \frac{f''(x_{0}}{2}h - \frac{f^{(3)}(x_{0})}{6}h^2 + \frac{f^{(4)}(x_{0})}{24}h^3 +O(h^4) [/tex]
    replace h with -h
    2) [tex] f'(x) = \frac{-f(x_{0}) + f((x_{0}+h)}{h} - \frac{f''(x_{0})}{2}h - \frac{f^{(3)}(x_{0})}{6}h^2 - \frac{f^{(4)}(x_{0})}{24}h^3 +O(h^4) [/tex]
    in 2 replace h with 2h
    3) [tex] f'(x) = \frac{-f(x_{0}) + f(x_{0}+2h)}{2h} - \frac{f''(x_{0})}{2}2h - \frac{f^{(3)}(x_{0})}{3}2h^2 - \frac{f^{(4)}(x_{0})}{3}h^3 +O(h^4) [/tex]
    so now the aim is simply to eliminate the second, third nad fourth order derivatives
    after a lot of fun (ya right)
    [tex] f'(x_{0}) = \frac{ -2f(x_{0} -h) + 6f(x_{0} +h) -11f(x_{0}) - f(x_{0}+2h)}{2h} + \frac{f^{(4)}(x_{0})}{4}h^3 + O(h^4} [/tex]
    all i need to do now is get rid of the fourth order derivative
    im not sure what to subtract from this equation... any ideas?
    Last edited: Jan 24, 2006
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook