You are on page 1of 33

Interpolation, Extrapolation

&
Polynomial Approximation
November 13, 2012
Interpolation, Extrapolation & Polynomial Approximation
Introduction
In many cases we know the values of a function f (x) at a set of points
x
1
, x
2
, ..., x
N
, but we dont have the analytic expression of the function
that lets us calculate its value at an arbitrary point. We will try to
estimate f (x) for arbitrary x by drawing a curve through the x
i
and
sometimes beyond them.
The procedure of estimating the value of f (x) for x [x
1
, x
N
] is called
interpolation while if the value is for points x / [x
1
, x
N
] extrapolation.
The form of the function that approximates the set of points should be a
convenient one and should be applicable to a general class of problems.
Interpolation, Extrapolation & Polynomial Approximation
Polynomial Approximations
Polynomial functions are the most common ones while rational and
trigonometric functions are used quite frequently.
We will study the following methods for polynomial approximations:
Lagranges Polynomial
Hermite Polynomial
Taylor Polynomial
Cubic Splines
Interpolation, Extrapolation & Polynomial Approximation
Lagrange Polynomial
Lets assume the following set of data:
x
0
x
1
x
2
x
3
x 3.2 2.7 1.0 4.8
f (x) 22.0 17.8 14.2 38.3
f
0
f
1
f
2
f
3
Then the interpolating polynomial will be of 4th order i.e.
ax
3
+ bx
2
+ cx + d = P(x). This leads to 4 equations for the 4 unknown
coecients and by solving this system we get a = 0.5275, b = 6.4952,
c = 16.117 and d = 24.3499 and the polynomial is:
P(x) = 0.5275x
3
+ 6.4952x
2
16.117x + 24.3499
It is obvious that this procedure is quite laboureus and Lagrange
developed a direct way to nd the polynomial
P
n
(x) = f
0
L
0
(x) + f
1
L
1
(x) + .... + f
n
L
n
(x) =
n

i =0
f
i
L
i
(x) (1)
where L
i
(x) are the Lagrange coecient polynomials
Interpolation, Extrapolation & Polynomial Approximation
L
j
(x) =
(x x
0
)(x x
1
)...(x x
j 1
)(x x
j +1
)...(x x
n
)
(x
j
x
0
)(x
j
x
1
)...(x
j
x
j 1
)(x
j
x
j +1
)...(x
j
x
n
)
(2)
and obviously:
L
j
(x
k
) =
jk
=
_
0 if j = k
1 if j = k
where
jk
is Kroneckers symbol.
ERRORS
The error when the Lagrange polynomial is used to approximate a
continuous function f (x) it is :
E(x) = (x x
0
)(x x
1
)....(x x
n
)
f
(n+1)
()
(n + 1)!
where [x
0
, x
N
] (3)
NOTE
Lagrange polynomial applies for evenly and unevenly spaced points. Still
if the points are evenly spaced then it reduces to a much simpler form.
Interpolation, Extrapolation & Polynomial Approximation
Lagrange Polynomial : Example
Find the Lagrange polynomial that
approximates the function y = cos(x).
We create the table
x
i
0 0.5 1
f
i
1 0.0 -1
The Lagrange coeecient polynomials are:
L
1
(x) =
(x x
2
)(x x
3
)
(x
1
x
2
)(x
1
x
3
)
=
(x 0.5)(x 1)
(0 0.5)(0 1)
= 2x
2
3x + 1,
L
2
(x) =
(x x
1
) (x x
3
)
(x
2
x
1
)(x
2
x
3
)
=
(x 0)(x 1)
(0.5 0)(0.5 1)
= 4(x
2
x)
L
3
(x) =
(x x
1
)(x x
2
)
(x
3
x
1
)(x
3
x
2
)
=
(x 0)(x 0.5)
(1 0)(1 0.5)
= 2x
2
x
thus
P(x) = 1 (2x
2
3x + 1) 0.4 (x
2
x) + (1) (2x
2
x) = 2x + 1
Interpolation, Extrapolation & Polynomial Approximation
The error will be:
E(x) = x (x 0.5) (x 1)

