2
$\begingroup$

I'm trying to make an exercise but I don't know how to start. Is there somebody that can give me a hint so that I can start with the exercise. The exercise is:

Consider the function $f(x) = \sin(x)$ on the interval $[0,\pi]$. Evaluate $f(x)$ in enough points to find an interpolating polynomial $p(x)$ and a natural cubic spline approximation $s(x)$ such that the error functions $|(f-p)(x)|$ and $|(f-s)(x)|$ satisfy

$|(f-p)(x)| \leq 0.005$ for $0 \leq x \leq \pi$

$|(f-s)(x)| \leq 0.005$ for $0 \leq x \leq \pi$

Give the number and the location of the data points for $p$ and $s$. This can be different for $p$ and $s$. Why is the second derivative of the spline function in begin and endpoint equal to zero a good choice?

$\endgroup$
2
$\begingroup$

Wherever you get the formulas for constructing the interpolating polynomial and spline should give you an error estimate. For the polynomial, Wikipedia gives an error limit $f(x)-p_n(x)=\frac {f^{(n+1)}(\xi)}{(n+1)!}\prod_{i=0}^n (x-x_i)$ where the $x_i$ are the interpolating points. For $\sin x$ the derivatives are limited to $\pm 1$, so you can use that for your error limit. To minimize the product, you can use Chebyshev nodes. For the last question, what is the derivative of $\sin x$ at $0$ and $\pi$?

$\endgroup$

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.