Question #56855

For the given functions f (x), let x0 = 0, x1 = 0.6, and x2 = 0.9. Construct interpolation polynomials
of degree at most one and at most two to approximate f (0.45), and find the absolute error.
a. f (x) = cos x

Expert's answer

Answer on Question #56855 – Math – Algorithms | Quantitative Methods

For the given functions f(x)f(x), let x0=0x_0 = 0, x1=0.6x_1 = 0.6, and x2=0.9x_2 = 0.9. Construct interpolation polynomials of degree at most one and at most two to approximate f(0.45)f(0.45), and find the absolute error.

a. f(x)=cos⁡xf(x) = \cos x

Solution


y0=f(x0)=cos⁡0=1;y_0 = f(x_0) = \cos 0 = 1;y1=f(x1)=cos⁡0.6=0.8253;y_1 = f(x_1) = \cos 0.6 = 0.8253;y2=f(x2)=cos⁡0.9=0.6216;y_2 = f(x_2) = \cos 0.9 = 0.6216;


a) The Lagrange interpolation polynomial of degree at most 1 is constructed as follows:


L1(x)={x1−xx1−x0y0+x−x0x1−x0y1,for x∈[x0,x1],x2−xx2−x1y1+x−x1x2−x1y2,for x∈[x1,x2],L_1(x) = \begin{cases} \frac{x_1 - x}{x_1 - x_0} y_0 + \frac{x - x_0}{x_1 - x_0} y_1, & \text{for } x \in [x_0, x_1], \\ \frac{x_2 - x}{x_2 - x_1} y_1 + \frac{x - x_1}{x_2 - x_1} y_2, & \text{for } x \in [x_1, x_2], \end{cases}L1(x)={1−0.2912x,for x∈[0,0.6],1.2327−0.679x,for x∈[0.6,0.9],L_1(x) = \begin{cases} 1 - 0.2912x, & \text{for } x \in [0, 0.6], \\ 1.2327 - 0.679x, & \text{for } x \in [0.6, 0.9], \end{cases}

f(0.45)≈0.8690f(0.45) \approx 0.8690 is approximated through the linear Lagrange polynomial: f(0.45)=cos⁡0.45=0.9004f(0.45) = \cos 0.45 = 0.9004.

The absolute error is


∣0.9004−0.8690∣=0.0314.|0.9004 - 0.8690| = 0.0314.


b) The Lagrange interpolation polynomial of degree at most 2 is constructed as follows:


L2(x)=l0(x)y0+l1(x)y1+l2(x)y2,L_2(x) = l_0(x) y_0 + l_1(x) y_1 + l_2(x) y_2,


where


l0(x)=(x−x1x0−x1)(x−x2x0−x2)l_0(x) = \left(\frac{x - x_1}{x_0 - x_1}\right) \left(\frac{x - x_2}{x_0 - x_2}\right)l1(x)=(x−x0x1−x0)(x−x2x1−x2)l_1(x) = \left(\frac{x - x_0}{x_1 - x_0}\right) \left(\frac{x - x_2}{x_1 - x_2}\right)l2(x)=(x−x0x2−x0)(x−x1x2−x1)l_2(x) = \left(\frac{x - x_0}{x_2 - x_0}\right) \left(\frac{x - x_1}{x_2 - x_1}\right)

f(0.45)≈0.8980f(0.45) \approx 0.8980 is approximated through the quadratic Lagrange polynomial.

The absolute error is


∣0.9004−0.8980∣=0.0024.|0.9004 - 0.8980| = 0.0024.


www.AssignmentExpert.com


LATEST TUTORIALS
APPROVED BY CLIENTS