3
sin()
3!
e.g. for x = 0.25 is E(0.25) 0.24.
Interpolation, Extrapolation & Polynomial Approximation
Newton Polynomial
Forward Newton-Gregory
P
n
(x
s
) = f
0
+ s f
0
+
s(s 1)
2!

2
f
0
+
s(s 1)(s 2)
3!

3
f
0
+ ...
= f
0
+
_
s
1
_
f
0
+
_
s
2
_

2
f
0
+
_
s
3
_

3
f
0
+ ...
=
n

i =0
_
s
i
_

i
f
0
(4)
where x
s
= x
0
+ s h and
f
i
= f
i +1
f
i
(5)

2
f
i
= f
i +2
2f
i +1
+ f
i
(6)

3
f
i
= f
i +3
3f
i +2
+ 3f
i +1
f
i
(7)

n
f
i
= f
i +n
nf
i +n1
+
n(n 1)
2!
f
i +n2

n(n 1)(n 2)
3!
f
i +n3
+ (8)
Interpolation, Extrapolation & Polynomial Approximation
Newton Polynomial
ERROR The error is the same with the Lagrange polynomial :
E(x) = (x x
0
)(x x
1
)....(x x
n
)
f
(n+1)
()
(n + 1)!
where [x
0
, x
N
] (9)
x f (x) f (x)
2
f (x)
3
f (x)
4
f (x)
5
f (x)
0.0 0.000
0.203
0.2 0.203 0.017
0.220 0.024
0.4 0.423 0.041 0.020
0.261 0.044 0.032
0.6 0.684 0.085 0.052
0.246 0.096
0.8 1.030 0.181
0.527
1.0 1.557
Table: Example of a dierence matrix
Backward Newton-Gregory
P
n
(x) = f
0
+
_
s
1
_
f
1
+
_
s + 1
2
_

2
f
2
+...+
_
s + n 1
n
_

n
f
n
(10)
Interpolation, Extrapolation & Polynomial Approximation
x F(x) f (x)
2
f (x)
3
f (x)
4
f (x)
5
f (x)
0.2 1.06894
0.11242
0.5 1.18136 0.01183
0.12425 0.00123
0.8 1.30561 0.01306 0.00015
0.13731 0.00138 0.000001
1.1 1.44292 0.01444 0.00014
0.15175 0.0152
1.4 1.59467 0.01596
0.16771
1.7 1.76238
Newton-Gregory forward with x
0
= 0.5:
P
3
(x) = 1.18136 + 0.12425 s + 0.01306
_
s
2
_
+ 0.00138
_
s
3
_
= 1.18136 + 0.12425 s + 0.01306 s (s 1)/2 + 0.00138 s (s 1) (s 2)/6
= 0.9996 + 0.3354 x + 0.052 x
2
+ 0.085 x
3
Newton-Gregory backwards with x
0
= 1.1:
P
3
(x) = 1.44292 + 0.13731 s + 0.01306
_
s + 1
2
_
+ 0.00123
_
s + 2
3
_
= 1.44292 + 0.13731 s + 0.01306 s (s + 1)/2 + 0.00123 s (s + 1) (s + 2)/6
= 0.99996 + 0.33374 x + 0.05433 x
2
+ 0.007593 x
3
Interpolation, Extrapolation & Polynomial Approximation
Hermite Polynomial
This applies when we have information not only for the values of f (x)
but also on its derivative f

(x)
P
2n1
(x) =
n

i =1
A
i
(x)f
i
+
n

i =1
B
i
(x)f

i
(11)
where
A
i
(x) = [1 2(x x
i
)L

i
(x
i
)] [L
i
(x)]
2
(12)
B
i
(x) = (x x
i
) [L
i
(x)]
2
(13)
and L
i
(x) are the Lagrange coecients.
ERROR: the accuracy is similar to that of Lagrange polynomial of order
2n!
y(x) p(x) =
y
(2n+1)
()
(2n + 1)!
[(x x
1
)(x x
2
) . . . (x x
n
)]
2
(14)
Interpolation, Extrapolation & Polynomial Approximation
Hermite Polynomial : Example
Fit a Hermite polynomial to the
data of the table:
k x
k
y
k
y

