First derivative 3 point forward difference formula

Click For Summary

Homework Help Overview

The discussion revolves around the first derivative 3 point forward difference formula, specifically questioning the expression 4f(x-h) - f(x-2h) and its validity in the context of finite difference approximations.

Discussion Character

  • Conceptual clarification, Assumption checking, Mathematical reasoning

Approaches and Questions Raised

  • Participants explore the reasoning behind the formula 4f(x-h) - f(x-2h) and question why it differs from simpler forms like f(x-h) - f(x-2h). There are inquiries about the Taylor expansions and the accuracy of the approximation.

Discussion Status

The conversation is ongoing, with participants providing insights into Taylor expansions and the need for higher-order accuracy. Some have offered guidance on how to approach the derivation of the formula, while others express confusion about the necessity of certain terms in the equation.

Contextual Notes

There are references to specific notes and visual aids that participants are using to understand the topic, as well as mentions of homework constraints that may influence the discussion.

fonseh
Messages
521
Reaction score
2

Homework Statement


Can someone explain why for the first derivative 3 point forward difference formula is 4f(x-h) - f(x-2h) ??

Homework Equations

The Attempt at a Solution


Why it's not f(x-h) - f(x-2h) ?
Is there anything wrong with the notes ?
 

Attachments

  • sdfdfs.jpg
    sdfdfs.jpg
    59.2 KB · Views: 841
Physics news on Phys.org
fonseh said:

Homework Statement


Can someone explain why for the first derivative 3 point forward difference formula is 4f(x-h) - f(x-2h) ??

Homework Equations

The Attempt at a Solution


Why it's not f(x-h) - f(x-2h) ?
Is there anything wrong with the notes ?

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.
 
  • Like
Likes   Reactions: fonseh
Ray Vickson said:
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.
please refer to the circled part ... it's really ##4 f(x-h)-f(x-2h)##
 
Ray Vickson said:
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.
here's the full notes
 

Attachments

  • 543.jpg
    543.jpg
    42.1 KB · Views: 848
  • 544.jpg
    544.jpg
    59.2 KB · Views: 1,585
fonseh said:
please refer to the circled part ... it's really ##4 f(x-h)-f(x-2h)##
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:
  • Like
Likes   Reactions: fonseh
fonseh said:

Homework Statement


Can someone explain why for the first derivative 3 point forward difference formula is 4f(x-h) - f(x-2h) ??

Homework Equations

The Attempt at a Solution


Why it's not f(x-h) - f(x-2h) ?
Is there anything wrong with the notes ?
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.
 
Ray Vickson said:
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?
No , i get the same as the notes , my question is why should we use 4f(x-h) ? why can't we use f(x-h) ?
 
Chestermiller said:
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.
Can you explain further ? I still didnt get it
 
fonseh said:
Can you explain further ? I still didnt get it
In my judgment, it is well explained in the visual you provided.
 
  • #10
Chestermiller said:
In my judgment, it is well explained in the visual you provided.
Why we should use 4f(x-h) ? It's not explained in the notes
 
  • #11
fonseh said:
No , i get the same as the notes , my question is why should we use 4f(x-h) ? why can't we use f(x-h) ?

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.
 
  • Like
Likes   Reactions: fonseh
  • #12
fonseh said:
Why we should use 4f(x-h) ? It's not explained in the notes
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.
 
  • #13
Chestermiller said:
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.
why there is a need to eliminate f'' from the equation ?
 
  • #14
Ray Vickson said:
(a+b+c)f(x)+Bhf′(x)+Ch2f′′(x)+O(h3),(a+b+c)f(x)+Bhf′(x)+Ch2f″(x)+O(h3),(a+b+c) f(x) + B h f'(x) + C h^2 f''(x) + O(h^3),
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
 
  • #15
fonseh said:
why there is a need to eliminate f'' from the equation ?
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'
 
  • #16
fonseh said:
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

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.
 
  • Like
Likes   Reactions: fonseh
  • #17
Ray Vickson said:
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.
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) + ...
 
  • #18
fonseh said:
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) + ...

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.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
9
Views
5K
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
2
Views
2K
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
22
Views
3K