Sunteți pe pagina 1din 15

10/1/2012

Liu,Jie 1
Numerical Method-Sudarmaji Interpolation
INTERPOLATION
1. Direct Method
2. Newton's Divided Difference Method
3. Lagrange Method
4. Spline Method
Numerical Method-Sudarmaji Interpolation
Numerical Method-Sudarmaji Interpolation 3
Given (x
0
,y
0
), (x
1
,y
1
), (x
n
,y
n
), find the value of y at a
value of x that is not given.

Figure 1 Interpolation of discrete.

Numerical Method-Sudarmaji Interpolation 4
Polynomials are the most common
choice of interpolants because they
are easy to:
Evaluate
Differentiate, and
Integrate
Numerical Method-Sudarmaji Interpolation 5
Given n+1 data points (x
0
,y
0
), (x
1
,y
1
),.. (x
n
,y
n
),
pass a polynomial of order n through the data as given
below:



where a
0
, a
1
,. a
n
are real constants.
Set up n+1 equations to find n+1 constants.
To find the value y at a given value of x, simply
substitute the value of x in the above polynomial.

. .......... ..........
1 0
n
n
x a x a a y + + + =
Numerical Method-Sudarmaji Interpolation 6
The upward velocity of a rocket is given as a
function of time in Table 1.
Find the velocity at t=16 seconds using the
direct method for linear interpolation.



0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 1 Velocity as a function
of time.
Figure 2 Velocity vs. time data for the
rocket example
( ) s , t ( ) ( ) m/s , t v
10/1/2012
Liu,Jie 2
Numerical Method-Sudarmaji Interpolation 7
( ) t a a t v
1 0
+ =
( ) ( ) 78 . 362 15 15
1 0
= + = a a v
( ) ( ) 35 . 517 20 20
1 0
= + = a a v
Solving the above two equations gives,

93 . 100
0
= a

914 . 30
1
= a
Hence
( ) . 20 15 , 914 . 30 93 . 100 s s + = t t t v

( ) ( ) m/s 7 . 393 16 914 . 30 93 . 100 16 = + = v

( )
0 0
, y x
( ) x f
1
( )
1 1
, y x
x
y
Figure 3 Linear interpolation.
Numerical Method-Sudarmaji Interpolation

http://numericalmethods.eng.usf.edu 8
The upward velocity of a rocket is given as a
function of time in Table 2.
Find the velocity at t=16 seconds using the
direct method for quadratic interpolation.



0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 2 Velocity as a function
of time.
Figure 5 Velocity vs. time data for the
rocket example
( ) s , t ( ) ( ) m/s , t v
Numerical Method-Sudarmaji Interpolation 9
Quadratic Interpolation


( )
2
2 1 0
t a t a a t v + + =
( ) ( ) ( ) 04 . 227 10 10 10
2
2 1 0
= + + = a a a v
( ) ( ) ( ) 78 . 362 15 15 15
2
2 1 0
= + + = a a a v
( ) ( ) ( ) 35 . 517 20 20 20
2
2 1 0
= + + = a a a v
Solving the above three equations gives
05 . 12
0
= a 733 . 17
1
= a 3766 . 0
2
= a

( ) 0 0 , y x
( )
1 1
, y x
( )
2 2
, y x
( ) x f
2
y
x
Figure 6 Quadratic interpolation.
Numerical Method-Sudarmaji Interpolation 10
10 12 14 16 18 20
200
250
300
350
400
450
500
550
517.35
227.04
y s
f range ( )
f x de sire d ( )
20 10 x s range , x de sire d ,
( ) 20 10 , 3766 . 0 733 . 17 05 . 12
2
s s + + = t t t t v
( ) ( ) ( )
2
16 3766 . 0 16 733 . 17 05 . 12 16 + + = v
m/s 19 . 392 =
The absolute relative approximate error obtained between
the results from the first and second order polynomial is
% 38410 . 0
100
19 . 392
70 . 393 19 . 392
=

= e
a
a
e
Numerical Method-Sudarmaji Interpolation 11
The upward velocity of a rocket is given as a
function of time in Table 3.
Find the velocity at t=16 seconds using the
direct method for cubic interpolation.



0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 3 Velocity as a function
of time.
Figure 6 Velocity vs. time data for the
rocket example
( ) s , t ( ) ( ) m/s , t v
Numerical Method-Sudarmaji Interpolation 12




( )
3
3
2
2 1 0
t a t a t a a t v + + + =
( ) ( ) ( ) ( )
3
3
2
2 1 0
10 10 10 04 . 227 10 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
15 15 15 78 . 362 15 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
20 20 20 35 . 517 20 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
5 . 22 5 . 22 5 . 22 97 . 602 5 . 22 a a a a v + + + = =
2540 . 4
0
= a 266 . 21
1
= a 13204 . 0
2
= a
0054347 . 0
3
= a
y
x
( ) x f3
( )
3 3, y x
( )
2 2, y x
( )
1 1, y x
( )
0 0, y x
Figure 7 Cubic interpolation.
10/1/2012
Liu,Jie 3
Numerical Method-Sudarmaji Interpolation 13
10 12 14 16 18 20 22 24
200
300
400
500
600
700
602.97
227.04
y s
f range ( )
f x de sire d ( )
22.5 10 x s range , x de sire d ,
( ) 5 . 22 10 , 0054347 . 0 13204 . 0 266 . 21 2540 . 4
3 2
s s + + + = t t t t t v
( ) ( ) ( ) ( )
m/s 06 . 392
16 0054347 . 0 16 13204 . 0 16 266 . 21 2540 . 4 16
3 2
=
+ + + = v
The absolute percentage relative
approximate error between
second and third order polynomial is
a
e
% 033269 . 0
100
06 . 392
19 . 392 06 . 392
=