k
0 0 0 0
1 4 2 0
The Lagrange coecients are:
L
0
(x) =
x x
1
x
0
x
1
=
x 4
0 4
=
x 4
4
L
1
(x) =
x x
0
x
1
x
0
=
x
4
L

0
(x) =
1
x
0
x
1
=
1
4
L

1
(x) =
1
x
1
x
0
=
1
4
Thus
A
0
(x) =

1 2 L

0
(x x
0
)

L
2
0
=

1 2

1
4

(x 0)

x 4
4

2
A
1
(x) =

1 2 L

0
(x x
1
)

L
2
1
=

1 2
1
4
(x 4)

x
4

2
=

3
x
2

x
4

2
B
0
(x) = (x 0)

x 4
4

2
= x

x 4
4

2
B
1
(x) = (x 4)

x
4

2
And the Hermite polynomial is:
P(x) = (6 x)
x
2
16
.
Interpolation, Extrapolation & Polynomial Approximation
Taylor Polynomial
It is an alternative way of approximating functions with polynomials. In
the previous two cases we found the polynomial P(x) that gets the same
value with a function f (x) at N points or the polynomial that agrees with
a function and its derivative at N points. Taylor polynomial has the same
value x
0
with the function but agrees also up to the Nth derivative with
the given function. That is:
P
(i )
(x
0
) = f
(i )
(x
0
) and i = 0, 1, ..., n
and the Taylor polynomial has the well known form from Calculus
P(x) =
N

i =0
f
(i )
(x)
i !
(x x
0
)
i
(15)
ERROR: was also estimated in calculus
E
N
(x) = (x x
0
)
N+1
f
(N+1)
()
(N + 1)!
(16)
Interpolation, Extrapolation & Polynomial Approximation
Taylor Polynomial : Example
We will show that for the calculation of e = 2.718281828459... with
13-digit approximation we need 15 terms of the Taylor expansion.
All the derivatives at x = 1 are:
y
0
= y
(1)
0
= y
(2)
0
= ... = y
(n)
0
= 1
thus
p(x) =
n

i =1
1
i !
x
n
= 1 + x +
x
2
2
+ ... +
1
n!
x
n
and the error will be
|E
n
| = x
n+1
e

(n + 1)!
=
e

16!
<
3
16!
= 1.433 10
13
Interpolation, Extrapolation & Polynomial Approximation
Interpolation with Cubic Splines
In some cases the typical polynomial
approximation cannot smoothly t certain
sets of data. Consider the function
f (x) =
_
_
0 1 x 0.2
1 5|x| 0.2 < x < 0.2
0 0.2 x 1.0
We can easily verify that we cannot t the
above data with any polynomial degree!
P(x) = 1 26x
2
+ 25x
4
The answer to the problem is given by the spline tting. That is we pass
a set of cubic polynomials (cubic splines) through the points, using a new
cubic for each interval. But we require that the slope and the curvature
be the same for the pair of cubics that join at each point.
Interpolation, Extrapolation & Polynomial Approximation
Interpolation with Cubic Splines
Interpolation, Extrapolation & Polynomial Approximation
Interpolation with Cubic Splines
Let the cubic for the i th interval, which lies between the points (x
i
, y
i
)
and (x
i +1
, y
i +1
) has the form:
y(x) = a
i
(x x
i
)
3
+ b
i
(x x
i
)
2
+ c
i
(x x
i
) + d
i
Since it ts at the two endpoints of the interval:
y
i
= a
i
(x
i
x
i
)
3
+ b
i
(x
i
x
i
)
2
+ c
i
(x
i
x
i
) + d
i
= d
i
y
i +1
= a
i
(x
i +1
x
i
)
3
+ b
i
(x
i +1
x
i
)
2
+ c
i
(x
i +1
x
i
) + d
i
= a
i
h
3
i
+ b
i
h
2
i
+ c
i
h
i
+ d
i
where h
i
= x
i +1
x
i
. We need the 1st and 2nd derivatives to relate the
slopes and curvatures of the joining polynomials, by dierentiation we get
y

