Uploaded by annapramodat

Lagrange Polynomials Practical

advertisement
Pramod,A
227103106
Prac 1
3.)
Weightings of x- points on the interval [-4,6]
2.5
2
Weightings
1.5
-6
1
L0(x)
0.5
L1(x)
0
-4
-2
-0.5
0
2
4
6
8
-1
-1.5
-2
x-points
4.) P2(0) = L0(f(x0)) + L1(f(x1)) + L2(f(x2))
(0−1)(0−5)
(0+2)(0−5)
= (−2−1)(−2−5) (-3.5) + (1+2)(1−5) (10) + 0
= 7.5
P2(4) = L0(f(x0)) + L1(f(x1)) + L2(f(x2))
(4−1)(4−5)
(4+2)(4−5)
= (−2−1)(−2−5) (-3.5) + (1+2)(1−5) (10) + 0
= 5.5
5.a.) f(0) - P2(0)
11.25 -7.5 = 3.75
5.b.) f(0) = P2(0) + R2(0)
11,25 = 7,5 + R2(0)
R2(0) = 3,75
3,75 = S(0+2)(0-1)(0-5)
S = 0,375
f(4) - P2(4)
-19.25- 5.5 = 24.75
f(4) = P2(4) + R2(4)
-19,25 = 5,5 + R2(4)
R2(4) = -24,75
-24,75 = S(4+2)(4-1)(4-5)
S = 1,375
L2(x)
5.d.iii)
Graph of Lagrange interpolating polynomial,
true function, g(S(0),x) and g(S(4),x) and data set
Lagrange interpolating polynomial, true
function, g(S(0),x) and g(S(4),x)
200
150
100
f(x)
g(0,375 , x)
50
g(1,375,x)
0
-6
-4
-2
0
-50
2
4
6
8
x - points
5.d.iv) Both g(0,375,x) and g(1,375,x) have the same x- intercepts at (-2,0), (1,0) and (5,0). These are
the x-points of the co-ordinates. This is because the difference between the function and the
lagrange polynomial and remainder term is the same.
5.d.v)
Formula:
R2(μ(x)) =
𝑓 (𝑛+1) (𝜇(𝑥))
x
(𝑛+1)!
П𝑛𝑘=0 (x-xk)
Derive function:
15
17
27
f’(x) = x3 - 𝑥 2 - 𝑥 +
8
f’’(x) = 3x2 f’’’(x) = 6x -
15
4
15
𝑥-
2
17
8
2
4
Substitute values in for 𝜇(0) :
R2(μ(0)) =
3,75 =
𝑓 (2+1) (𝜇(0))
(2+1)!
(6(0)−
15
)(𝜇(0))
4
(2+1)!
(3,75)(3!)
x П2𝑘=0 (0-xk)
x (0-(-2))(0-1)(0-5)
15
(0−(−2))(0−1)(0−5)(6(0)− )
4
3
𝜇(0) = -
= 𝜇(0)
5
Substitute values in for 𝜇(4) :
R2(μ(4)) =
-24,75 =
𝑓 (2+1) (𝜇(4))
(2+1)!
(6(4)−
x П2𝑘=0 (4-xk)
15
)(𝜇(4))
4
(2+1)!
(−24,75)(3!)
x (4-(-2))(4-1)(4-5)
15
(4−(−2))(4−1)(4−5)(6(4)− )
4
11
𝜇(4) =
27
= 𝜇(4)
Download