For the given functions f (x), let x0 = 1, x1 = 1.25, and x2 = 1.6. Construct interpolation polynomials of degree at most one and at most two to approximate f (1.4), and find the absolute error.
a. f (x) = sin πx
b. f (x) =cube root of (x − 1)
c. f (x) = log10 (3x − 1)
d. f (x) = e2x − x
are "L_{1,0}(x) = \\frac{x-x_1}{x_0-x_1} = \\frac{x-1.25}{1-1.25}=5-4x" and "L_{1,1}(x) = \\frac{x-x_0}{x_1-x_0} = \\frac{x-1}{1.25-1}=4x-4" for the first degree. Substituting x = 1.4 get
"L_{1,0}(1.4) = -0.6" and "L_{1,1}(1.4) = 1.6"
For second degree
"L_{2,0}(x) = \\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)} = \\frac{(x-1.25)(x-1.6)}{(1-1.25)(1-1.6)}=\\frac{20}{3}(1.25-x)(1.6-x)" and "L_{2,0}(x) =-0.2"
"L_{2,1}(x) = \\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)} = \\frac{(x-1)(x-1.6)}{(1.25-1)(1.25-1.6)}=\\frac{80}{7}(x-1)(1.6-x)" and "L_{2,1}(1.4) \\approx 0.914286"
"L_{2,2}(x) = \\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)} = \\frac{(x-1)(x-1.25)}{(1.6-1)(1.6-1.25)}=\\frac{100}{21}(x-1)(x-1.25)" and "L_{2,2}(1.4) \\approx 0.285714"
a) "f(x)=sin(\\pi x)" :
"f(x_0)=sin(\\pi) = 0" ;
"f(x_1)=sin(1.25 \\pi) = \\frac{-1}{\\sqrt{2}}\\approx -0.707107" ;
"f(x_2) = sin(1.6 \\pi) \\approx -0.951057"
"f(1.4) = f(x_0) L_{1,0}(x) + f(x_1)L_{1,1}(x) = 0(-0.6) -0.707107 \\cdot 1.6 = -1.13137"
Precise value is -0.951057, and error is (-0.951057) - (-1.13137) =0.180315
For second degree
"f(1.4) = f(x_0) L_{2,0}(x) + f(x_1)L_{2,1}(x) + + f(x_1)L_{2,1}(x) = 0(-0.2) -0.707107 \\cdot 0.914286 -0.951057 \\cdot 0.285714 = -0.918228"
Error is -0.951057-(-0.918228) = -0.0328285
b) "f(x) = \\sqrt[3]{x-1}"
"f(1)=0"
"f(1.25) \\approx 0.629961"
"f(1.6) \\approx 0.843433"
"f(1.4) = f(x_0) L_{1,0}(x) + f(x_1)L_{1,1}(x) \\approx" 1.00794
Precise value is 0.736806, and error is -0.271131
Second degree:
"f(1.4) = f(x_0) L_{2,0}(x) + f(x_1)L_{2,1}(x) + + f(x_1)L_{2,1}(x) \\approx 0.816945"
error -0.0801384
c)
"f(x) = log_{10}(3x-1)"
"f(x_0) \\approx 0.30103"
"f(x_1) \\approx 0.439333"
"f(x_2) \\approx 0.579784"
"f(1.4) = f(x_0) L_{1,0}(x) + f(x_1)L_{1,1}(x) \\approx 0.522314"
Precise value is 0.50515, and error is -0.0171643
Second degree:
"f(1.4) = f(x_0) L_{2,0}(x) + f(x_1)L_{2,1}(x) + + f(x_1)L_{2,1}(x) \\approx 0.507122"
error is -0.00197208
d)
"f(x)= e^{2x}-x"
"f(x_0)\\approx 6.38906"
"f(x_1)\\approx 10.9325"
"f(x_2) \\approx 22.9325"
"f(1.4) = f(x_0) L_{1,0}(x) + f(x_1)L_{1,1}(x) \\approx 13.6586"
Precise value is 15.0446, and error is 1.38609
Second degree:
"f(1.4) = f(x_0) L_{2,0}(x) + f(x_1)L_{2,1}(x) + + f(x_1)L_{2,1}(x) \\approx 15.2698"
error is -0.225117
Comments
Leave a comment