1
$\begingroup$

I have been able to derive the interpolation polynomial $P_2(x)$ of degree two which interpolates $f(x) = \sin x$, given the points $(0,0), \left(\frac{\pi}{2}, 1\right), (\pi, 0).$

Solution: $$P_2(x) = \frac{4}{\pi ^2}x(\pi - x)$$

Here is the question below I am having trouble with

Calculate $P_2\left(\frac{\pi}{4}\right)$, an approximation for $f\left( \frac{\pi}{4}\right) = \sin \left( \frac{\pi}{4} \right)$ and determine the error bound for the interpolation error at $x = \frac{\pi}{4}.$

Calculating $P_2\left(\frac{\pi}{4}\right)$

$$P_2\left(\frac{\pi}{4}\right) = \frac{4}{\pi ^2} \times \frac{\pi}{4}\left( \pi - \frac{\pi}{4} \right)= \frac{3}{4}$$

If we plug $x = \frac{\pi}{4}$ into $f(x) = \sin x$ we get $f(\pi /4) = \sin (\pi /4) \approx 0.7071 $

Here is my attempt below at finding the error bound

Writing the error as $err(x) = \sin x - P_2(x) = \sin x - \frac{4}{\pi ^2}x(\pi - x)$

Differentiating once gives,

$$\cos (x) - \frac{4(\pi - 2x)}{\pi ^2}$$

Differentiating twice gives,

$$\frac{8}{\pi ^2}-\sin(x)$$

Finally differentiating a third time gives,

$$- \cos x $$

But how do I use this to get my error bound

$\endgroup$
2
  • $\begingroup$ Use en.wikipedia.org/wiki/… $\endgroup$ – Andrei Nov 1 '18 at 14:54
  • $\begingroup$ I have been trying but I dont understand how to do it. Could you make a post? $\endgroup$ – jh123 Nov 1 '18 at 14:55
1
$\begingroup$

For a polynomial interpolation of order $n$, the maximum error is given by $${\rm err}=\frac{1}{(n+1)!}\max |f^{(n+1)}(x)|\max|\prod_{p=0}^n(x-x_p)|$$ Here $x_p$ are the roots of your polynomial. Let's suppose that you are interested in finding the maximum only in the interval from $0$ to $\pi$. The maximum of the derivative in your case is $1$, the maximum for the product $x(\pi-x)$ occurs at $\pi/2$ so $${\rm err}=\frac{1}{3!}1\left(\frac\pi2\right)^2$$

$\endgroup$
11
  • $\begingroup$ Is this the complete solution? And why only in that interval? $\endgroup$ – jh123 Nov 1 '18 at 15:13
  • $\begingroup$ Outside of the interval the product will increase. Say at very large $x$, the product part is approximately $-x^2$. That means that the error in your interpolation is very large. You can see this by plotting the two curves, say from $0$ to $10$ $\endgroup$ – Andrei Nov 1 '18 at 15:17
  • $\begingroup$ Okay and I'm only worried about my interval. Why is $\pi /2 $ squared? $\endgroup$ – jh123 Nov 1 '18 at 15:19
  • $\begingroup$ Plug in $x=\pi/2$ in $x(\pi-x)$ $\endgroup$ – Andrei Nov 1 '18 at 15:20
  • $\begingroup$ Okay and the max is 1 because when we plug in $0,\pi /2, \pi$ into our third derivative which is $-cosx$ the max value is 1? $\endgroup$ – jh123 Nov 1 '18 at 15:24

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.