(x) = 3a
i
(x x
i
)
2
+ 2b
i
(x x
i
) + c
i
y

(x) = 6a
i
(x x
i
) + 2b
i
Interpolation, Extrapolation & Polynomial Approximation
The mathematical procedure is simplied if we write the equations in
terms of the 2nd derivatives of the interpolating cubics. Lets name S
i
the 2nd derivative at the point (x
i
, y
i
) then we can easily get:
b
i
=
S
i
2
, a
i
=
S
i +1
S
i
6h
i
(17)
which means
y
i +1
=
S
i +1
S
i
6h
i
h
3
i
+
S
i
2
h
2
i
+ c
i
h
i
+ y
i
and nally
c
i
=
y
i +1
y
i
h
i

2h
i
S
i
+ h
i
S
i +1
6
(18)
Now we invoke the condition that the slopes of the two cubics joining at
(x
i
, y
i
) are the same:
y

i
= 3a
i
(x
i
x
i
)
2
+ 2b
i
(x
i
x
i
) + c
i
= c
i
y

i
= 3a
i 1
(x
i
x
i 1
)
2
+ 2b
i 1
(x
i
x
i 1
) + c
i 1
= 3a
i 1
h
2
i 1
+ 2b
i 1
h
i 1
+ c
i 1
Interpolation, Extrapolation & Polynomial Approximation
By equating these and substituting a, b, c and d we get:
y

i
=
y
i +1
y
i
h
i

2h
i
S
i
+ h
i
S
i +1
6
= 3
_
S
i
S
i 1
6h
i 1
_
h
2
i 1
+ 2
S
i 1
2
h
i 1
+
y
i
y
i 1
h
i 1

2h
i 1
S
i 1
+ h
i 1
S
i
6
and by simplifying we get:
h
i 1
S
i 1
+ 2 (h
i 1
+ h
i
) S
i
+ h
i
S
i +1
= 6
_
y
i +1
y
i
h
i

y
i
y
i 1
h
i 1
_
(19)
If we have n + 1 points the above relation can be applied to the n 1
internal points. Thus we create a system of n 1 equations for the n + 1
unknown S
i
. This system can be solved if we specify the values of S
0
and
S
n
.
Interpolation, Extrapolation & Polynomial Approximation
The system of n 1 equations with n + 1 unknown will be written as:
_
_
_
_
.......
h
0
2(h
0
+ h
1
) h
1
h
1
2(h
1
+ h
2
) h
2
h
2
2(h
2
+ h
3
) h
3
....... .......
h
n2
2(h
n2
+ h
n1
) h
n1
_
_
_
_
_
_
_
_
S
0
S
1
S
2
:
S
n2
S
n1
S
n
_
_
_
_
= 6
_
_
_
_
_
_
_
_
_
....
y
2
y
1
h
1

y
1
y
0
h
0
y
3
y
2
h
2

y
2
y
1
h
1
....
y
n
y
n1
h
n1

y
n1
y
n2
h
n2
....
_
_
_
_
_
_
_
_
_


Y
From the solution of this linear systems we get the coecients a
i
, b
i
, c
i
and d
i
via the relations:
a
i
=
S
i +1
S
i
6h
i
, b
i
=
S
i
2
(20)
c
i
=
y
i +1
y
i
h
i

2h
i
S
i
+ h
i
S
i +1
6
(21)
d
i
= y
i
(22)
Interpolation, Extrapolation & Polynomial Approximation
Choice I Take, S
0
= 0 and S
n
= 0 this will lead to the solution of the
following (n 1) (n 1) linear system:
_
_
_
_
_
_
2(h
0
+ h
1
) h
1
h
1
2(h
1
+ h
2
) h
2
h
2
2(h
2
+ h
3
) h
3
....
h
n2
2(h
n2
+ h
n1
)
_
_
_
_
_
_

_
_
_
_
_
_
S
1
S
2
S
3
S
n1
_
_
_
_
_
_
=

Y
Choice II Take, S
0
= S
1
and S
n
= S
n1
this will lead to the solution of
the following (n 1) (n 1) linear system:

