Академический Документы
Профессиональный Документы
Культура Документы
Evaluate
Differentiate, and
Integrate.
Polynomial function
𝑓(𝑥) = 𝑏0 + 𝑏1 𝑥 + 𝑏2 𝑥 2 +. . . +𝑏𝑛 𝑥 𝑛
For n+1 data points, there is one and only one polynomial of order n that
passes through all the points.
Polynomial interpolation consists of determining the unique n-th order polynomial
that fits n+1 data points
This polynomial then provides a formula to compute intermediate values.
n=0 , 1 point
n=1, 2 point (linear eq)
n=2, 3 point (quad eq
n=3, 4 point (cubic eq
Newton’s Divided Difference Method
𝑓1 (𝑥) = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 )
Where
𝑏0 = 𝑓(𝑥0 )
f ( x1 ) − f ( x0 )
b1 =
x1 − x0
Example
⚫ Estimate the natural logarithm of 2 using linear interpolation(2
points, n=1). First, perform the computation by interpolating
between ln(1) and ln(6). Then, repeat the procedure, but use a
smaller interval from ln(1) to ln(4). For each case, calculate the
true percent relative error.
𝑓1 (2) = 0 + 0.4621(2 − 1)
𝑦 = ln 𝑥 =0.6932
x y Ea 𝑏0 = 𝑓 1 = 0
1 x0 0
f ( x1 ) − f ( x0 )
2 ? 0.3584 48.3% b1 =
6 x1 1.792 x1 − x0
x y Ea f ( x1 ) − f ( x0 )
b1 =
1 x0 0 x1 − x0
2 ? 0.4621 33.3%
𝑏1 = (1.3863 − 0) / (4-1) =0.4621
4 x1 1.3863
Quadratic Interpolation
Given ( x0 , y 0 ), ( x1 , y1 ), and ( x2 , y 2 ), fit a quadratic interpolant through the data.
𝑓2 (𝑥) = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 ) + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
𝑏0 = 𝑓(𝑥0 )
𝑓(𝑥) = 𝑏0 + 𝑏1 𝑥 + 𝑏2 𝑥 2 +. . . +𝑏𝑛 𝑥 𝑛
𝑓(𝑥1 ) − 𝑓(𝑥0 )
𝑏1 =
𝑥1 − 𝑥0
x y Ea
𝑓(𝑥2 )−𝑓(𝑥1 ) 𝑓(𝑥1 )−𝑓(𝑥0 )
0.5 x0 -0.6931 𝑥2 −𝑥1
−
𝑥1 −𝑥0
𝑏2 =
3.5 ? 1.1962 4.52% 𝑥2 −𝑥0
4 x1 1.386 =-0.07115
6 x2 1.792
General Form
𝑓2 (𝑥) = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 ) + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
where
b0 = f [ x0 ] = f ( x0 )
f ( x1 ) − f ( x 0 )
b1 = f [ x1 , x0 ] =
x1 − x0
f ( x 2 ) − f ( x1 ) f ( x1 ) − f ( x0 )
−
f [ x 2 , x1 ] − f [ x1 , x0 ] x 2 − x1 x1 − x0
b2 = f [ x 2 , x1 , x0 ] = =
x 2 − x0 x 2 − x0
Rewriting
𝑓2 (𝑥) = 𝑓[𝑥0 ] + 𝑓[𝑥1 , 𝑥0 ](𝑥 − 𝑥0 ) + 𝑓[𝑥2 , 𝑥1 , 𝑥0 ](𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
General Form
Given (n + 1) data points, (x0 , y0 ), (x1 , y1 ),......, (xn −1 , y n −1 ), (xn , y n ) as
f n ( x) = b0 + b1 ( x − x0 ) + .... + bn ( x − x0 )( x − x1 )...( x − xn−1 )
where
b0 = f [ x0 ]
b1 = f [ x1 , x 0 ]
n=0 , 1 point
b2 = f [ x2 , x1 , x0 ]
n=1, 2 point (linear eq)
n=2, 3 point (quad eq
bn −1 = f [ xn−1 , xn −2 ,...., x0 ] n=3, 4 point (cubic eq
bn = f [ xn , xn −1 ,...., x0 ]
General form
f 3 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x 2 , x1 , x0 ]( x − x0 )( x − x1 )
+ f [ x3 , x 2 , x1 , x0 ]( x − x0 )( x − x1 )( x − x 2 )
b0
x0 f ( x0 ) b1
f [ x1 , x 0 ] b2
x1 f ( x1 ) f [ x 2 , x1 , x0 ] b3
f [ x 2 , x1 ] f [ x3 , x2 , x1 , x0 ]
x2 f ( x2 ) f [ x3 , x 2 , x1 ]
f [ x3 , x 2 ]
x3 f ( x3 )
𝑏3 = 𝑓[x3,x2,x1] – f [x2,x1,x0] / (x3-x0)
𝑏3 = [𝑓[x3,x2] – f[x2,x1] / (x3 –x1) ]–[ f [x2,x1,x0] ]/ (x3-x0)
𝑓 6 − 𝑓(4) 𝑓 4 − 𝑓(0.5)
𝑓 4 − 𝑓(0.5) − 𝑓 𝑥3, 𝑥2 , 𝑥1 − 𝑓 𝑥2, 𝑥1 , 𝑥0
𝑓3 𝑥 = 𝑓[0.5] + 𝑥 − 𝑥0 + 6−4 4 − 0.5 𝑥 − 𝑥0 𝑥 − 𝑥1 + 𝑥 − 𝑥0 𝑥 − 𝑥1 (𝑥 − 𝑥2)
4 − 0.5 𝑥2 − 𝑥0 𝑥3 − 𝑥0
f 3 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x 2 , x1 , x0 ]( x − x0 )( x − x1 )
+ f [ x3 , x 2 , x1 , x0 ]( x − x0 )( x − x1 )( x − x 2 )
0.2027−0.5941
𝑏3 = 𝑓[𝑥3, 𝑥2, 𝑥1, 𝑥0] = 𝑓[𝑥3, 𝑥2, 𝑥1] − 𝑓[𝑥2, 𝑥1, 𝑥0] 5.5
=-0.0712
𝑥3 − 𝑥0