2
$\begingroup$

I have the following homework problem:

  1. (10 points) Differentiation Formulas by Lagrange Interpolating Polynomials.

(a) Write the generic finite difference approximation to f'(x) using the Lagrange interpolating polynomial approximation based on points x0, x1, x2 that are spaced h units apart (ie, x1 = x0 + h, x2 = x0 + 2h, etc). Simplify the denominators.

(b) Evaluate your simplified expression for f'(x) in (a) at x = x1 to obtain the second order central difference formula (CD2). It should look like the form presented in class.

(c) Evaluate your simplified expression for f'(x) in (a) at x = x0 to obtain the second order forward difference formula (FD2). It should look like the form presented in class.

(d) Evaluate your simplified expression for f'(x) in (a) at x = x2 to obtain the second order backward difference formula (BD2). It should look like the form presented in class.

I understand the very basics of the Lagrange approximations, but I'm having trouble applying it in this problem. I'm told to use x0, x1, and x2, so this immediately makes me think:

\begin{align} \frac{(x-x1)(x-x2)}{(x0-x1)(x0-x2)}\cdot y0 +\frac{(x-x0)(x-x2)}{(x1-x0)(x1-x2)}\cdot y1 +\frac{(x-x0)(x-x1)}{(x2-x0)(x2-x1)}\cdot y2 \end{align}

From here I could just replace x1 with x0+h and x2 with x0+2h (I think). But I'm not exactly sure how to apply this Lagrange approximation to the finite difference approximation of f'(x). I'm honestly not even entire sure what the question in itself means. Am I approximating f'(x)? Am I approximating an approximation? I can easily complete steps b, c, and d, I just cannot wrap my head around a.

Do I just plug x0+h and x0+2h into x1 and x2, simplify, and I'm done? Do I need to modify the above polynomial? If so, how?

What exactly do I need to do to complete step a?

$\endgroup$
0
$\begingroup$

we have $(x1-x0)=h$ and $(x2-x0)=2h$

so

$$y=\frac{(x-x_1)(x-x_2)}{2h^2}y_0+\frac{(x-x_0)(x-x_2)}{-h^2}y_1+\frac{(x-x_0)(x-x_1)}{2h^2}y_2$$ $$y=\frac{1}{2h^2}\left [ (x-x_1)(x-x_2)y_0-2(x-x_0)(x-x_2)y_1+(x-x_0)(x-x_1)y_2 \right ]$$ $$y'=\frac{1}{2h^2}\left [ (x-x_1+x-x_2)y_0-2(x-x_0+x-x_2)y_1+(x-x_0+x-x_1)y_2 \right ]$$ $$y'=\frac{1}{2h^2}\left [ (2x-x_1-x_2)y_0-2(2x-x_0-x_2)y_1+(2x-x_0-x_1)y_2 \right ]$$

at $x_0$ we will get the forward formula of the first derivative $$y'=\frac{1}{2h^2}\left [ (2x_0-x_1-x_2)y_0-2(2x_0-x_0-x_2)y_1+(2x_0-x_0-x_1)y_2 \right ]$$ $$y'=\frac{1}{2h^2}\left [ (-3h)y_0-2(-2h)y_1+(-h)y_2 \right ]=\frac{1}{2h}\left [ -3y_0+4y_1-y_2 \right ]$$

at $x=x_1$ we will get the central formula of the first derivative $$y'=\frac{1}{2h^2}\left [ (2x_1-x_1-x_2)y_0-2(2x_1-x_0-x_2)y_1+(2x_1-x_0-x_1)y_2 \right ]$$ $$y'=\frac{1}{2h^2}\left [ (-h)y_0-2(-h+h)y_1+(h)y_2 \right ]$$ $$y'=\frac{1}{2h}\left [ -y_0+y_2 \right ]$$

then complete what you want

$\endgroup$
  • $\begingroup$ So is $$y'=\frac{1}{2h^2}\left [ (2x-x_1-x_2)y_0-2(2x-x_0-x_2)y_1+(2x-x_0-x_1)y_2 \right ]$$ the solution to part a? I'm not quite sure what I'm looking at here to be honest. What exactly are you doing in the last two lines? It looks like you replace x with x0, not quite sure why. then you simplify and replace x0, x1, and x2's with h's. $\endgroup$ – user3330644 Apr 17 '15 at 23:36
  • $\begingroup$ @user3330644 if you have a problem, tell me $\endgroup$ – E.H.E Apr 17 '15 at 23:40
  • $\begingroup$ read my previous comment. ;) $\endgroup$ – user3330644 Apr 17 '15 at 23:42
  • $\begingroup$ @user3330644 $2x_0-x_1-x_2=(x_0-x_1)+(x_0-x_2)=(-h)+(-2h)=-3h$ $\endgroup$ – E.H.E Apr 17 '15 at 23:45
  • $\begingroup$ @user3330644 read the solution carefully $\endgroup$ – E.H.E Apr 18 '15 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.