3h
0
+ 2h
1
h
1
h
1
2(h
1
+ h
2
) h
2
h
2
2(h
2
+ h
3
) h
3
... ...
h
n2
2h
n2
+ 3h
n1

S
1
S
2
S
3
S
n1

=

Y
Interpolation, Extrapolation & Polynomial Approximation
Choice III Use linear extrapolation
S
1
S
0
h
0
=
S
2
S
1
h
1
S
0
=
(h
0
+ h
1
)S
1
h
0
S
2
h
1
S
n
S
n1
h
n1
=
S
n1
S
n2
h
n2
s
n
=
(h
n2
+ h
n1
)S
n1
h
n1
S
n2
h
n2
this will lead to the solution of the following (n 1) (n 1) linear
system:

(h
0
+h
1
)(h
0
+2h
1
)
h
1
h
2
1
h
2
0
h
1
h
1
2(h
1
+ h
2
) h
2
h
2
2(h
2
+ h
3
) h
3
.... ....
h
2
n2
h
2
n1
h
n2
(h
n1
+h
n2
)(h
n1
+2h
n2
)
h
n2

S
1
S
2
S
3
S
n1

=

Y
Interpolation, Extrapolation & Polynomial Approximation
Choice IV Force the slopes at the end points to assume certain values.
If f

(x
0
) = A and f

(x
n
) = B then
2h
0
S
0
+ h
1
S
1
= 6
_
y
1
y
0
h
0
A
_
h
n1
S
n1
+ 2h
n
S
n
= 6
_
B
y
n
y
n1
h
n1
_
_
_
_
_
_
_
2h
0
h
1
h
0
2(h
0
+ h
1
) h
1
h
1
2(h
1
+ h
2
) h
2
....
h
n2
2h
n1
_
_
_
_
_
_

_
_
_
_
_
_
S
1
S
2
S
3
S
n1
_
_
_
_
_
_
=

Y
Interpolation, Extrapolation & Polynomial Approximation
Interpolation with Cubic Splines : Example
Fit a cubic spline in the data (y = x
3
8):
x 0 1 2 3 4
y -8 -7 0 19 56
Depending on the condition at the end we get the following solutions:
Condition I : S
0
= 0, S
4
= 0
_
_
4 1 0
1 4 1
0 1 4
_
_

_
_
S
1
S
2
S
3
_
_
=
_
_
36
72
108
_
_

S
1
= 6.4285
S
2
= 10.2857
S
3
= 24.4285
Condition II : S
0
= S
1
, S
4
= S
3
_
_
s 1 0
1 4 1
0 1 s
_
_

_
_
S
1
S
2
S
3
_
_
=
_
_
36
72
108
_
_

S
1
= S
0
= 4.8
S
2
= 1.2
S
3
= 19.2 = S
4
Interpolation, Extrapolation & Polynomial Approximation
Condition III :
_
_
6 0 0
1 4 1
0 0 6
_
_

_
_
S
1
S
2
S
3
_
_
=
_
_
36
72
108
_
_

S
0
= 0 S
1
= 6
S
2
= 12 S
3
= 18
S
4
= 24
Condition IV :
_
_
_
_
_
_
2 1 0 0 0
1 4 1 0 0
0 1 4 1 0
0 0 1 4 1
0 0 0 1 2
_
_
_
_
_
_

