Numerical Analysis II
H Smith
Week 2
2012
Given paired data (x,y) from experiment, find
an expression that will describe the data.
Best fit – least squares method. The “line”
goes through some points.
Week 2
2012
1
Determine a function such that when a
known x-value is inserted into the function,
the known y is yielded. The line passes
through ALL the known data points.
Consider 2 paired points: {(2 , 0.5) (4 , 0.25)}
y = -(1/8)x+(3/4) or P1(x) = a1x + a0
Determine P1(3)
Consider 3 paired points: {(2 , 0.5) (2.5 , 0.4)
(4 , 0.25)}
P2(x) = a2x2 + a1x + a0=0.05x2-0.425x+1.15
Determine P2(3)
True function : f(x)=1/x, how is approximation?
Week 2
2012
Taylor’s Polynomial
f ( k ) ( x0 )
( x - x0 ) k
k!
k =0
n
Pn ( x ) = ∑
Lagrange Polynomial
n
Pn ( x) = ∑ Lk ( x) f ( xk )
k =0
Line passes through all the known data points.
N+1 paired data points leads to N order polynomial.
Week 2
2012
2
Define the Lk(x) such that when x=xk, Lk(xk)=1
For all other known xj , Lk(xj)=0 where j≠k
We define Lk(x) as:
(x - xj )
n
Lk ( x) = ∏
j = 0, j ≠ k
Week 2
Construct
Lagrange
Polynomials of
order 1,2 and 3.
Interpolate x = 0.25
using the
polynomials.
( xk - x j )
2012
x
-1
-0.5
0
0.5
Week 2
f(x)
0.86199480
0.95802009
1.0986123
1.2943767
2012
3
If x0,x1,..xn are (n+1) distinct numbers and f(x)
is a function whose values are given at
these numbers, then a unique interpolating
polynomial P(x) of degree n exists with
f(xk)=Pn(xk) for each k=0,1,…n.
Week 2
2012
Suppose x0,x1,..xn are distinct numbers in the
interval [a,b] and f∈Cn+1[a,b]. Then, for each x in
[a,b], a number ξ(x) in (a,b) exists with
f ( x ) = Pn ( x ) +
f ( n + 1) (ξ ( x ))
( x - x 0 )( x - x1 )....( x - x n )
( n + 1) !
where Pn(x) is the Lagrange interpolating
polynomial.
Week 2
2012
4
Given a function f(x)=ex defined on an
interval [0,1], and suppose that the
difference between adjacent x-values is h,
what should h be for linear (N=1)
interpolation to give an absolute error of
most 10-6?
Week 2
2012
Determine Lagrange
polynomials of order 1
and 2 to approximate
the functional value of
x=0.8
Determine the error
bound involved when
f(x)=x3.
Week 2
x
F(x)
0
0
0.5
0.125
1
1
2012
5