# Find the error of the interpolation (either Lagrange or Newton) of the following set of points

Find the polynomial that interpolates a function given by $$f(x) = x(\ln(x)-1)$$ on the points 2 and 3. Use values for f with 4 correct decimal places (?) and give an estimation for the error of the interpolation.

I'm not sure what "4 correct decimal places" means here, I'll assume it means simply "with 4 decimal places". Using my calc I got: $$f(2) = -0.6137 \\ f(3) = 0.2958$$

For the interpolations, I got $$0.9095x-2.4327$$ for both.

I'm having trouble applying the formulas for the error.

Lagrange: • What is $$\xi (x)$$?
• What is $$f^{(n+1)}$$?

Newton: • What is $$c$$?
• What is $$f^{(n+1)}$$?

How do I apply these formulas in this case?

• @Moo I will reply later today. – Segmentation fault Jan 12 at 15:27

I agree with the calculations you did.

$$c$$ and $$\xi(x)$$ are some unknown point in the range $$[x_0, x_n]$$.

$$f^{(n+1)}$$ is the $$(n+1)^{th}$$ derivative of the function.

Since $$n = 1$$ (two points - linear interpolation), for the error, we have $$f^{(2)}(x) = f''(x)$$

$$E_1 = |f(x) - P_1(x) | \le \max_{[2,3]} \left|\dfrac{f''(\xi)}{2}\right|\max_{[2,3]} \left|(x-x_0)(x-x_1)\right|$$

The second derivative $$f''(x) = \dfrac{1}{x}$$.

The error is given by

$$E_1 \le \max_{[2,3]} \left|\dfrac{1}{2x}\right|\max_{[2,3]} \left|(x-2)(x-3)\right|$$

Finding the max over those ranges

$$E_1 \le \left(\dfrac{1}{4}\right)\left(\dfrac{1}{4}\right) = \dfrac{1}{16}$$

• Two questions: does $xi$ or c have to be an integer? Can it be any random number in that interval? And, Is the formula for the error of the Newton interpolation the same as the formula for the error of the Lagrange interpolation? – Segmentation fault Jan 12 at 21:33
• Yes, they are effectively the same error formula. We do not want to use a random number, we do not know what the number is. To make life easier, we use the max abs of each of those expressions - it is typically overkill, but that guarantees you chose a number that is large enough. To find those max, you just use the typical derivative, critical points and end point checks. – Moo Jan 12 at 21:41
• Ok, I understand a bit better now... could you explain how you did this part $|\max_{[2,3]} \left|(x-2)(x-3)\right|$? – Segmentation fault Jan 12 at 21:44
• The derivative is |2x - 5|. We now set that equal to zero and find a critical point at $x = 5/2$. We use that to find max |(5/2 - 2)(5/2 - 3)| = 1/4. Clear? – Moo Jan 12 at 21:51
• Don't forget that pesky absolute value! :-) See: wolframalpha.com/input/… – Moo Jan 12 at 21:55