= e
a
Numerical Method-Sudarmaji Interpolation 14
Order of
Polynomial
1 2 3
( ) m/s 16 = t v 393.7 392.19 392.06
Absolute Relative
Approximate Error
---------- 0.38410 % 0.033269 %

Table 4 Comparison of different orders of the polynomial.
Numerical Method-Sudarmaji Interpolation 15
Find the distance covered by the rocket from t=11s to t=16s ?
( ) 5 . 22 10 , 0054606 . 0 13064 . 0 289 . 21 3810 . 4
3 2
s s + + + = t t t t t v
( ) ( ) ( )
( )
m 1605
4
0054347 . 0
3
13204 . 0
2
266 . 21 2540 . 4
0054347 . 0 13204 . 0 266 . 21 2540 . 4
11 16
16
11
4 3 2
16
11
3 2
16
11
=
(

+ + + =
+ + + =
=
}
}
t t t
t
dt t t t
dt t v s s
Numerical Method-Sudarmaji Interpolation 16
( ) 5 . 22 10 , 0054347 . 0 13204 . 0 266 . 21 2540 . 4
3 2
s s + + + = t t t t v
Find the acceleration of the rocket at t=16s given that
( ) ( )
( )
5 . 22 10 , 016382 . 0 26130 . 0 289 . 21
0054347 . 0 13204 . 0 266 . 21 2540 . 4
2
3 2
s s + + =
+ + + =
=
t t t
t t t
dt
d
t v
dt
d
t a

( ) ( ) ( )
2
2
m/s 665 . 29
16 016304 . 0 16 26408 . 0 266 . 21 16
=
+ + = a
Numerical Method-Sudarmaji Interpolation 17
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

Numerical Method-Sudarmaji Interpolation
2.Lagrangian Interpolation
10/1/2012
Liu,Jie 4
Numerical Method-Sudarmaji Interpolation 19

Given (x
0
,y
0
), (x
1
,y
1
), (x
n
,y
n
), find the
value of y at a value of x that is not given.

Numerical Method-Sudarmaji Interpolation 20


Lagrangian interpolating polynomial is given by