_
_
_
_
_
_
S
0
S
1
S
2
S
3
S
4
_
_
_
_
_
_
=
_
_
_
_
_
_
6
36
72
108
66
_
_
_
_
_
_
S
0
= 0
S
1
= 6
S
2
= 12
S
3
= 18
S
4
= 24
Interpolation, Extrapolation & Polynomial Approximation
Interpolation with Cubic Splines : Problems
1
The following data are from astronomical observations and
represent variations of the apparent magnitude of a type of variable
stars called Cepheids
Time 0.0 0.2 0.3 0.4 0.5 0.6 0.7 0.8 1.0
Apparent
magnitude
0.302 0.185 0.106 0.093 0.24 0.579 0.561 0.468 0.302
Use splines to create a new table for the apparent magnitude for
intervals of time of 0.5.
2
From the following table nd the acceleration of gravity at
T ubingen (48
o
31) and the distance between two points with
angular separation of 1 of a degree.
Latitude Length of 1 of arc
on the parallel
local acceleration
of gravity g
0
0
1855.4 m 9.7805 m/sec
2
15
0
1792.0 m 9.7839 m/sec
2
30
0
1608.2 m 9.7934 m/sec
2
45
0
1314.2 m 9.8063 m/sec
2
60
0
930.0 m 9.8192 m/sec
2
75
0
481.7 m 9.8287 m/sec
2
90
0
0.0 m 9.8322 m/sec
2
Interpolation, Extrapolation & Polynomial Approximation
Rational function approximations
Here we introduce the notion of rational approximations for functions.
We will constrain our discussion to the so called Pade approximation.
A rational approximation of f (x) on [a, b], is the quotient of two
polynomials P
n
(x) and Q
m
(x) with degrees n and m
1
f (x) = R
N
(x)
P
n
(x)
Q
m
(x)
=
a
0
+ a
1
x + a
2
x
2
+ ... + a
n
x
n
1 + b
1
x + b
2
x
2
+ ... + b
m
x
m
, N = n + m
i.e. there are N + 1 = n + m + 1 constants to be determined.
The method of Pade requires that f (x) and its derivatives are continuous
at x = 0. This choice makes the manipulation simpler and a change of
variable can be used to shift, if needed, the calculations over to an
interval that contains zero.
We begin with the Maclaurin series for f (x) (up to the term x
N
), this
can be written as :
f (x) c
0
+ c
1
x + ... + c
N
x
N
where c
i
= f
(i )
(0)/(i !).
1
Sometimes we write R
N
(x) R
n,m
(x).
Interpolation, Extrapolation & Polynomial Approximation
Pade approximation
Then we create the dierence
f (x) R
N
(x)

c
0
+ c
1
x + ... + c
N
x
N

a
0
+ a
1
x + ... + a
n
x
n
1 + b
1
x + ... + b
m
x
m
=

c
0
+ c
1
x + ... + c
N
x
N

(1 + b
1
x + ... + b
m
x
m
) (a
0
+ a
1
x + ... + a
n
x
n
)
1 + b
1
x + ... + b
m
x
m
If f (0) = R
N
(0) then c
0
a
0
= 0.
In the same way , in order for the rst N derivatives of f (x) and R
N
(x)
to be equal at x = 0 the coecients of the powers of x up to x
N
in the
numerator must be zero also.
Interpolation, Extrapolation & Polynomial Approximation
This gives additionally N equations for the as and bs
b
1
c
0
+ c
1
a
1
= 0
b
2
c
0
+ b
1
c
1
+ c
2
a
2
= 0
b
3
c
0
+ b
2
c
1
+ b
1
c
2
+ c
3
a
3
= 0
.
.
.
b
m
c
nm
+ b
m1
c
nm+1
+ ... + c
n
a
n
= 0
b
m
c
nm+1
+ b
m1
c
nm+2
+ ... + c
n+1
= 0 (23)
b
m
c
nm+2
+ b
m1
c
nm+3
+ ... + c
n+2
= 0
.
.
.
b
m
c
Nm
+ b
m1
c
Nm+1
+ ... + c
N
= 0
Notice that in each of the above equations, the sum of subscripts on the
factors of each product is the same, and is equal to the exponent of the
x-term in the numerator.
Interpolation, Extrapolation & Polynomial Approximation
Pade approximation : Example
For the R
9
(x) or R
5,4
(x) Pade approximation for the function tan
1
(x)
we calculate the Maclaurin series of tan
1
(x):
tan
1
(x) = x
1
3
x
3
+
1
5
x
5

1
7
x
7
+
1
9
x
9
and then
f (x)R
9
(x) =

x
1
3
x
3
+
1
5
x
5

1
7
x
7
+
1
9
x
9

1 + b
1
x + b
2
x
2
+ b
3
x
3
+ b
4
x
4

