Consider a table of values of f(x) = e x for equally spaced points of x between
ID: 3210260 • Letter: C
Question
Consider a table of values of f(x) = e x for equally spaced points of x between 0 and 1.
(a) Let x0 = 0.1 and x1 = 0.11. Find P(0.105), an approximation of f(0.105), using a linear interpolation P(x). Find also the error bound of the approximation.
(b) Let x0 = 0.1 and x1 = 0.1 + h. How small should the spacing h be if you want to be able to use linear interpolation to approximate any x between x0 and x1, with an error at most 103 .
(c) Adding a point to part (b), x2 = x1 + h = 0.1 + 2h. How small should the spacing h be if you want to be able to use quadratic interpolation to approximate any x between x0 and x2, with an error at most 103 .
Explanation / Answer
here the given function is f(x)=exp(-x)
and points given are x0=0.1 and x1=0.11
firstly we calculate p(x) using linear interpolation formula
that is P(x)=f(x0)+[f(x1)-f(x0)/x1-x0](x-x0)............(1)
put all the values in equation(1)
hence p(x)=exp(-0.1)+[exp(-0.11)-exp(-0.1)/0.11-0.1](x-0.1)
p(x)=0.9048+[0.8958-0.9048/0.01](x-0.1)
p(x) =0.9048-[0.009/0.01](x-0.1)
p(0.105)=0.9048-(0.9)(0.105-0.1)
=0.9048-0.0045=0.9003
and f(0.105)=exp(-0.105)=0.90032
and error is given by =f(x)-p(x)
=0.90032-0.9003=0.00002=2e-5