=
=
n
i
i i n
x f x L x f
0
) ( ) ( ) (
where n in ) (x f
n
stands for the
th
n order polynomial that approximates the function ) (x f y =
given at ) 1 ( + n data points as ( ) ( ) ( ) ( )
n n n n
y x y x y x y x , , , ,......, , , ,
1 1 1 1 0 0
, and

[
=
=

=
n
i j
j j i
j
i
x x
x x
x L
0
) (
) (x L
i
is a weighting function that includes a product of ) 1 ( n terms with terms of i j =
omitted.
Numerical Method-Sudarmaji Interpolation
21
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for linear interpolation.



Table Velocity as a
function of time
Figure. Velocity vs. time data
for the rocket example
(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
t ) (t v
Numerical Method-Sudarmaji Interpolation 22
10 12 14 16 18 20 22 24
350
400
450
500
550
517.35
362.78
y s
f range ( )
f x de sire d ( )
x s
1
10 + x s
0
10 x s range , x de sire d ,
) ( ) ( ) (
1
0
i i
i
t v t L t v
=
=
) ( ) ( ) ( ) (
1 1 0 0
t v t L t v t L + =

( ) 78 . 362 , 15
0 0
= = t t v
( ) 35 . 517 , 20
1 1
= = t t v
Numerical Method-Sudarmaji Interpolation 23
[
=
=

=
1
0
0 0
0
) (
j
j j
j
t t
t t
t L
1 0
1
t t
t t

=
[
=
=

=
1
1
0 1
1
) (
j
j j
j
t t
t t
t L
0 1
0
t t
t t

=
) ( ) ( ) (
1
0 1
0
0
1 0
1
t v
t t
t t
t v
t t
t t
t v

= ) 35 . 517 (
15 20
15
) 78 . 362 (
20 15
20

=
t t

) 35 . 517 (
15 20
15 16
) 78 . 362 (
20 15
20 16
) 16 (

= v
) 35 . 517 ( 2 . 0 ) 78 . 362 ( 8 . 0 + =
7 . 393 = m/s.
Numerical Method-Sudarmaji Interpolation 24
For the second order polynomial interpolation (also called quadratic interpolation), we
choose the velocity given by

=
=
2
0
) ( ) ( ) (
i
i i
t v t L t v
) ( ) ( ) ( ) ( ) ( ) (
2 2 1 1 0 0
t v t L t v t L t v t L + + =
10/1/2012
Liu,Jie 5
Numerical Method-Sudarmaji Interpolation
25
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for quadratic interpolation.



Table Velocity as a
function of time
Figure. Velocity vs. time data
for the rocket example
(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
t ) (t v
Numerical Method-Sudarmaji Interpolation 26
Quadratic Interpolation (contd)


10 12 14 16 18 20
200
250
300
350
400
450
500
550
517.35
227.04
y s
f range ( )
f x de sire d ( )
20 10 x s range , x de sire d ,
, 10
0
= t 04 . 227 ) (
0
= t v
, 15
1
= t 78 . 362 ) (
1
= t v
, 20
2
= t 35 . 517 ) (
2
= t v
[
=
=

=
2
0
0 0
0
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

=
2 0
2
1 0
1
t t
t t
t t
t t

[
=
=

=
2
1
0 1
1
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

=
2 1
2
0 1
0
t t
t t
t t
t t

[
=
=

=
2
2
0 2
2
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

=
1 2
1
0 2
0
t t
t t
t t
t t

Numerical Method-Sudarmaji Interpolation 27
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( )( ) ( )( ) ( )( )
m/s 19 . 392
35 . 527 12 . 0 78 . 362 96 . 0 04 . 227 08 . 0
35 . 517
15 20
15 16
10 20
10 16
78 . 362
20 15
20 16
10 15
10 16
04 . 227
20 10
20 16
15 10
15 16
16
2
1 2
1
0 2
0
1
2 1
2
0 1
0
0
2 0
2
1 0
1
=
+ + =
|
.
|

\
|

|
.
|

\
|

+ |
.
|

\
|

|
.
|

\
|

+ |
.
|

\
|

|
.
|

\
|

=
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

=
v
t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v
The absolute relative approximate error obtained between the
results from the first and second order polynomial is
a
e
% 38410 . 0
100
19 . 392
70 . 393 19 . 392
=

= e
a
Numerical Method-Sudarmaji Interpolation
28




10 12 14 16 18 20 22 24
200
300
400
500
600
700
602.97
227.04
y s
f range ( )
f x de sire d ( )
22.5 10 x s range , x de sire d ,
For the third order polynomial (also called cubic interpolation), we choose the velocity given by

=
=
3
0
) ( ) ( ) (
i
i i
t v t L t v
) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (
3 3 2 2 1 1 0 0
t v t L t v t L t v t L t v t L + + + =
Numerical Method-Sudarmaji Interpolation
29
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for cubic interpolation.



Table Velocity as a
function of time
Figure. Velocity vs. time data
for the rocket example
(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
t ) (t v
Numerical Method-Sudarmaji Interpolation 30
( ) 04 . 227 , 10 = =
o o
t v t ( ) 78 . 362 , 15
1 1
= = t v t
( ) 35 . 517 , 20
2 2
= = t v t ( ) 97 . 602 , 5 . 22
3 3
= = t v t

[
=
=

=
3
0
0 0
0
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 0
3
2 0
2
1 0
1
t t
t t
t t
t t
t t
t t
;
[
=
=

=
3
1
0 1
1
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 1
3
2 1
2
0 1
0
t t
t t
t t
t t
t t
t t

[
=
=

=
3
2
0 2
2
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 2
3
1 2
1
0 2
0
t t
t t
t t
t t
t t
t t
;
[
=
=

=
3
3
0 3
3
) (
j
j j
j
t t
t t
t L
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
2 3
2
1 3
1
0 3
0
t t
t t
t t
t t
t t
t t

10 12 14 16 18 20 22 24
200
300
400
500
600
700
602.97
227.04
y s
f range ( )
f x de sire d ( )
22.5 10 x s range , x de sire d ,
10/1/2012
Liu,Jie 6
Numerical Method-Sudarmaji Interpolation 31
( ) ( ) ( )
( ) ( )
( ) ( ) ( )
( ) ( )
( )( ) ( )( ) ( )( ) ( )( )
m/s 06 . 392
97 . 602 1024 . 0 35 . 517 312 . 0 78 . 362 832 . 0 04 . 227 0416 . 0
97 . 602
20 5 . 22
20 16
15 5 . 22
15 16
10 5 . 22
10 16
35 . 517
5 . 22 20
5 . 22 16
15 20
15 16
10 20
10 16
78 . 362
5 . 22 15
5 . 22 16
20 15
20 16
10 15
10 16
04 . 227
5 . 22 10
5 . 22 16
20 10
20 16
15 10
15 16
16
3
2 3
2
1 3
1
1 3
1
2
3 2
3
1 2
1
0 2
0
2
3 1
3
2 1
2
0 1
0
1
3 0
3
2 0
2
1 0
1
=
+ + + =
|
.
|

\
|

|
.
|

\
|

|
.
|

\
|

+ |
.
|

\
|

|
.
|

\
|

|
.
|

\
|

+
|
.
|

\
|

|
.
|

\
|

|
.
|

\
|

+ |
.
|

\
|

|
.
|

\
|

|
.
|

\
|

=
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
v
t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
The absolute relative approximate error obtained between the
results from the first and second order polynomial is
a
e
% 033269 . 0
100
06 . 392
19 . 392 06 . 392
=

= e
a
Numerical Method-Sudarmaji Interpolation 32
Order of
Polynomial
1 2 3
v(t=16) m/s 393.69 392.19 392.06
Absolute Relative
Approximate Error
-------- 0.38410% 0.033269%
Numerical Method-Sudarmaji Interpolation 33
Find the distance covered by the rocket from t=11s to
t=16s ?

, 00544 . 0 13195 . 0 265 . 21 245 . 4 ) (
3 2
t t t t v + + + = 5 . 22 10 s s t

}
=
16
11
) ( ) 11 ( ) 16 ( dt t v s s

}
+ + + ~
16
11
3 2
) 00544 . 0 13195 . 0 265 . 21 245 . 4 ( dt t t t

16
11
4 3 2
]
4
00544 . 0
3
13195 . 0
2
265 . 21 245 . 4 [
t t t
t + + + =
1605 = m
) 5727 . 2 )( 3000 650 45 ( ) 1388 . 4 )( 3375 5 . 712 5 . 47 (
) 9348 . 1 )( 4500 875 5 . 52 ( ) 36326 . 0 )( 6750 5 . 1087 5 . 57 ( ) (
2 3 2 3
2 3 2 3
+ + + +
+ + + =
t t t t t t
t t t t t t t v
Numerical Method-Sudarmaji Interpolation 34
,

Find the acceleration of the rocket at t=16s given that
( ) ( ) ( )
3 2
00544 . 0 13195 . 0 265 . 21 245 . 4 t t t
dt
d
t v
dt
d
t a + + + = =

2
01632 . 0 26390 . 0 265 . 21 t t + + =

2
) 16 ( 01632 . 0 ) 16 ( 26390 . 0 265 . 21 ) 16 ( + + = a
665 . 29 =
2
/ s m
, 00544 . 0 13195 . 0 265 . 21 245 . 4 ) (
3 2
t t t t v + + + = 5 . 22 10 s s t
Numerical Method-Sudarmaji Interpolation
Numerical Method-Sudarmaji Interpolation

Given (x
0
,y
0
), (x
1
,y
1
), (x
n
,y
n
), find the
value of y at a value of x that is not given.

10/1/2012
Liu,Jie 7
Numerical Method-Sudarmaji Interpolation
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

Numerical Method-Sudarmaji Interpolation
Linear interpolation: Given pass a linear
interpolant through the data


where
), , (
0 0
y x ), , (
1 1
y x
) ( ) (
0 1 0 1
x x b b x f + =

) (
0 0
x f b =
0 1
0 1
1
) ( ) (
x x
x f x f
b

=

Numerical Method-Sudarmaji Interpolation
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for linear
interpolation.



t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 1: Velocity as a
function of time
Figure 2: Velocity vs. time data
for the rocket example
Numerical Method-Sudarmaji Interpolation
10 12 14 16 18 20 22 24
350
400
450
500
550
517.35
362.78
y s
f range ( )
f x de sire d ( )
x s
1
10 + x s
0
10 x s range , x de sire d ,
, 15
0
= t 78 . 362 ) (
0
= t v
, 20
1
= t 35 . 517 ) (
1
= t v
) (
0 0
t v b = 78 . 362 =
0 1
0 1
1
) ( ) (
t t
t v t v
b

= 914 . 30 =
) ( ) (
0 1 0
t t b b t v + =
Numerical Method-Sudarmaji Interpolation
10 12 14 16 18 20 22 24
350
400
450
500
550
517.35
362.78
y s
f range ( )
f x de sire d ( )
x s
1
10 + x s
0
10 x s range , x de sire d ,
) ( ) (
0 1 0
t t b b t v + =
), 15 ( 914 . 30 78 . 362 + = t 20 15 s s t
At 16 = t
) 15 16 ( 914 . 30 78 . 362 ) 16 ( + = v
69 . 393 = m/s
Numerical Method-Sudarmaji Interpolation
Given ), , (
0 0
y x ), , (
1 1
y x and ), , (
2 2
y x fit a quadratic interpolant through the data.
) )( ( ) ( ) (
1 0 2 0 1 0 2
x x x x b x x b b x f + + =
) (
0 0
x f b =
0 1
0 1
1
) ( ) (
x x
x f x f
b

=
0 2
0 1
0 1
1 2
1 2
2
) ( ) ( ) ( ) (
x x
x x
x f x f
x x
x f x f
b

=
10/1/2012
Liu,Jie 8
Numerical Method-Sudarmaji Interpolation
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for quadratic
interpolation.



t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 1: Velocity as a
function of time
Figure 2: Velocity vs. time data
for the rocket example
Numerical Method-Sudarmaji Interpolation
Quadratic Interpolation (contd)


10 12 14 16 18 20
200
250
300
350
400
450
500
550
517.35
227.04
y s
f range ( )
f x de sire d ( )
20 10 x s range , x de sire d ,
, 10
0
= t 04 . 227 ) (
0
= t v
, 15
1
= t 78 . 362 ) (
1
= t v
, 20
2
= t 35 . 517 ) (
2
= t v
Numerical Method-Sudarmaji Interpolation
) (
0 0
t v b =
04 . 227 =

0 1
0 1
1
) ( ) (
t t
t v t v
b

=
10 15
04 . 227 78 . 362

=
148 . 27 =


0 2
0 1
0 1
1 2
1 2
2
) ( ) ( ) ( ) (
t t
t t
t v t v
t t
t v t v
b

=
10 20
10 15
04 . 227 78 . 362
15 20
78 . 362 35 . 517

=

10
148 . 27 914 . 30
=
37660 . 0 =
Numerical Method-Sudarmaji Interpolation
) )( ( ) ( ) (
1 0 2 0 1 0
t t t t b t t b b t v + + =
), 15 )( 10 ( 37660 . 0 ) 10 ( 148 . 27 04 . 227 + + = t t t 20 10 s s t
At , 16 = t
) 15 16 )( 10 16 ( 37660 . 0 ) 10 16 ( 148 . 27 04 . 227 ) 16 ( + + = v 19 . 392 = m/s
The absolute relative approximate error
a
e obtained between the results from the first
order and second order polynomial is

a
e 100 x
19 . 392
69 . 393 19 . 392
=

= 0.38502 %
Numerical Method-Sudarmaji Interpolation
) )( ( ) ( ) (
1 0 2 0 1 0 2
x x x x b x x b b x f + + =
where


Rewriting

) )( ]( , , [ ) ]( , [ ] [ ) (
1 0 0 1 2 0 0 1 0 2
x x x x x x x f x x x x f x f x f + + =
) ( ] [
0 0 0
x f x f b = =

0 1
0 1
0 1 1
) ( ) (
] , [
x x
x f x f
x x f b

= =

0 2
0 1
0 1
1 2
1 2
0 2
0 1 1 2
0 1 2 2
) ( ) ( ) ( ) (
] , [ ] , [
] , , [
x x
x x
x f x f
x x
x f x f
x x
x x f x x f
x x x f b

= =
Numerical Method-Sudarmaji Interpolation
Given ) 1 ( + n data points, ( ) ( ) ( ) ( )
n n n n
y x y x y x y x , , , ,......, , , ,
1 1 1 1 0 0
as
) )...( )( ( .... ) ( ) (
1 1 0 0 1 0
+ + + =
n n n
x x x x x x b x x b b x f
where
] [
0 0
x f b =
] , [
0 1 1
x x f b =
] , , [
0 1 2 2
x x x f b =

] ,...., , [
0 2 1 1
x x x f b
n n n
=
] ,...., , [
0 1
x x x f b
n n n
=
10/1/2012
Liu,Jie 9
Numerical Method-Sudarmaji Interpolation
The third order polynomial, given ), , (
0 0
y x ), , (
1 1
y x ), , (
2 2
y x and ), , (
3 3
y x is


) )( )( ]( , , , [
) )( ]( , , [ ) ]( , [ ] [ ) (
2 1 0 0 1 2 3
1 0 0 1 2 0 0 1 0 3
x x x x x x x x x x f
x x x x x x x f x x x x f x f x f
+
+ + =


0
b
0
x ) (
0
x f
1
b
] , [
0 1
x x f
2
b
1
x ) (
1
x f ] , , [
0 1 2
x x x f
3
b
] , [
1 2
x x f ] , , , [
0 1 2 3
x x x x f
2
x ) (
2
x f ] , , [
1 2 3
x x x f
] , [
2 3
x x f
3
x ) (
3
x f

Numerical Method-Sudarmaji Interpolation
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for cubic
interpolation.



t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 1: Velocity as a
function of time
Figure 2: Velocity vs. time data
for the rocket example
Numerical Method-Sudarmaji Interpolation

The velocity profile is chosen as

) )( )( ( ) )( ( ) ( ) (
2 1 0 3 1 0 2 0 1 0
t t t t t t b t t t t b t t b b t v + + + =
we need to choose four data points that are closest to 16 = t
, 10
0
= t 04 . 227 ) (
0
= t v
, 15
1
= t 78 . 362 ) (
1
= t v
, 20
2
= t 35 . 517 ) (
2
= t v
, 5 . 22
3
= t 97 . 602 ) (
3
= t v

The values of the constants are found as:
b
0
= 227.04; b
1
= 27.148; b
2
= 0.37660; b
3
= 5.4347*10
-3



Numerical Method-Sudarmaji Interpolation


b
0
= 227.04; b
1
= 27.148; b
2
= 0.37660; b
3
= 5.4347*10
-3

0
b
10
0
= t
04 . 227

1
b

148 . 27

2
b
, 15
1
= t
78 . 362

37660 . 0

3
b

914 . 30

3
10 4347 . 5

x

, 20
2
= t
35 . 517

44453 . 0


248 . 34

, 5 . 22
3
= t
97 . 602

Numerical Method-Sudarmaji Interpolation
Hence
) )( )( ( ) )( ( ) ( ) (
2 1 0 3 1 0 2 0 1 0
t t t t t t b t t t t b t t b b t v + + + =

) 20 )( 15 )( 10 ( 10 * 4347 . 5
) 15 )( 10 ( 37660 . 0 ) 10 ( 148 . 27 04 . 227
3
+
+ + =

t t t
t t t

At , 16 = t

) 20 16 )( 15 16 )( 10 16 ( 10 * 4347 . 5
) 15 16 )( 10 16 ( 37660 . 0 ) 10 16 ( 148 . 27 04 . 227 ) 16 (
3
+
+ + =

v

06 . 392 = m/s
The absolute relative approximate error
a
e obtained is
a
e 100 x
06 . 392
19 . 392 06 . 392
=

= 0.033427 %
Numerical Method-Sudarmaji Interpolation
Order of
Polynomial
1 2 3
v(t=16)
m/s
393.69 392.19 392.06
Absolute Relative
Approximate Error
---------- 0.38502 %

0.033427 %

10/1/2012
Liu,Jie 10
Numerical Method-Sudarmaji Interpolation
Find the distance covered by the rocket from t=11s to
t=16s ?


) 20 )( 15 )( 10 ( 10 * 4347 . 5
) 15 )( 10 ( 37660 . 0 ) 10 ( 148 . 27 04 . 227 ) (
3
+
+ + =

t t t
t t t t v
5 . 22 10 s s t

3 2
0054347 . 0 13204 . 0 265 . 21 2541 . 4 t t t + + + = 5 . 22 10 s s t
So
( ) ( ) ( )
}
=
16
11
11 16 dt t v s s
dt t t t ) 0054347 . 0 13204 . 0 265 . 21 2541 . 4 (
3 2
16
11
+ + + =
}


16
11
4 3 2
4
0054347 . 0
3
13204 . 0
2
265 . 21 2541 . 4
(

+ + + =
t t t
t
m 1605 =
Numerical Method-Sudarmaji Interpolation
Find the acceleration of the rocket at t=16s given that
3 2
0054347 . 0 13204 . 0 265 . 21 2541 . 4 ) ( t t t t v + + + =
( )
3 2
0054347 . 0 13204 . 0 265 . 21 2541 . 4 ) ( ) ( t t t
dt
d
t v
dt
d
t a + + + = =

2
016304 . 0 26408 . 0 265 . 21 t t + + =

2
) 16 ( 016304 . 0 ) 16 ( 26408 . 0 265 . 21 ) 16 ( + + = a

2
/ 664 . 29 s m =
Numerical Method-Sudarmaji Interpolation
Numerical Method-Sudarmaji Interpolation 58

Given (x
0
,y
0
), (x
1
,y
1
), (x
n
,y
n
), find the
value of y at a value of x that is not given.

Numerical Method-Sudarmaji Interpolation 59
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

Numerical Method-Sudarmaji Interpolation 60
2
25 1
1
) (
x
x f
+
=
Table : Six equidistantly spaced points in [-1, 1]












Figure : 5
th
order polynomial vs. exact function
x 2
25 1
1
x
y
+
=
-1.0 0.038461
-0.6 0.1
-0.2 0.5
0.2 0.5
0.6 0.1
1.0 0.038461
10/1/2012
Liu,Jie 11
Numerical Method-Sudarmaji Interpolation 61
Figure : Higher order polynomial interpolation is a bad idea
-0.8
-0.4
0
0.4
0.8
1.2
-1 -0.5 0 0.5 1
x
y
19th Order Polynomial f (x) 5th Order Polynomial
Numerical Method-Sudarmaji Interpolation 62
Given ( ) ( ) ( )( )
n n n n
y x y x y x y x , , ,......, , , ,
1 1 1 1 0 0
, fit linear splines to the data. This simply involves
forming the consecutive data through straight lines. So if the above data is given in an ascending
order, the linear splines are given by ( ) ) (
i i
x f y =
Figure : Linear splines
Numerical Method-Sudarmaji Interpolation 63
), (
) ( ) (
) ( ) (
0
0 1
0 1
0
x x
x x
x f x f
x f x f

+ =
1 0
x x x s s
), (
) ( ) (
) (
1
1 2
1 2
1
x x
x x
x f x f
x f

+ =
2 1
x x x s s
.
.
.
), (
) ( ) (
) (
1
1
1
1

+ =
n
n n
n n
n
x x
x x
x f x f
x f
n n
x x x s s
1

Note the terms of

1
1
) ( ) (

i i
i i
x x
x f x f

in the above function are simply slopes between
1 i
x and
i
x .
Numerical Method-Sudarmaji Interpolation
The upward velocity of a rocket is given as a function
of time in Table 1. Find the velocity at t=16 seconds
using linear splines.



Table Velocity as a
function of time
Figure. Velocity vs. time data
for the rocket example
(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
t ) (t v
Numerical Method-Sudarmaji Interpolation
10 12 14 16 18 20 22 24
350
400
450
500
550
517.35
362.78
y s
f range ( )
f x de sire d ( )
x s
1
10 + x s
0
10 x s range , x de sire d ,




, 15
0
= t 78 . 362 ) (
0
= t v
, 20
1
= t 35 . 517 ) (
1
= t v
) (
) ( ) (
) ( ) (
0
0 1
0 1
0
t t
t t
t v t v
t v t v

+ =
) 15 (
15 20
78 . 362 35 . 517
78 . 362

+ = t
) 15 ( 913 . 30 78 . 362 ) ( + = t t v
At , 16 = t
) 15 16 ( 913 . 30 78 . 362 ) 16 ( + = v
7 . 393 = m/s
Numerical Method-Sudarmaji Interpolation
Given ( ) ( ) ( ) ( )
n n n n
y x y x y x y x , , , ,......, , , ,
1 1 1 1 0 0
, fit quadratic splines through the data. The splines
are given by
, ) (
1 1
2
1
c x b x a x f + + =
1 0
x x x s s
,
2 2
2
2
c x b x a + + =
2 1
x x x s s
.
.
.
,
2
n n n
c x b x a + + =
n n
x x x s s
1

Find ,
i
a ,
i
b ,
i
c = i 1, 2, , n

10/1/2012
Liu,Jie 12
Numerical Method-Sudarmaji Interpolation
Each quadratic spline goes through two consecutive data points
) (
0 1 0 1
2
0 1
x f c x b x a = + +
) (
1 1 1 1
2
1 1
x f c x b x a = + + .
.
.
) (
1 1
2
1
= + +
i i i i i i
x f c x b x a
) (
2
i i i i i i
x f c x b x a = + + .
.
.
) (
1 1
2
1
= + +
n n n n n n
x f c x b x a
) (
2
n n n n n n
x f c x b x a = + +
This condition gives 2n equations
Numerical Method-Sudarmaji Interpolation
The first derivatives of two quadratic splines are continuous at the interior points.
For example, the derivative of the first spline
1 1
2
1
c x b x a + + is
1 1
2 b x a +
The derivative of the second spline
2 2
2
2
c x b x a + + is
2 2
2 b x a +
and the two are equal at
1
x x = giving

2 1 2 1 1 1
2 2 b x a b x a + = +
0 2 2
2 1 2 1 1 1
= + b x a b x a
Numerical Method-Sudarmaji Interpolation
Similarly at the other interior points,
0 2 2
3 2 3 2 2 2
= + b x a b x a
.
.
.
0 2 2
1 1
= +
+ + i i i i i i
b x a b x a
.
.
.
0 2 2
1 1 1 1
= +
n n n n n n
b x a b x a
We have (n-1) such equations. The total number of equations is ) 1 3 ( ) 1 ( ) 2 ( = + n n n .
We can assume that the first spline is linear, that is 0
1
= a
Numerical Method-Sudarmaji Interpolation
This gives us 3n equations and 3n unknowns. Once we find the 3n constants,
we can find the function at any value of x using the splines,
, ) (
1 1
2
1
c x b x a x f + + =
1 0
x x x s s
,
2 2
2
2
c x b x a + + =
2 1
x x x s s
.
.
.
,
2
n n n
c x b x a + + =
n n
x x x s s
1

Numerical Method-Sudarmaji Interpolation
The upward velocity of a rocket is given as a function of time.
Using quadratic splines
a) Find the velocity at t=16 seconds
b) Find the acceleration at t=16 seconds
c) Find the distance covered between t=11 and t=16 seconds
Table Velocity as a
function of time
Figure. Velocity vs. time data
for the rocket example
(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
t ) (t v
Numerical Method-Sudarmaji Interpolation

, ) (
1 1
2
1
c t b t a t v + + =
10 0 s s t
,
2 2
2
2
c t b t a + + = 15 10 s s t
,
3 3
2
3
c t b t a + + =
20 15 s st
,
4 4
2
4
c t b t a + + = 5 . 22 20 s s t
,
5 5
2
5
c t b t a + + = 30 5 . 22 s s t





Let us set up the equations
10/1/2012
Liu,Jie 13
Numerical Method-Sudarmaji Interpolation 73
, ) (
1 1
2
1
c t b t a t v + + =
10 0 s s t
0 ) 0 ( ) 0 (
1 1
2
1
= + + c b a
04 . 227 ) 10 ( ) 10 (
1 1
2
1
= + + c b a
Numerical Method-Sudarmaji Interpolation
t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Each Spline Goes Through
Two Consecutive Data Points
04 . 227 ) 10 ( ) 10 (
2 2
2
2
= + + c b a
78 . 362 ) 15 ( ) 15 (
2 2
2
2
= + + c b a
78 . 362 ) 15 ( ) 15 (
3 3
2
3
= + + c b a
35 . 517 ) 20 ( ) 20 (
3 3
2
3
= + + c b a
67 . 901 ) 30 ( ) 30 (
5 5
2
5
= + + c b a
35 . 517 ) 20 ( ) 20 (
4 4
2
4
= + + c b a
97 . 602 ) 5 . 22 ( ) 5 . 22 (
4 4
2
4
= + + c b a
97 . 602 ) 5 . 22 ( ) 5 . 22 (
5 5
2
5
= + + c b a
Numerical Method-Sudarmaji Interpolation
, ) (
1 1
2
1
c t b t a t v + + = 10 0 s s t
,
2 2
2
2
c t b t a + + =
15 10 s s t
( ) ( )
10
2 2
2
2
10
1 1
2
1
= =
+ + = + +
t t
c t b t a
dt
d
c t b t a
dt
d
( ) ( )
10
2 2
10
1 1
2 2
= =
+ = +
t t
b t a b t a
( ) ( )
2 2 1 1
10 2 10 2 b a b a + = +
0 20 20
2 2 1 1
= + b a b a
Numerical Method-Sudarmaji Interpolation
Derivatives are continuous at
Interior Data Points
0 ) 10 ( 2 ) 10 ( 2
2 2 1 1
= + b a b a
0 ) 15 ( 2 ) 15 ( 2
3 3 2 2
= + b a b a
0 ) 20 ( 2 ) 20 ( 2
4 4 3 3
= + b a b a
0 ) 5 . 22 ( 2 ) 5 . 22 ( 2
5 5 4 4
= + b a b a
At t=10
At t=15
At t=20
At t=22.5
Numerical Method-Sudarmaji Interpolation
0
1
= a
Numerical Method-Sudarmaji Interpolation
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(

=




0
0
0
0
0
67 . 901
97 . 602
97 . 602
35 . 517
35 . 517
78 . 362
78 . 362
04 . 227
04 . 227
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 1 45 0 1 45 0 0 0 0 0 0 0 0 0
0 0 0 0 1 40 0 1 40 0 0 0 0 0 0
0 0 0 0 0 0 0 1 30 0 1 30 0 0 0
0 0 0 0 0 0 0 0 0 0 1 20 0 1 20
1 30 900 0 0 0 0 0 0 0 0 0 0 0 0
1 5 . 22 25 . 506 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 5 . 22 25 . 506 0 0 0 0 0 0 0 0 0
0 0 0 1 20 400 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 20 400 0 0 0 0 0 0
0 0 0 0 0 0 1 15 225 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 15 225 0 0 0
0 0 0 0 0 0 0 0 0 1 10 100 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 10 100
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
5
5
5
4
4
4
3
3
3
2
2
2
1
1
1
c
b
a
c
b
a
c
b
a
c
b
a
c
b
a
10/1/2012
Liu,Jie 14
Numerical Method-Sudarmaji Interpolation
i a
i
b
i
c
i

1 0 22.704 0
2 0.8888 4.928 88.88
3 0.1356 35.66 141.61
4 1.6048 33.956 554.55
5 0.20889 28.86 152.13
Numerical Method-Sudarmaji Interpolation
Numerical Method-Sudarmaji Interpolation
, 704 . 22 ) ( t t v = 10 0 s s t
, 88 . 88 928 . 4 8888 . 0
2
+ + = t t 15 10 s s t
, 61 . 141 66 . 35 1356 . 0
2
+ = t t 20 15 s s t
, 55 . 554 956 . 33 6048 . 1
2
+ = t t 5 . 22 20 s s t
, 13 . 152 86 . 28 20889 . 0
2
+ = t t 30 5 . 22 s s t
Numerical Method-Sudarmaji Interpolation
a) Velocity at t=16
, 704 . 22 ) ( t t v = 10 0 s s t
, 88 . 88 928 . 4 8888 . 0
2
+ + = t t 15 10 s s t
, 61 . 141 66 . 35 1356 . 0
2
+ = t t 20 15 s s t
, 55 . 554 956 . 33 6048 . 1
2
+ = t t 5 . 22 20 s s t
, 13 . 152 86 . 28 20889 . 0
2
+ = t t 30 5 . 22 s s t
( ) ( ) ( )
m/s 24 . 394
61 . 141 16 66 . 35 16 1356 . 0 16
2
=
+ = v
Numerical Method-Sudarmaji Interpolation
Acceleration from Velocity Profile
16
) ( ) 16 (
=
=
t
t v
dt
d
a
b) The quadratic spline valid at t=16 is
given by

) 61 . 141 66 . 35 1356 . 0 ( ) (
2
+ = t t
dt
d
t a
, 66 . 35 2712 . 0 + = t 20 15 s s t
66 . 35 ) 16 ( 2712 . 0 ) 16 ( + = a
2
m/s 321 . 31 =
( ) , 61 . 141 66 . 35 1356 . 0
2
+ = t t t v
20 15 s s t
Numerical Method-Sudarmaji Interpolation
c) Find the distance covered by the rocket from t=11s to
t=16s.
( ) ( )
}
=
16
11
) ( 11 16 dt t v S S
( )
20 15 , 61 . 141 66 . 35 1356 . 0
15 10 , 88 . 88 928 . 4 8888 . 0
2
2
s s + =
s s + + =
t t t
t t t t v
( ) ( ) ( ) ( ) ( )
( ) ( )
m 9 . 1595
61 . 141 66 . 35 1356 . 0 88 . 88 928 . 4 8888 . 0
11 16
16
15
2
15
11
2
16
11
15
11
16
15
=
+ + + + =
+ = =
} }
} } }
dt t t dt t t
dt t v dt t v dt t v S S
10/1/2012
Liu,Jie 15
Numerical Method-Sudarmaji Interpolation
THE END

S-ar putea să vă placă și