# First derivative 3 point forward difference formula

• fonseh
In summary, the conversation discusses the use of the first derivative 3 point forward difference formula and why it is not simply f(x-h) - f(x-2h). The notes explain the calculations using Taylor expansion and the need for a 4 in the formula to make it accurate to terms of 2nd order in h. Further discussion explores the elimination of f'' from the equation and the resulting finite difference approximation that is accurate to terms of h2.
fonseh

## Homework Statement

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

## 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
59.2 KB · Views: 776
fonseh said:

## Homework Statement

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

## 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.

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
42.1 KB · Views: 771
• 544.jpg
59.2 KB · Views: 1,510
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:
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) ??

## 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.

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

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.

fonseh
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.

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 ?

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

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'

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.

fonseh
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) + ...

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.

## 1. What is the "First derivative 3 point forward difference formula"?

The "First derivative 3 point forward difference formula" is a mathematical formula used to approximate the first derivative of a function at a given point. It is based on the concept of forward difference, which calculates the slope of a function using data points that are ahead of the point of interest. This formula is commonly used in numerical analysis and is particularly useful for approximating derivatives of functions that are not easily differentiable.

## 2. How is the "First derivative 3 point forward difference formula" derived?

The "First derivative 3 point forward difference formula" is derived by using Taylor's series expansion to approximate the value of a function at a given point. By taking three data points that are close to the point of interest, the formula is able to calculate the slope of the function at that point. The formula involves dividing the difference between the function values at the three points by the difference between the points, and then taking the limit as the difference between the points approaches zero.

## 3. What are the advantages of using the "First derivative 3 point forward difference formula"?

One advantage of using the "First derivative 3 point forward difference formula" is that it is relatively simple to implement and does not require advanced mathematical knowledge. It also provides a reasonable approximation of the first derivative at a given point, making it useful for estimating the behavior of a function. Additionally, it can be used for both continuous and discrete data, making it a versatile tool for numerical analysis.

## 4. Are there any limitations to the "First derivative 3 point forward difference formula"?

Yes, there are some limitations to the "First derivative 3 point forward difference formula". One limitation is that it can only approximate the first derivative at a single point, so it may not accurately represent the overall behavior of a function. It also assumes that the function is smooth and does not have any sharp changes or discontinuities. Additionally, the formula may introduce some error in the approximation, especially when the data points are not evenly spaced.

## 5. How accurate is the "First derivative 3 point forward difference formula"?

The accuracy of the "First derivative 3 point forward difference formula" depends on the function being approximated and the choice of data points. In general, it provides a reasonable estimate of the first derivative, but the accuracy decreases as the distance between the data points increases. It is important to note that this formula is an approximation and may not give an exact value for the first derivative, but it can still be a useful tool for analyzing the behavior of a function.

Replies
12
Views
2K
Replies
8
Views
1K
Replies
9
Views
3K
Replies
6
Views
1K
Replies
4
Views
938
Replies
2
Views
1K
Replies
4
Views
1K
Replies
4
Views
2K
Replies
22
Views
2K
Replies
23
Views
2K
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}