1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

First derivative 3 point forward difference formula

  1. Jan 21, 2017 #1
    1. The problem statement, all variables and given/known data
    Can someone explain why for the first derivative 3 point forward difference formula is 4f(x-h) - f(x-2h) ??



    2. Relevant equations


    3. The attempt at a solution
    Why it's not f(x-h) - f(x-2h) ?
    Is there anything wrong with the notes ?
     

    Attached Files:

  2. jcsd
  3. Jan 21, 2017 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    The formula is not ##4 f(x-h)-f(x-2h)##, and the notes make no such claim. Please try again with a correct question.

    Anyway, as far as I can see the notes explain things in a perfectly clear way, using the Taylor expansion.
     
  4. Jan 21, 2017 #3
    please refer to the circled part .... it's really ##4 f(x-h)-f(x-2h)##
     
  5. Jan 21, 2017 #4
    here's the full notes
     

    Attached Files:

    • 543.jpg
      543.jpg
      File size:
      49.9 KB
      Views:
      97
    • 544.jpg
      544.jpg
      File size:
      61.5 KB
      Views:
      123
  6. Jan 21, 2017 #5

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    OK, but your first message said nothing about the "circled part"---that makes a difference. So, I have a question for you: have you taken the Taylor expansions for ##f(x-h)## and ##f(x-2h)## and performed the calculation of ##4f(x-h) - f(x-2h)?## Did you get a different answer from that in the notes?
     
    Last edited: Jan 21, 2017
  7. Jan 21, 2017 #6
    The reason that your equation is not correct is that this is a first order accurate approximation, and the result they are trying to obtain is supposed to be accurate to terms of 2nd order in h.
     
  8. Jan 21, 2017 #7
    No , i get the same as the notes , my question is why should we use 4f(x-h) ? why cant we use f(x-h) ???
     
  9. Jan 21, 2017 #8
    Can you explain further ? I still didnt get it
     
  10. Jan 21, 2017 #9
    In my judgment, it is well explained in the visual you provided.
     
  11. Jan 21, 2017 #10
    Why we should use 4f(x-h) ? It's not explained in the notes
     
  12. Jan 21, 2017 #11

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    You can use what works, and 4f(x-h) works. Try it for yourself, without the "4", and see what happens.

    In fact, suppose you want a finite-difference formula of the form
    $$ f'(x) \approx \frac{1}{h} [ a f(x) + b f(x-h) + c f(x-2h)].$$
    Expand out the numerator as a series in small ##h## and you will get something of the form ##(a+b+c) f(x) + B h f'(x) + C h^2 f''(x) + O(h^3),##
    where ##B## and ##C## are some expressions in ##a,b,c##. You want a numerator expression of the form ##0 f(x) + 1 h f'(x) + O(h^2)## (so that the ratio is ##f'(x)## to first order in ##h##). In other words, you want ##a+b+c=0## and ##B = 1##. After evaluating ##B## in terms of ##a,b,c## you will have two equations in the three unknowns ##a,b,c##, and can solve for ##b,c## in terms of ##a##. If you make different choices for ##a## you will get different "finite-difference" formulas for ##f'(x)##. See if you can figure out what value of ##a## gives you ##1 f(x-h)## in your finite-difference formula.
     
  13. Jan 21, 2017 #12
    What they do is eliminate the term involving f'' from the two equations, and solve for f'. This results in a finite difference approximation that is accurate to terms if h2.
     
  14. Jan 21, 2017 #13
    why there is a need to eliminate f'' from the equation ?
     
  15. Jan 21, 2017 #14
    I tried f(x-h) - f(x-2h) , i get -h'f(x) + (3 /2!) (f"(x) h^2) + (3/3!)(f"'(x)h^3) + ......

    I didnt get (a+b+c)f(x)+Bhf′(x)+Ch2f′′(x)+O(h3) though
     
  16. Jan 21, 2017 #15
    Because otherwise you would find that the final finite difference equation would only be first order in h. Try any other linear combination of the two equations and see what you get for f'
     
  17. Jan 21, 2017 #16

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    That is because you ignored what I wrote. I wrote ##a f(x) + b f(x-h) + c f(x-2h)##. I suggest you do the same, then tell us what you obtain.
     
  18. Jan 22, 2017 #17
    Do you mean f(x) + f(x-h) - f(x-2h) ?
    If so , i get f(x) -h'f(x) + (3 /2!) (f"(x) h^2) + (3/3!)(f"'(x)h^3) + ......
     
  19. Jan 22, 2017 #18

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Why would you ask that? Since when does ##a f(x) + b f(x-h) + c f(x-2h)## suddenly become ##f(x)+f(x-h)-f(x-2h)?## (Ok, it would happen in the one case where we choose ##a=1, b=1, c=-1##, but I said no such thing.) I left ##a,b,c## as unevaluated constants, because I thought you wanted to see why certain choices are made and others rejected. The first step is to actually write down what you would get with general ##a,b,c.##

    I am now quitting this thread.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: First derivative 3 point forward difference formula
  1. 3 different derivatives? (Replies: 12)

Loading...