a
0
+ a
1
x + a
2
x
2
+ ... + a
5
x
5

1 + b
1
x + b
2
x
2
+ b
3
x
3
+ b
4
x
4
and the coecients will be found by the following system of equations:
a
0
= 0, a
1
= 1, a
2
= b
1
, a
3
=
1
3
+ b
2
, a
4
=
1
3
b
1
+ b
3
, a
5
=
1
5

1
3
b
2
+ b
4
1
5
b
1

1
2
b
3
= 0,
1
7
+
1
5
b
2

1
3
b
4
= 0 ,
1
7
b
1
+
1
5
b
3
= 0,
1
9

1
7
b
2
+
1
5
b
4
= 0 (24)
from which we get
a
0
= 0, a
1
= 1, a
2
= 0, a
3
=
7
9
, a
4
= 0, a
5
=
64
945
, b
1
= 0, b
2
=
10
9
, b
3
= 0, b
4
=
5
21
.
tan
1
x R
9
(x) =
x +
7
9
x
3
+
64
945
x
5
1 +
10
9
x
2
+
5
21
x
4
For x = 1 , exact 0.7854, R
9
(1) = 0.78558 while from the Maclaurin
series we get 0.8349!
Interpolation, Extrapolation & Polynomial Approximation
Rational approximation for sets of data
If instead of the analytic form of a function f (x) we have a set of k
points (x
i
, f (x
i
)) in order to nd a rational function R
N
(x) such that for
every x
i
we will get f (x
i
) = R
N
(x
i
) i.e.
R
N
(x
i
) =
a
0
+ a
1
x
i
+ a
2
x
2
i
+ ... + a
n
x
n
i
1 + b
1
x
i
+ b
2
x
2
i
+ ... + b
m
x
m
i
= f (x
i
)
we will follow the approach used in constructing the approximate
polynomial. In other words the problem will be solved by nding the
solution of the following system of k m + n + 1 equations:
a
0
+ a
1
x
1
+ ... + a
n
x
n
1
(f
1
x
1
) b
1
... (f
1
x
m
1
) b
m
= f
1
::
a
0
+ a
1
x
i
+ ... + a
n
x
n
i
(f
i
x
i
) b
1
... (f
i
x
m
i
) b
m
= f
i
::
a
0
+ a
1
x
k
+ ... + a
n
x
n
k
(f
k
x
k
) b
1
... (f
k
x
m
k
) b
m
= f
k
i.e. we get k equations for the k unknowns a
0,
a
1
, ..., a
n
and b
1
, b
2
, ..., b
m
.
Interpolation, Extrapolation & Polynomial Approximation
Rational approximation for sets of data : Example
We will nd the rational function approximations for the following set of
data (-1,1), (0,2) and (1,-1).
It is obvious that the sum of degrees of the polynomials in the nominator
and denominator must be (n + m + 1 3). Thus we can write:
R
1,1
(x) =
a
0
+ a
1
x
1 + b
1
x
which leads to the following system
a
0
+ (1) a
1
(1) b
1
= 1
a
0
+ 0 a
1
0 b
1
= 2
a
0
+ 1 a
1
(1) b
1
= 1
_
_
_

a
0
= 2
a
1
= 1
b
1
= 2
and the rational fuction will be:
R
1,1
(x) =
2 x
1 2x
.
Alternatively, one may derive the following rational function:
R
0,1
(x) =
a
0
1 + b
1
x + b
2
x
R (x) =
2
1 2x x
2
Interpolation, Extrapolation & Polynomial Approximation
Rational approximation: Problems
1
Find the Pade approximation R
3,3
(x) for the function y = e
x
.
Compare with the Maclaurin series for x = 1.
2
Find the Pade approximation R
3,5
(x) for the functions y = cos(x)
and y = sin(x). Compare with the Maclaurin series for x = 1.
3
Find the Pade approximation R
4,6
(x). for the function
y = 1/x sin(x). Compare with the Maclaurin series for x = 1.
4
Find the rational approximation for the following set of points:
0 1 2 4
0.83 1.06 1.25 4.15
Interpolation, Extrapolation & Polynomial Approximation

You might also like