1, finish the question with all the step, the file I already provide below.
2, please do the extra bonus if you could.
3, when you finish the MATLAB code, please explain why you did this step with %% in MATLAB so that I can understand why you do that step.
4, important! Please finish on your own, and please duplicate checking after writing the code.
5, the topic_3 slides will help you. Maybe 1-70 pages will help you, don’t pull too ahead.
CHEE 3602 – Topic 3:
Interpolating polynomials
Stanislav Sokolenko
Fall 2023
Motivation
Interpolating polynomials
Motivation
3/118
Why interpolate?
M a n y i m p o r t a n t m a t h e m a t i c a l o p e r a t i o n s a r e o n l y d e fi n e d f o r f u n c t io n s (e q u a t io n s )
e .g . t h e c o n c e p t o f d e r iv a t iv e / in t e g r a l o n ly m a k e s s e n s e f o r f u n c t io n s —
C o lle c te d
th a t it c a n
w h a t is “ th e r a te o f c h a n g e ”
e m p ir ic a l d a t a
m u s t b e
o f a s e t o f d a ta p o in ts ?
c o n v e r te d
in to
fu n c t io n a l fo r m
s o
b e p r o c e s s e d /a n a ly z e d
e .g . c a lc u la t in g
t h e r a t e o f r e a c t io n
r e q u i r e s fi t t i n g
a fu n c t io n
to
g iv e n
a
s e t o f c o n c e n t r a t io n s
t h e c o n c e n t r a t io n
d a ta
Interpolating polynomials
Motivation
Numerical methods
In t e r p o la t io n
i s t h e p r o c e s s o f fi t t i n g
a fu n c t io n
e n a b lin g
in g
—
in d iv id u a l d a t a p o in t s t o
a n a ly s is th a t w o u ld
n o t b e p o s s ib le u s –
d is c r e te p o in ts .
M a n y c o m m o n n u m e r ic a l m e t h o d s a r e d e r iv e d u s in g in t e r p o la t io n , e v e n
if th e r e is n o
a p p a r e n t in t e r p o la t io n
ta k in g
p la c e .
4/118
Interpolating polynomials
Motivation
5/118
Numerical methods
T h is t o p ic is d iv id e d
in to
tw o
s p e c i fi c t a s k s :
B u ild in g
in te r p o la tin g
p o ly n o m ia ls
A p p ly in g
in te r p o la tin g
p o ly n o m ia ls to
d e v e lo p
m e th o d s fo r d iffe r-
e n t ia t io n / in t e g r a t io n
W e w ill s ta r t b y g o in g
ju s tify in g
th r o u g h
a p r a c t ic a l e x a m p le o f in t e r p o la t io n
t h e u s e o f p o ly n o m ia ls fo r in t e r p o la t io n .
a n d
Interpolating polynomials
Motivation
6/118
Defining interpolation
In t e r p o la t io n
u s in g
r e fe r s
to
th e
a s e r ie s o f t a b u la t e d
a p p r o x im a t io n
v a lu e s .
o f
a
fu n c t io n
𝑓(𝑥)
Interpolating polynomials
Motivation
7/118
Reading tables
In
e ffe c t , in t e r p o la t io n
is u s e d
T
G iv e n
to
e s tim a te v a lu e s b e tw e e n
*
( ° C )
P
90
525.76
92
566.99
94
610.91
96
657.62
98
707.27
100
760.00
ta b le r o w s .
( H g )
t h e t a b le a b o v e , w h a t is t h e v a p o u r p r e s s u r e o f w a t e r a t 9 6 .5
° C ?
Interpolating polynomials
Motivation
8/118
Reading tables
G iv e n
T
th a t th e r e is n o
*
( ° C )
P
( H g )
90
525.76
92
566.99
94
610.91
96
657.62
98
707.27
100
760.00
e n t r y f o r 9 6 .5
° C , t h e r e a r e a c o u p le o f o p t io n s
T h e s im p le s t is to
a s s u m e th a t
96.5 ≈ 96
T h e r e fo r e ,
P
*
(96.5) ≈ 657.62
…
Interpolating polynomials
Motivation
Reading tables
T h is is a v e r y
T
r o u g h
*
( ° C )
P
( H g )
90
525.76
92
566.99
94
610.91
96
657.62
98
707.27
100
760.00
a p p r o x im a t io n . H o w
9 6 .5
is b e tw e e n
c a n
9 6
it b e im p r o v e d ?
a n d
9 8
(96.5 − 96)/(98 − 96) = 0.25
S o
P
*
th e p r e s s u r e s h o u ld
b e h ig h e r
(96.5) ≈ 657.62 + (707.27 − 657.62)(0.25)
= 670.03
9/118
Interpolating polynomials
Motivation
10/118
Mathematically
B o th
a p p r o x im a t io n s c a n
b e e x p r e s s e d
a s in t e r p o la t io n :
1 .
T h e 6 5 7 .6 2
e s tim a te u s e d
a 0
2 .
T h e 6 7 0 .0 3
e s tim a te u s e d
a 1 s t o r d e r p o ly n o m ia l
T h e
1 s t o r d e r
th e
s u r r o u n d in g
th e o n ly
o r d e r p o ly n o m ia l
p o ly n o m ia l c a p tu r e s
o p t io n ?
ta b le
e n t r ie s
th a n
m o r e
in fo r m a t io n
th e
o r d e r.
0
B u t is
a r o u n d
th is
is
Interpolating polynomials
Motivation
11/118
Interpolating functions
T h e
g o a l o f in t e r p o la t io n
g a p s b e tw e e n
is
to
d e fi n e
a
fu n c t io n
th a t c a n
fi l l i n
th e
d a t a t a b le e n t r ie s (o r d a t a p o in t s )
If t h e fu n c t io n t h a t g e n e r a t e d t h e o r ig in a l d a t a is u n k n o w n , it m a k e s
s e n s e to
A
g o o d
c h o o s e s o m e th in g
in te r p o la tin g
fu n c t io n
g e n e r a te ( fo r m u la te )
e v a lu a te
d iffe r e n tia te
in te g r a te
c o n v e n ie n t
s h o u ld
b e e a s y to
Interpolating polynomials
Motivation
Polynomials
P o ly n o m ia ls s a tis fy
e v e r y
s in g le o n e o f th e r e q u ir e m e n ts !
12/118
Interpolating polynomials
Motivation
Polynomials
A n
n t h – o r d e r p o l y n o m i a l i s d e fi n e d
a s
𝑃𝑛 (𝑥) = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥2 + … + 𝑎𝑛 𝑥𝑛
A n
n th – o r d e r
r e q u ir e s
p o ly n o m ia l
𝑃𝑛 (𝑥) h a s 𝑛 + 1 c o e f fi c i e n t s a n d t h e r e f o r e
𝑛 + 1 p o in ts to e s tim a te .
13/118
Interpolating polynomials
Motivation
Back to the table
C o n s id e r e s t im a t in g
v a p o u r p r e s s u r e a t 9 6 .5
T
T h r e e v a lu e s c a n
b e u s e d
to
*
( ° C )
P
( H g )
90
525.76
92
566.99
94
610.91
96
657.62
98
707.27
100
760.00
fi t a q u a d r a t i c .
o n e m o r e tim e ,
14/118
Interpolating polynomials
Motivation
15/118
Formal justification
A
n ic e fe a t u r e o f u s in g
p o ly n o m ia ls is th a t th e y c a n
a p p r o x im a te a s u b s e t o f a n y
b e u s e d
to
c o n t in u o u s fu n c t io n .
M o r e fo r m a lly, t h e W e ie r s t r a s s a p p r o x im a t io n
th e o r e m
s ta te s
𝑓(𝑥) i s a c o n t i n u o u s f u n c t i o n i n t h e c l o s e d i n t e r v a l
𝑎 ≤ 𝑥 ≤ 𝑏 , t h e n f o r e v e r y 𝜀 > 0, t h e r e e x i s t s a p o l y n o m i a l
𝑃𝑛 (𝑥), w h e r e t h e v a l u e o f 𝑛 d e p e n d s o n t h e v a l u e o f 𝜀 s u c h t h a t
f o r a l l x i n t h e c l o s e d i n t e r v a l 𝑎 ≤ 𝑥 ≤ 𝑏, |𝑃𝑛 (𝑥) − 𝑓(𝑥)| < 𝜀. ”
th a t:
“ If
Interpolating polynomials
Motivation
16/118
Polynomial uniqueness
I t i s o n l y p o s s i b l e t o d e fi n e o n e p o l y n o m i a l o f o r d e r
th r o u g h
fi n e d .
𝑛t h a t p a s s e s
𝑛+1 p o in ts , r e g a r d le s s o f h o w th e p o ly n o m ia l is d e -
T h is
c o n s t r u c t io n
m e a n s
m a y
o u tp u t is o fte n
th a t w h ile
b e
m o r e
id e n t ic a l.
s o m e
m e th o d s
c o n v e n ie n t t h a n
fo r
p o ly n o m ia l
o th e r s , th e
fi n a l
Interpolating polynomials
Motivation
Chemical engineering example
Temperature
R e c a ll th e T - x y
d ia g r a m :
Vapour fraction
Liquid fraction
Fraction benzene
A lth o u g h
th e r e
s t r a ig h t fo r w a r d
is
a n
w a y
a lg o r ith m
o f g e ttin g
fo r
g e ttin g
𝑇 = 𝑓(𝑥, 𝑦)
𝑥, 𝑦 = 𝑓(𝑇), t h e r e i s n o
17/118
Interpolating polynomials
Motivation
Interpolation
O n e
p r a c t ic a l
o p t io n
is
to
g e n e r a te
a
s e t
o f
𝑥, 𝑦 p o i n t s u s i n g
𝑇, a n d t h e n i n t e r p o l a t e t o fi n d t h e r e v e r s e
r e l a t i o n : 𝑇 = 𝑓(𝑥, 𝑦).
d iffe r e n t v a lu e s
o f
18/118
Interpolating polynomials
Motivation
Interpolation
c a n
g e t g o o d r e s u lts w ith
Temperature
L in e a r in t e r p o la t io n
Fraction benzene
a la r g e n u m b e r o f p o in ts :
19/118
Interpolating polynomials
Motivation
Interpolation
in t e r p o la t io n
o r d e r c a n
y ie ld
Temperature
B u t in c r e a s in g
Fraction benzene
d r a m a t ic im p r o v e m e n t s :
20/118
Interpolating polynomials
Motivation
Nomenclature
T h e s e
s lid e s r e s e r v e
th e
te r m
in t e r p o la t io n
o d s w h e r e t h e l i n e o f fi t m u s t p a s s t h r o u g h
In
f o r fi t t i n g
m e th -
e v e r y s in g le p o in t.
c o n t r a s t t o r e g r e s s i o n , w h e r e t h e l i n e o f fi t d o e s n o t h a v e t o
p a s s th r o u g h
e v e r y
s in g le d a ta p o in t.
21/118
Interpolating polynomials
Motivation
22/118
Noise
N o te , p a s s in g
G o o d
th r o u g h
in t e r p o la t io n
N e v e r in te r p o la te n o is y
e v e r y
B a d
d a ta !
s in g le p o in t is n o t a lw a y s a p p r o p r ia te
in t e r p o la t io n
G o o d
r e g r e s s io n
...
Interpolating polynomials
Motivation
Topic outline
1 .
In te r p o la tin g
p o ly n o m ia ls
2 .
D iffe r e n t ia t io n / in t e g r a t io n
23/118
Interpolating polynomials
Motivation
24/118
Learning outcomes
B y th e e n d
1 .
o f t h is t o p ic , y o u
A p p ly L a g r a n g e , d iv id e d
o d s to
s h o u ld
d iffe r e n c e , a n d N e w to n
g e n e r a te in te r p o la tin g
2 .
E s t im a t e in t e r p o la t io n
3 .
U n d e r s ta n d
t h e d e r iv a t io n
4 .
D e r iv e
a p p ly
a n d
b e a b le to :
p o ly n o m ia l m e th -
fu n c t io n s
e r r o r
fi n i t e
o f s p lin e in t e r p o la t io n
d iffe r e n c e
a n d
N e w to n - C o te s
d iffe r e n tia te o r in te g r a te d a ta
5 .
U n d e r s ta n d
a n d
a p p ly
a d a p t iv e in t e g r a t io n
m e th o d s
m e th o d s
to
Interpolating polynomials
Interpolating polynomials
Interpolating polynomials
26/118
L a g r a n g e
Lagrange polynomial
T h e
L a g r a n g e
in te r p o la tin g
G iv e n
in te r p o la tin g
m o s t in t u it iv e
o f a ll th e
p o ly n o m ia ls .
th r e e p o in ts
𝑃2 (𝑥) =
p o ly n o m ia l is th e
(𝑥1 , 𝑓1 ), (𝑥2 , 𝑓2 ), (𝑥3 , 𝑓3 ):
(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑓1 +
𝑓2 +
𝑓
(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 )
(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 )
(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2 ) 3
It lo o k s c o m p lic a t e d , b u t t h is e q u a t io n
is s t r a ig h t fo r w a r d
to
d e r iv e
...
Interpolating polynomials
Interpolating polynomials
27/118
L a g r a n g e
The derivation
F ir s t,
𝑃2 (𝑥) m u s t p a s s t h r o u g h a l l o f t h e 𝑓𝑖 v a l u e s , s o i t m a k e s s e n s e
th a t th e y w o u ld
𝑃2 (𝑥) =
b e in
t h e fi n a l e q u a t i o n :
𝑓1 +
S o w h a t c a n b e m u lt ip lie d b y
w h e n
𝑥 = 𝑥1 ?
𝑓2 +
𝑓3
𝑓2 t o m a k e s u r e t h a t t h e 𝑓2 t e r m d i s a p p e a r s
Interpolating polynomials
Interpolating polynomials
28/118
L a g r a n g e
The derivation
A t
𝑥 = 𝑥1 , (𝑥 − 𝑥1 ) = 0, s o t h e 𝑓2 a n d 𝑓3 t e r m s d i s a p p e a r :
𝑃2 (𝑥) =
B u t w h a t a b o u t th e
𝑓1 +
(𝑥 − 𝑥1 )
𝑓1 a n d 𝑓3 t e r m s f o r 𝑥2 ?
𝑓2 +
(𝑥 − 𝑥1 )
𝑓3
Interpolating polynomials
Interpolating polynomials
29/118
L a g r a n g e
The derivation
C o n tin u in g :
𝑃2 (𝑥) =
(𝑥 − 𝑥2 )
𝑓1 +
(𝑥 − 𝑥1 )
𝑓2 +
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑓3
Interpolating polynomials
Interpolating polynomials
30/118
L a g r a n g e
The derivation
A n d
th e n u m e r a to r s a r e d o n e :
𝑃2 (𝑥) =
P lu g
in
(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑓1 +
(𝑥 − 𝑥1 )(𝑥 − 𝑥3 )
𝑓2 +
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑥 = 𝑥1 , w h a t s h o u l d t h e d e n o m i n a t o r b e t o g e t 𝑓1 ?
𝑓3
Interpolating polynomials
Interpolating polynomials
L a g r a n g e
The derivation
D iv id e b y
(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) t o m a k e s u r e 𝑃2 (𝑥1 ) = 𝑓1 :
𝑃2 (𝑥) =
A n d
fo llo w
(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑓1 +
𝑓2 +
𝑓3
(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 )
th e s a m e a p p r o a c h
fo r th e o th e r te r m s
...
31/118
Interpolating polynomials
Interpolating polynomials
L a g r a n g e
The derivation
O v e r a ll r e s u lt is th e r e fo r e :
𝑃2 (𝑥) =
(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥3 )
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑓1 +
𝑓2 +
𝑓
(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 )
(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 )
(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2 ) 3
A s illu s tr a te d
b e fo r e
...
32/118
Interpolating polynomials
Interpolating polynomials
L a g r a n g e
General form
T h e o v e r a ll e q u a t io n
c a n
b e c o n c is e ly
𝑛+1
e x p r e s s e d
𝑥 − 𝑥𝑗 ⎞
⎛
⎟ 𝑓𝑖
𝑃𝑛 (𝑥) = ∑ ⎜∏
𝑥
−
𝑥
𝑖
𝑗
𝑖=1 ⎝ 𝑗≠𝑖
⎠
a s :
33/118
Interpolating polynomials
Interpolating polynomials
34/118
L a g r a n g e
Polynomial evaluation
O n c e a p o ly n o m ia l is c o n s tr u c te d u s in g a s e t o f p o in ts , th e d e n o m in a to r
a n d
th e
𝑓𝑖 v a l u e s d o n o t c h a n g e :
𝑃2 (𝑥) = (𝑥 − 𝑥2 )(𝑥 − 𝑥3 )𝑎1 + (𝑥 − 𝑥1 )(𝑥 − 𝑥3 )𝑎2 + (𝑥 − 𝑥1 )(𝑥 − 𝑥2 )𝑎3
S o
it is
m o r e
e f fi c i e n t t o
fo r a s e t o f p o in ts a n d
B u t a d d in g
a n
c a lc u la te
th e n
th e
s to r e th e m
c o n s ta n t v a lu e s
o f
fo r la te r u s e .
e x tr a p o in t r e q u ir e s a lo t o f e x tr a m a th
...
𝑎1 , 𝑎2 , 𝑎3 o n c e
Interpolating polynomials
Interpolating polynomials
L a g r a n g e
Example
P r o b le m
1
In t e r p o la t e t h e fo llo w in g T - x y t e m p e r a t u r e d a t a a s a fu n c t io n
o f fr a c t io n
b e n z e n e u s in g
i
a L a g r a n g e p o ly n o m ia l:
T e m p e r a tu r e ( ° C )
F r a c t io n
b e n z e n e
1
80.10
1.00
2
95.36
0.39
3
110.62
0.00
35/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Divided difference polynomial
T h e
id e a l m e t h o d
fl e x i b l e
s a m e
fo r
c a lc u la t io n
s e t o f p o in ts .
o f
p o ly n o m ia l c o n s t r u c t io n
d iffe r e n t
O n e
w a y
to
o r d e r
d o
S o , w h a t is th is d iv id e d
p o ly n o m ia ls
th is is w ith
e n c e p o ly n o m ia ls .
d iffe r e n c e ?
s h o u ld
e n a b le
u s in g
d iv id e d
th e
d iffe r-
36/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Divided difference
A
d iv id e d
th e tw o
d iffe r e n c e o f o r d e r 1 ,
p o in ts
[ 𝑓1 , 𝑓2 ], i s e f f e c t i v e l y t h e s l o p e b e t w e e n
(𝑥1 , 𝑓1 ), (𝑥2 , 𝑓2 ):
[ 𝑓1 , 𝑓2 ] =
A n d
a
d iv id e d
d iffe r e n c e
tw o
s lo p e s b e tw e e n
o f o r d e r 2 ,
𝑓2 − 𝑓1
𝑥2 − 𝑥1
[ 𝑓1 , 𝑓2 , 𝑓3 ], i s l i k e a “ s l o p e ” o f t h e
th r e e p o in ts :
[ 𝑓1 , 𝑓2 , 𝑓3 ] =
[ 𝑓2 , 𝑓3 ] − [ 𝑓1 , 𝑓2 ]
=
𝑥3 − 𝑥1
𝑓3 − 𝑓2
𝑓2 − 𝑓1
−
𝑥3 −𝑥2
𝑥2 −𝑥1
𝑥3 − 𝑥1
37/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
38/118
d iffe r e n c e
Divided difference polynomial
A
p o ly n o m ia l o f o r d e r
𝑛 c a n th e n b e b u ilt u s in g :
𝑃𝑛 (𝑥) = [ 𝑓𝑖 ] + (𝑥 − 𝑥𝑖 )[ 𝑓𝑖 , 𝑓𝑖+1 ] + (𝑥 − 𝑥𝑖 )(𝑥 − 𝑥𝑖+1 )[ 𝑓𝑖 , 𝑓𝑖+1 , 𝑓𝑖+2 ] + ...
G iv e n
th r e e p o in ts
w o u ld
b e :
(𝑥1 , 𝑓1 ), (𝑥2 , 𝑓2 ), (𝑥3 , 𝑓3 ), a s e c o n d o r d e r p o l y n o m i a l
𝑃2 (𝑥) = [ 𝑓1 ] + (𝑥 − 𝑥1 )[ 𝑓1 , 𝑓2 ] + (𝑥 − 𝑥1 )(𝑥 − 𝑥2 )[ 𝑓1 , 𝑓2 , 𝑓3 ]
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Divided difference polynomial
𝑃2 (𝑥) = [ 𝑓1 ] + (𝑥 − 𝑥1 )[ 𝑓1 , 𝑓2 ] + (𝑥 − 𝑥1 )(𝑥 − 𝑥2 )[ 𝑓1 , 𝑓2 , 𝑓3 ]
T h is m a y
n o t lo o k
v e r y
c o n v e n ie n t , b u t r e c a ll t h a t :
[ 𝑓1 , 𝑓2 , 𝑓3 ] =
S o
p o ly n o m ia l o r d e r c a n
[ 𝑓2 , 𝑓3 ] − [ 𝑓1 , 𝑓2 ]
𝑥3 − 𝑥1
b e in c r e a s e d
w ith
o n e n e w
te r m .
39/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Table of differences
T h e d iv id e d d iffe r e n c e p o ly n o m ia l c a n b e b u ilt u p u s in g a t a b le
o f p r e - c o m p u t e d d iv id e d d iffe r e n c e s , w it h t h e t o t a l n u m b e r o f
te r m s s e le c te d
b a s e d
T h is
im p r o v e m e n t o v e r th e
is
a
m a jo r
o n
th e r e q u ir e d
p r e c is io n .
L a g r a n g e
p o ly n o m ia l,
w h ic h m u s t b e a lm o s t e n t ir e ly r e b u ilt if it is n e c e s s a r y t o c h a n g e
th e n u m b e r o f p o in ts u s e d
in
t h e in t e r p o la t io n .
40/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Shorthand notation
S in c e
th e
s q u a r e
b r a c k e t n o t a t io n
lo n g , it is c o m m o n
to
[ 𝑓1 , 𝑓2 , 𝑓3 , ...] c a n q u i c k l y g r o w v e r y
u s e a s h o r th a n d
n o t a t io n :
[ 𝑓1 ] = 𝑓1(0) = 𝑓1
[ 𝑓1 , 𝑓2 ] = 𝑓1(1) =
𝑓2(0) − 𝑓1(0)
𝑓2 − 𝑓1
=
𝑥2 − 𝑥1
𝑥2 − 𝑥1
𝑓−𝑓
𝑓−𝑓
3
2
(1)
(1)
− 𝑥2−𝑥1
𝑓
−
𝑓
𝑥
−𝑥
2
1
1
[ 𝑓1 , 𝑓2 , 𝑓3 ] = 𝑓1(2) = 2
= 3 2
𝑥3 − 𝑥1
𝑥3 − 𝑥1
41/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
General form
S o
t h e o v e r a ll e q u a t io n
c a n
𝑛
b e c o n c is e ly
𝑖
e x p r e s s e d
⎜∏(𝑥 − 𝑥𝑗)⎞
⎟ 𝑓1(𝑖)
𝑃𝑛 (𝑥) = ∑ ⎛
𝑖=0 ⎝ 𝑗=1
⎠
a s :
42/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Verification
P r o b le m
T a k e t h e d e fi n i t i o n
o f a d iv id e d
2
d iffe r e n c e p o ly n o m ia l:
𝑃𝑛 (𝑥) = [ 𝑓1 ] + (𝑥 − 𝑥1 )[ 𝑓1 , 𝑓2 ] + (𝑥 − 𝑥1 )(𝑥 − 𝑥2 )[ 𝑓1 , 𝑓2 , 𝑓3 ] + ...
a n d
s h o w
th a t fo r
𝑥 = 𝑥2 , 𝑃𝑛 (𝑥2 ) = 𝑓2 .
43/118
Interpolating polynomials
Interpolating polynomials
D iv id e d
d iffe r e n c e
Example
P r o b le m
3
In t e r p o la t e t h e fo llo w in g T - x y t e m p e r a t u r e d a t a a s a fu n c t io n
o f fr a c t io n
b e n z e n e u s in g
i
a d iv id e d
T e m p e r a tu r e ( ° C )
d iffe r e n c e p o ly n o m ia l:
F r a c t io n
b e n z e n e
1
80.10
1.00
2
95.36
0.39
3
110.62
0.00
44/118
Interpolating polynomials
Interpolating polynomials
N e w to n
Newton polynomial
R e c a ll th a t o n e
o f th e
t r a d e - o ffs c o n s id e r e d
w h e n
c o m p a r in g
n u m e r ic a l m e t h o d s is r o b u s t n e s s / g e n e r a lit y v s . s p e e d . A s im p lify in g a s s u m p t io n
a n d
p o te n tia lly
O n e s u c h
c a n
o fte n
b e t t e r v e r s io n
s i m p l i fi c a t i o n
b e u s e d t o g e n e r a t e a s i m p l i fi e d
o f a n
e x is tin g
th a t is o fte n
a lg o r ith m .
m a d e w ith
is t o c h o o s e e q u id is t a n t p o in t s , m a k in g
in t e r p o la t io n
it p o s s ib le t o g e t r id o f
(𝑥𝑖+1 − 𝑥𝑖 ) t e r m s i n t h e d i v i d e d d i f f e r e n c e f o r m u l a t i o n a n d
r e p l a c e t h e m w i t h a c o n s t a n t s t e p s i z e o f ℎ.
a ll
45/118
Interpolating polynomials
Interpolating polynomials
N e w to n
Finite differences
S in c e th e r e is n o
n e e d
to
k e e p
tr a c k
o f a ll th e
𝑥te rm s, re m o v e th e m :
Δ(0) 𝑓1 = 𝑓1
Δ(1) 𝑓1 = Δ(0) 𝑓2 − Δ(0) 𝑓1 = 𝑓2 − 𝑓1
Δ(2) 𝑓1 = Δ(1) 𝑓2 − Δ(1) 𝑓1 = ( 𝑓3 − 𝑓2 ) − ( 𝑓2 − 𝑓1 )
= 𝑓3 − 2 𝑓2 + 𝑓1
46/118
Interpolating polynomials
Interpolating polynomials
47/118
N e w to n
Newton polynomial
(𝑥 − 𝑥𝑖 ) t e r m s a r e r e p l a c e d b y t h e n u m b e r o f “ s t e p s ” 𝑥 i s f r o m
t h e fi r s t p o i n t 𝑥1 , w h e r e e a c h s t e p ℎ = 𝑥2 − 𝑥1 :
A ll th e
𝑠=
A llo w in g
th e N e w to n
p o ly n o m ia l to
𝑃𝑛 (𝑠) = Δ(0) 𝑓1 + 𝑠Δ(1) 𝑓1 +
W h ic h
is
a
p r o a c h
th a t c a n
𝑥 − 𝑥1
ℎ
c o n s id e r a b le
b e u s e d
b e d e fi n e d
a s :
𝑠(𝑠 − 1) (2)
𝑠(𝑠 − 1)(𝑠 − 2) (3)
Δ 𝑓1 +
Δ 𝑓1 + ...
2!
3!
s i m p l i fi c a t i o n
w h e n
o v e r th e
th e d a ta is o n
a n
d iv id e d
e q u a lly
d iffe r e n c e
s p a c e d
g r id .
a p -
Interpolating polynomials
Interpolating polynomials
N e w to n
The kernel of many applications
T h e N e w to n
p o l y n o m i a l ( fi n i t e d i f f e r e n c e ) f o r m u l a t i o n
t h e b a s is o f t o p ic 4 .
S ta r t g e ttin g
u s e d
to
it n o w !
fo r m s
48/118
Interpolating polynomials
Interpolating polynomials
N e w to n
Verification
P r o b le m
S u b s titu te
4
𝑠 = (𝑥−𝑥1 )/ℎ i n t o t h e d i v i d e d d i f f e r e n c e e q u a t i o n :
𝑃2 (𝑥) = 𝑓1(0) + (𝑥 − 𝑥1 ) 𝑓1(1) + (𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) 𝑓1(2)
a n d s h o w
t h a t it is e q u iv a le n t t o t h e N e w t o n
𝑥2 − 𝑥1 = 𝑥3 − 𝑥2 = ℎ.
p o ly n o m ia l w h e n
49/118
Interpolating polynomials
Interpolating polynomials
N e w to n
Example
P r o b le m
U s in g
th e
v a p o u r
o f th is
t o p ic ,
p r e s s u r e
g e n e r a te
a
e x a m p le
2 n d
𝑥1 = 94 t o c a l c u l a t e 𝑃∗ (96.5).
o r d e r
d a ta
fr o m
N e w to n
th e
5
b e g in n in g
p o ly n o m ia l fr o m
50/118
Interpolating polynomials
Interpolating polynomials
N e w to n
Different differences
N e w to n
p o ly n o m ia ls w e r e in tr o d u c e d
w ith
fo r w a r d
d iffe r e n c e s :
Δ 𝑓𝑖 = 𝑓𝑖+1 − 𝑓𝑖
B u t b a c k w a r d
d iffe r e n c e s a r e n o t m u c h
d iffe r e n t:
∇ 𝑓𝑖 = 𝑓𝑖 − 𝑓𝑖−1
𝑠=
𝑃𝑛 (𝑠) = ∇(0) 𝑓𝑖 + 𝑠∇(1) 𝑓𝑖 +
𝑥 − 𝑥𝑖
ℎ
𝑠(𝑠 + 1) (2)
𝑠(𝑠 + 1)(𝑠 + 2) (3)
∇ 𝑓𝑖 +
∇ 𝑓𝑖 + ...
2!
3!
51/118
Interpolating polynomials
Interpolating polynomials
52/118
S p lin e in t e r p o la t io n
Global vs. local fit
𝑛 p o i n t s r e q u i r e s a p o l y n o m i a l o f o r d e r 𝑛 − 1. H o w e v e r , w o r k i n g w i t h h i g h o r d e r p o l y n o m i a l s ( 𝑛 > 20) c a n l e a d
F ittin g
to
a
la r g e r o u n d – o ff e r r o r s u n d e r s o m e c ir c u m s ta n c e s .
In s te a d
o f u s in g
a
s in g le
g l o b a l fi t , o n e s o l u t i o n
m ia l to
p e r fo r m
h ig h
is to
a l o c a l fi t .
o r d e r
p o ly n o m ia l to
c o m b in e m a n y lo w
p e r fo r m
a
o r d e r p o ly n o –
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
Basic setup
C o n s id e r a s m a ll s e t o f p o in t s t o
(𝑥2 , 𝑓2 )
(𝑥1 , 𝑓1 )
b e fi t :
(𝑥3 , 𝑓3 )
(𝑥4 , 𝑓4 )
53/118
Interpolating polynomials
Interpolating polynomials
54/118
S p lin e in t e r p o la t io n
1st order
U n iq u e
to u c h
1 s t
o r d e r
s p lin e s
n e ig h b o u r in g
b e
g e n e r a te d
b y
fo r c in g
e a c h
s p lin e
p o in ts .
(𝑥2 , 𝑓2 )
(𝑥1 , 𝑓1 )
c a n
(𝑥3 , 𝑓3 )
(𝑥4 , 𝑓4 )
to
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
1st order
𝑛 p o i n t s c a n b e fi t b y 𝑛 − 1 p o l y n o m i a l s , s o :
P a r a m e te r s :
2
p a r a m e te r s p e r
𝑛 − 1 p o l y n o m i a l = 2(𝑛 − 1)
A v a ila b le in fo r m a t io n :
E a c h
o f th e
𝑛 − 1 p o ly n o m ia ls to u c h e s 2 p o in ts
2(𝑛 − 1) − 2(𝑛 − 1) = 0
( s u f fi c i e n t t o
c a lc u la te a ll p a r a m e te r s )
55/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
H o w e v e r , t h e s e c o n d i t i o n s a r e n o t s u f fi c i e n t f o r 2 n d
(𝑥2 , 𝑓2 )
(𝑥1 , 𝑓1 )
D a ta p o in ts a lo n e d o
o r d e r s p lin e s .
(𝑥3 , 𝑓3 )
(𝑥4 , 𝑓4 )
n o t s p e c ify
a u n iq u e s e t o f p o ly n o m ia ls .
56/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
𝑛 p o i n t s c a n b e fi t b y 𝑛 − 1 p o l y n o m i a l s , s o :
P a r a m e te r s :
3
p a r a m e te r s p e r
𝑛 − 1 p o l y n o m i a l = 3(𝑛 − 1)
A v a ila b le in fo r m a t io n :
E a c h
o f th e
𝑛 − 1 p o ly n o m ia ls to u c h e s 2 p o in ts
3(𝑛 − 1) − 2(𝑛 − 1) = 𝑛 − 1
(n o t e n o u g h
to
c a lc u la te p a r a m e te r s )
57/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
In t u it iv e ly, it s h o u ld
b e c le a r th a t th is is a b a d
(𝑥2 , 𝑓2 )
fi t :
(𝑥3 , 𝑓3 )
(𝑥1 , 𝑓1 )
B u t h o w
c a n
a g o o d
(𝑥4 , 𝑓4 )
fi t b e d e s c r i b e d
m a t h e m a t ic a lly ?
58/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
In
g e n e r a l, a “ g o o d ”
fi t i s s m o o t h
(𝑥2 , 𝑓2 )
(𝑥3 , 𝑓3 )
(𝑥1 , 𝑓1 )
A n d
s m o o t h n e s s i s d e fi n e d
(𝑥4 , 𝑓4 )
b y
c o n t in u o u s d e r iv a t iv e s
…
59/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
𝑛 p o i n t s c a n b e fi t b y 𝑛 − 1 p o l y n o m i a l s , s o :
P a r a m e te r s :
3
p a r a m e te r s p e r
𝑛 − 1 p o l y n o m i a l = 3(𝑛 − 1)
A v a ila b le in fo r m a t io n :
E a c h
o f th e
𝑛 − 1 p o ly n o m ia ls to u c h e s 2 p o in ts
N e ig h b o u r in g
a t
p o ly n o m ia ls h a v e s a m e 1 s t d e r iv a t iv e s
𝑛 − 2 p o in ts
3(𝑛 − 1) − 2(𝑛 − 1) − (𝑛 − 2) = 1
( s till n o t e n o u g h
to
c a lc u la te p a r a m e te r s )
60/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
2nd order
𝑛 p o i n t s c a n b e fi t b y 𝑛 − 1 p o l y n o m i a l s , s o :
P a r a m e te r s :
3
p a r a m e te r s p e r
𝑛 − 1 p o l y n o m i a l = 3(𝑛 − 1)
A v a ila b le in fo r m a t io n :
E a c h
o f th e
𝑛 − 1 p o ly n o m ia ls to u c h e s 2 p o in ts
N e ig h b o u r in g
a t
p o ly n o m ia ls h a v e s a m e 1 s t d e r iv a t iv e s
𝑛 − 2 p o in ts
F o r c e 1 s t o r 2 n d
d e r iv a t iv e t o
z e r o
3(𝑛 − 1) − 2(𝑛 − 1) − (𝑛 − 2) − 1 = 0
( s u f fi c i e n t t o
c a lc u la te a ll p a r a m e te r s )
a t 1 p o in t
61/118
Interpolating polynomials
Interpolating polynomials
62/118
S p lin e in t e r p o la t io n
Higher orders
In c r e a s in g
p o ly n o m ia l o r d e r s r e q u ir e m o r e c o n d it io n s
T y p ic a lly, c o n t in u it y
c o n d it io n s a r e e x t e n d e d
to
a ll h ig h e r o r d e r s
𝑛 − 2 p o in ts a n d h a v e th e
s a m e 1 s t , 2 n d , 3 r d , e t c ., d e r iv a t iv e s a t 𝑛 − 2 p o in t s
n e ig h b o u r in g
E x tr a
c o n d it io n s
p o ly n o m ia ls to
p o ly n o m ia ls c o n n e c t a t
a r e
z e r o
p r o v id e d
b y
s e ttin g
th e
d e r iv a t iv e s
o f
e d g e
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
In practice
C u b ic p o ly n o m ia ls a r e u s u a lly s m o o t h
e n o u g h
fo r m o s t a p p li-
c a t io n s .
S p lin e
d e fi n i t i o n
m a y
n o t
b e
a p p lic a b le
fo r
s p e c ia l c a s e s
d is c o n t in u it ie s . It m a y b e n e c e s s a r y t o im p le m e n t c u s t o m
lik e
s p lin e
e q u a t i o n w i t h s p e c i a l d e fi n i t i o n s o r m a k e u s e o f a d v a n c e d p a c k a g e s .
63/118
Interpolating polynomials
Interpolating polynomials
S p lin e in t e r p o la t io n
Some math
P r o b le m
D e r iv e
a
s e t o f e q u a t io n s
th a t c a n
b e
u s e d
p a r a m e t e r s fo r a q u a d r a t ic s p lin e a c r o s s
to
6
c a lc u la te
𝑛 p o in ts .
s p lin e
64/118
Interpolating polynomials
Interpolating polynomials
M e th o d
65/118
c o m p a r is o n
Algorithm selection
A lg o r ith m
fo llo w in g
If y o u
s e le c t io n
d e p e n d s o n
is ju s t a s u g g e s t io n :
a r e d e a lin g
If y o u r d a ta is o n
w ith
a n
O t h e r w is e : d iv id e d
T h e
L a g r a n g e
e a s y
to
m e th o d
a la r g e n u m b e r o f d iffe r e n t fa c to r s , th e
m o r e th a n
e v e n ly
s p a c e d
p o in ts : s p lin e s
g r id : N e w t o n
p o ly n o m ia l
d iffe r e n c e p o ly n o m ia l
in te r p o la tin g
u n d e r s ta n d .
2 0
Its
p o ly n o m ia l w a s
o n ly
is t h a t it is e a s ie r t o
a d v a n ta g e
p r o g r a m .
in tr o d u c e d
o v e r
th e
b e c a u s e
d iv id e d
it
is
d iffe r e n c e
Interpolating polynomials
Interpolating polynomials
M e th o d
c o m p a r is o n
Caution
A l l i n t e r p o l a t i n g t e c h n i q u e s d e fi n e a f u n c t i o n t h a t p a s s e s t h r o u g h
e v e r y s in g le o b s e r v e d d a ta p o in t. Y o u s h o u ld n o t d o th is if y o u r
d a ta is n o is y !
66/118
Interpolating polynomials
Interpolating polynomials
M e th o d
c o m p a r is o n
Further reading
C h a p te r
m o r e .
4
in
th e
S e c t io n s
b o o k
c o v e r s
4 .1 – 4 .2
s e r v e
p o la t io n , s e c t io n s 4 .4 – 4 .6
p o la t io n
m e th o d s , a n d
e v e r y th in g
a s
a
g o o d
c o v e r th e
s e c t io n
4 .9
in
th e s e
s lid e s
in t r o d u c t io n
th r e e
to
a n d
in te r-
m a jo r g lo b a l in t e r –
d e s c r ib e s c u b ic s p lin e s .
67/118
Derivatives and integrals
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Derivatives and integrals
B e y o n d
th e
d ir e c t a p p lic a t io n
“ r e a d b e tw e e n
th e ta b le r o w s ” , in te r p o la tin g
a ls o u s e d to d e v e lo p
t ia t io n
a n d
o f in te r p o la tin g
p o ly n o m ia ls to
p o ly n o m ia ls a r e
m e t h o d s fo r t e c h n iq u e s s u c h
in t e g r a t io n .
a s d iffe r e n –
69/118
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Mathematical interpretation
D e r iv a t iv e s a n d
in te g r a ls a r e o fte n
c o n c e p tu a liz e d
g e o m e t r ic a lly
a d e r iv a t iv e is t h e s lo p e o f t h e t a n g e n t lin e a t a g iv e n
a n
in t e g r a l is t h e a r e a u n d e r a s e c t io n
T h is c o n c e p t u a liz a t io n
c a n
b e u s e d
to
o f a c u r v e
d e te r m in e h o w
d e r iv a t iv e o r in t e g r a l
b u t it d o e s n o t e x p la in
w h y
p o in t
e ith e r is u s e fu l
to
c a lc u la te a
70/118
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Physical interpretation
A
d e r iv a t iv e c o r r e s p o n d s t o a r a t e o f c h a n g e , w h ile a n
is a n
a c c u m u la t io n
( t y p ic a lly
o v e r s p a c e o r tim e ) .
T h e s e v a lu e s m a y b e u s e fu l o n
c u la tin g
o th e r s .
in te g r a l
th e ir o w n
o r a s a m e a n s o f c a l-
71/118
Interpolating polynomials
Derivatives and integrals
72/118
B a c k g r o u n d
Rate of change
T h e fl o w
is
r a te (
d ir e c tly
𝑄) o u t o f t h e p i p e
r e la te d
to
th e
r a te
o f
c h a n g e o f fl u i d h e i g h t i n t h e v e s –
H
Q
s e l (
𝐻) :
𝑄=𝐴
v e s s e l
d𝐻
d𝑡
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Rate of change
N o te
th a t
th e
a b o v e
n e c e s s a r ily k n o w
H o w e v e r , fl u i d
fl o w
r a te .
e x p r e s s io n
is
n o t
t h e o r e t ic a l (w e
d o
n o t
t h e r a t e o f c h a n g e i n fl u i d h e i g h t i n a d v a n c e ) .
h e ig h t is
c o n s id e r a b ly
e a s ie r t o
m e a s u r e
th a n
73/118
Interpolating polynomials
Derivatives and integrals
74/118
B a c k g r o u n d
Accumulation
Q
T h e o v e r a l l fl u i d h e i g h t i n t h e v e s –
𝐻) i s d i r e c t l y r e l a t e d t o t h e
fl o w r a t e ( 𝑄) o u t o f t h e p i p e o v e r
s e l (
tim e :
H
𝐻(𝑡) = 𝐻∣𝑡=𝑡 +
0
1
𝐴
v e s s e l
𝑡
∫ 𝑄(𝑡)dt
𝑡0
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Accumulation
If w e
k n o w
th e
fl o w
r a te
o f fl u i d
p r e d i c t t h e h e i g h t o f t h e fl u i d
in
g o in g
in to
th e v e s s e l in
th e
p ip e , w e
a d v a n c e .
c a n
75/118
Interpolating polynomials
Derivatives and integrals
76/118
B a c k g r o u n d
Another example
D e r iv a t iv e s a n d
in te g r a ls a r e a ls o
D iffe r e n t ia t io n
to
c a lc u la t e r e a c t io n
𝑟=
In t e g r a t io n
to
u s e d
fo r m o n ito r in g
r a te s fr o m
r e a c t io n s
c o n c e n t r a t io n
d𝐶
d𝑡
c a lc u la t e c o n c e n t r a t io n
fr o m
𝑡
𝐶(𝑡) = 𝐶0 + ∫ 𝑟dt
𝑡0
r e a c t io n
r a te
d a ta
Interpolating polynomials
Derivatives and integrals
77/118
B a c k g r o u n d
Numerical vs. analytical
It is p o s s ib le to
t y p ic a lly
s o lv e s im p le d e r iv a t iv e s a n d
u s in g
p a tte r n
r e c o g n it io n
( to
in t e g r a ls a n a ly t ic a lly
id e n t ify
s u b s t it u t io n s o r t e c h n iq u e s lik e in t e g r a t io n
N u m e r ic a l
m e th o d s
a r e
o fte n
s im p le r
a n d
p r o b le m s th a t c a n n o t b e s o lv e d
a n a ly t ic a lly
N u m e r ic a l m e t h o d s
u s e d
c a n
a ls o
b e
p o in t s ) w h e r e t h e t r u e fu n c t io n
to
w o r k
is u n k n o w n
u s e fu l v a r ia b le
b y
p a r ts )
a llo w
th e
s o lu t io n
o f
w ith
d a ta
( a
o f
s e r ie s
Interpolating polynomials
Derivatives and integrals
B a c k g r o u n d
Simplifying equations
T h e g e n e r a l d iffe r e n t ia t io n / in t e g r a t io n t e c h n iq u e is a lw a y s t h e
s a m e —
in t e r p o la t e in p u t d a t a in t o a fu n c t io n
r iv a t iv e / in t e g r a l o f t h e fu n c t io n
H o w e v e r, t h is
e q u a t io n
p r o c e s s
fo r c o m m o n
c a n
b e
a s n o r m a l.
d e r iv e d
p r o b le m s .
a n d fi n d t h e d e –
in to
a
s im p le
a lg e b r a ic
78/118
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
79/118
p o in ts
Differentiation
If th e in p u t d a ta
c a lc u la te d
p o in ts a r e e v e n ly
b y fi t t i n g
a N e w to n
s p a c e d , a
p o ly n o m ia l to
d e r iv a t iv e e q u a t io n
p o in ts a r o u n d
(𝑥𝑖 , 𝑓𝑖 )
c a n
(𝑥𝑖 , 𝑓𝑖 ).
b e
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
1st order
R e c a ll th e 1 s t o r d e r N e w to n
p o ly n o m ia l:
𝑃1 (𝑠) = 𝑓𝑖 + 𝑠Δ(1) 𝑓𝑖
𝑠=
W h e r e
𝑥 − 𝑥𝑖
ℎ
ℎ i s t h e s t e p s i z e b e t w e e n 𝑥𝑖 , 𝑥𝑖+1 .
C a lc u la tin g
d𝑃1 (𝑠)
r e q u ir e s u s in g th e c h a in
d𝑥
r u le :
d𝑃1 (𝑠) d𝑃1 (𝑠) d𝑠
=
d𝑥
d𝑠 d𝑥
p o in ts
80/118
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
1st order
T h e tw o
te r m s :
d𝑃1 (𝑠)
d
= ( 𝑓𝑖 + 𝑠Δ(1) 𝑓𝑖 )
d𝑠
d𝑠
= Δ(1) 𝑓𝑖 = 𝑓𝑖+1 − 𝑓𝑖
d𝑠
1
=
d𝑥 ℎ
T o g e th e r :
d𝑃1 (𝑠)
𝑓𝑖+1 − 𝑓𝑖
=
d𝑥
ℎ
p o in ts
81/118
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
p o in ts
Visually
C o m p a r in g
th e e s tim a te a n d
tr u e v a lu e :
(𝑥𝑖 , 𝑓𝑖 )
T h e e s t im a t e is g o o d if t h e fu n c t io n
is s m o o th
a n d th e s te p s iz e is s m a ll.
82/118
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
p o in ts
Higher orders
( 𝑓𝑖+1 − 𝑓𝑖 )/ℎ i s a fi r s t – o r d e r fi n i t e d i f f e r e n c e . T h e s a m e p r o c e s s
c a n
b e u s e d
t o d e fi n e h i g h e r o r d e r fi n i t e d i f f e r e n c e e q u a t i o n s .
83/118
Interpolating polynomials
Derivatives and integrals
D iffe r e n tia tin g
p o in ts
Higher orders
P r o b le m
D e r i v e a fi n i t e d i f f e r e n c e e q u a t i o n
7
fo r t h e d e r iv a t iv e a t a p o in t
𝑥𝑖 u s i n g a 2 n d o r d e r N e w t o n P o l y n o m i a l e q u a t i o n .
84/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
85/118
p o in ts
Integration
If th e
in p u t d a ta
c a lc u la te d
p o in ts
b y fi t t i n g
a r e
e v e n ly
a N e w to n
s p a c e d , a n
p o ly n o m ia l to
(𝑥𝑖 , 𝑓𝑖 )
in t e g r a l e q u a t io n
p o in ts a r o u n d
c a n
(𝑥𝑖 , 𝑓𝑖 ).
b e
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
1st order
R e c a ll th e s a m e 1 s t o r d e r N e w to n
p o ly n o m ia l:
𝑃1 (𝑠) = 𝑓𝑖 + 𝑠Δ(1) 𝑓𝑖
𝑠=
W h e r e
𝑥 − 𝑥𝑖
ℎ
ℎ i s t h e s t e p s i z e b e t w e e n 𝑥𝑖 , 𝑥𝑖+1 .
U s e th e c h a in
r u le to
g o
fr o m
𝑥 t o 𝑠:
𝑥𝑖+1
𝐼 = ∫ 𝑃1 (𝑠)d𝑥
𝑥𝑖
p o in ts
86/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
1st order
F ir s t, c o n v e r t
𝑥to 𝑠
d𝑠
1
=
d𝑥 ℎ
d𝑥 = ℎ d𝑠
A n d
d o
n o t fo r g e t a b o u t t h e lim it s o f in t e g r a t io n :
1
𝐼 = ∫ 𝑃1 (𝑠)ℎ d𝑠
0
W
ith
a 1 s t o r d e r e s tim a te , u s e o n ly tw o
p o in ts
𝑥𝑖 , 𝑥𝑖+1 , o r 𝑠 = 0, 1.
87/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
1st order
1
𝐼 = ∫ 𝑃1 (𝑠)ℎ d𝑠
0
1
= ℎ ∫ 𝑓𝑖 + 𝑠Δ(1) 𝑓𝑖 d𝑠
0
1
∣
𝑠2 (1)
= ℎ ( 𝑓𝑖 𝑠 + Δ 𝑓𝑖 ) ∣∣
2
∣
𝑠=0
1
= ℎ ( 𝑓𝑖 + Δ(1) 𝑓𝑖 )
2
= ℎ ( 𝑓𝑖 +
=
𝑓𝑖+1 − 𝑓𝑖
)
2
ℎ( 𝑓𝑖 + 𝑓𝑖+1 )
2
p o in ts
88/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
Visually
C o m p a r in g
th e e s tim a te a n d
tr u e v a lu e :
(𝑥𝑖 , 𝑓𝑖 )
T h e e s t im a t e is g o o d if t h e fu n c t io n
is s m o o th
a n d th e s te p s iz e is s m a ll.
89/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
Global estimate
A
s in g le in t e g r a l is t y p ic a lly
c a lc u la te d
o v e r a ll th e p o in ts :
90/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
Global estimate
T o
in te g r a te o v e r
𝑛 p o in ts , s u m o v e r a ll 𝑛 − 1 s u b – in te r v a ls :
𝑛−1
𝐼 = ∑ 𝐼𝑖
𝑖=1
B u t t h e f o r m u l a a l l o w s s o m e s i m p l i fi c a t i o n :
𝑛−1
ℎ( 𝑓𝑖 + 𝑓𝑖+1 )
2
𝑖=1
𝐼=∑
𝑛−1
ℎ
= ( 𝑓1 + ∑ 2 𝑓𝑖 + 𝑓𝑛 )
2
𝑖=2
91/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
Higher orders
ℎ( 𝑓𝑖+1 + 𝑓𝑖 )/2 i s a fi r s t – o r d e r N e w t o n – C o t e s e q u a t i o n ( o t h e r w is e
k n o w n
u s e d
to
a s
th e
t r a p e z o id
r u le ) .
c a n
b e
d e fi n e h i g h e r o r d e r N e w t o n – C o t e s e q u a t i o n s ( s u c h
a s
t h e S i m p s o n ’s r u l e o r S i m p s o n ’s 3 / 8
T h e
s a m e
r u le ) .
p r o c e s s
92/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
93/118
p o in ts
Higher orders
P r o b le m
D e r iv e
a
N e w to n – C o te s
p o in ts u s in g
a 2 n d
e q u a t io n
o r d e r N e w to n
fo r
a
8
g lo b a l in te g r a l o v e r
P o ly n o m ia l e q u a t io n .
𝑛
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
p o in ts
Example
P r o b le m
G iv e n
th e fo llo w in g
n o m ia l to
e s tim a te
in te g r a l b e tw e e n
s e t o f d a ta , u s e a 2 n d
th e
d e r iv a t iv e
a t
9
o r d e r N e w to n
p o ly –
𝑥 = 0.5 a n d t h e g l o b a l
𝑥 = 0, 1
x
0.00
0.25
0.50
0.75
1.00
y
1.00
1.28
1.65
2.12
2.72
C o m p a r e th e e s tim a te s to
t h e t r u e v a lu e s g iv e n
th a t
𝑦 = 𝑒𝑥 .
94/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
95/118
fu n c t io n s
Integrating functions
W h e n
tr y in g
u n d e r ly in g
H o w e v e r,
k n o w n
a d e r iv a t iv e o r in t e g r a l fr o m
fu n c t io n
w e
m a y
a s e t o f p o in ts , th e
is u n k n o w n
a ls o
b e
in te r e s te d
in
fi n d i n g
th e
in te g r a l
o f
a
fu n c t io n
m o r e
fi n d
t o fi n d
c o m m o n
fo r
in te g r a ls
a s
d e r iv a t iv e s
a r e
r e la t iv e ly
e a s y
to
a n a ly t ic a lly
R e c a ll th e p r o b le m
fr o m
t o p ic 1 t h a t c o u ld n o t b e s o lv e d a n a ly t ic a lly :
𝑏
2
∫ 𝑒−𝑥 d𝑥
𝑎
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Integrating functions
N u m e r ic a lly
in te g r a tin g
S u g g e s t a m e th o d
to
fi n d
fu n c t io n s is s im ila r t o
t h e p r e v io u s ly
𝑏
2
∫ 𝑒−𝑥 d𝑥
𝑎
p o in ts .
m e n t io n e d
in te g r a l:
96/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
97/118
fu n c t io n s
Beyond points
If th e
fu n c t io n
is
k n o w n , it is
s e r ie s o f p o in t s a n d
s te p
d ir e c tly
s iz e o r o r d e r c a n
e a s y
a fi x e d
fu n c t io n
v a lu e s
a t a
b e v a r ie d
to
e s tim a te a c c u r a c y
e n a b le s a b e tte r e s tim a te th a n
p o s –
s e t o f p o in ts
G a u s s – L e g e n d r e
p o in ts to
c a lc u la te
a p p ly t h e N e w t o n – C o t e s e q u a t io n s
H o w e v e r, k n o w in g t h e f u n c t io n
s ib le w ith
to
q u a d r a tu r e
c a n
b e
u s e d
to
o p tim iz e
w h ic h
c h o o s e (o u t s id e t h e s c o p e o f t h e c o u r s e )
R ic h a r d s o n
e x t r a p o la t io n
r a te e s tim a te fr o m
tw o
c a n
b e
u s e d
e s tim a te s w ith
to
g e n e r a te
a
m o r e
d iffe r e n t s te p
s iz e s
a c c u –
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Beyond points
B y
le v e r a g in g
t iv e ”
h o w
t r u n c a t io n
m e th o d s a r e a b le to
e r r o r w o r k s , s o – c a lle d
g e t b e tte r e s tim a te s w ith
“ a d a p –
le s s w o r k .
98/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
99/118
fu n c t io n s
Taylor series and truncation
T h e T a y lo r s e r ie s o ffe r s a c o n v e n ie n t in t r o d u c t io n
to
t r u n c a t io n
e r r o r.
R e c a ll t h e T a y lo r s e r ie s fo r m u la t io n :
1
𝑓″ (𝑥0 )(𝑥 − 𝑥0 )2 + …
2!
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓′ (𝑥0 )(𝑥 − 𝑥0 ) +
W h e r e th e e llip s e s c a n
b e r e p r e s e n te d
b y
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓′ (𝑥0 )(𝑥 − 𝑥0 ) +
a r e m a in d e r te r m :
1
𝑓″ (𝑥0 )(𝑥 − 𝑥0 )2 + 𝑅3
2!
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
100/118
fu n c t io n s
Taylor series and truncation
It c a n
b e s h o w n
th a t th e r e m a in d e r c a n
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓′ (𝑥0 )(𝑥 − 𝑥0 ) +
w h e r e
b e d e fi n e d
a s :
1
1
𝑓″ (𝑥0 )(𝑥 − 𝑥0 )2 +
𝑓‴ (𝜉)(𝑥 − 𝑥0 )3
2!
3!
𝜉 i s s o m e v a l u e b e t w e e n 𝑥0 , 𝑥.
E s s e n tia lly, th e m a x im u m
𝑅3 ≤ max (
p o s s ib le e r r o r is :
1
𝑓‴ (𝜉)(𝑥 − 𝑥0 )3 )
3!
𝜉 ∈ (𝑥0 , 𝑥)
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
101/118
fu n c t io n s
Big O notation
R e c a ll th e
id e a
o f a
s te p
s iz e
(
ℎ) f r o m
in t e r p o la t io n .
h e r e a s w e ll t o r e w r it e t h e T a y lo r s e r ie s a s a n
o n
th e e s tim a te a t
It c a n
e s tim a te o f
b e
a p p lie d
𝑓(𝑥 + ℎ) b a s e d
𝑓(𝑥), a s t e p ℎ a w a y :
ℎ2
ℎ3
𝑓(𝑥 + ℎ) = 𝑓(𝑥) + ℎ 𝑓′ (𝑥) +
𝑓″ (𝑥) +
𝑓‴ (𝜉)
2!
3!
S in c e
𝑓‴ (𝜉)/3! i s a s c a l a r t e r m t h a t m o d i fi e s ℎ3 , i t i s s i m p l i fi e d a s :
ℎ2
𝑓(𝑥 + ℎ) = 𝑓(𝑥) + ℎ 𝑓′ (𝑥) +
𝑓″ (𝑥) + 𝑂(ℎ3 )
2!
w h ic h
ju s t m e a n s th a t if th e s te p
th e e r r o r w ill d e c r e a s e 8 – fo ld
(o r
s iz e is d e c r e a s e d
23 ) .
2 – fo ld , fo r e x a m p le ,
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Why do we care?
A lth o u g h
s e e m
fi n d i n g
s o m e
a r b itr a r y
p o in tle s s , u n d e r s ta n d in g
r e la t io n
h o w
fo r
th e
e r r o r
e r r o r c h a n g e s a s a
m a y
fu n c –
ℎ e n a b le s m o r e a c c u r a te e s tim a te s .
t io n
o f
T h e
fo llo w in g
e s tim a te u s in g
s lid e s
w ill d e m o n s tr a te
h o w
to
g e t
a s im p le T a y lo r s e r ie s e x p a n s io n .
th is
b e tte r
102/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Richardson extrapolation
T a k e a 1 s t o r d e r T a y lo r s e r ie s e x p a n s io n :
ℎ2
ℎ3
𝑓(𝑥 + ℎ) = 𝑓(𝑥) + ℎ 𝑓′ (𝑥) + 𝑓″ (𝑥) + 𝑓‴ (𝑥) + …
2!
3!
A n d
u s e it to
e s t im a t e t h e d e r iv a t iv e
𝑓′ (𝑥):
𝑓(𝑥 + ℎ) − 𝑓(𝑥) ℎ
ℎ2
𝑓′ (𝑥) =
− 𝑓″ (𝑥) − 𝑓‴ (𝑥) − …
2!
3!
ℎ
103/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Richardson extrapolation
T h e fo c u s h e r e is o n
ℎ s o r e n a m e t h e 𝑓″ (𝑥) a n d 𝑓‴ (𝑥) t e r m s :
𝑓′ (𝑥) =
In
𝑓(𝑥 + ℎ) − 𝑓(𝑥)
− ℎ𝑟2 − ℎ2 𝑟3 − …
ℎ
fa c t, r e n a m e th e o th e r te r m s a s w e ll:
𝑓′ (𝑥) = 𝐴(ℎ) − ℎ𝑟2 − ℎ2 𝑟3 − …
w h e r e th e s o le fo c u s is o n
ℎ.
104/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Richardson extrapolation
S ta r tin g
w ith :
𝑓′ (𝑥) = 𝐴(ℎ) − ℎ𝑟2 − ℎ2 𝑟3 − …
W h a t h a p p e n s if th e s te p
s iz e is h a lv e d ?
ℎ
ℎ
ℎ2
𝑓′ (𝑥) = 𝐴 ( ) − 𝑟2 − 𝑟3 − …
2
2
4
R e m e m b e r t h a t a ll t h e o t h e r p a r t s o f t h e e q u a t io n
s ta y th e s a m e .
105/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Richardson extrapolation
C o m p a r e th e tw o
e s tim a te s :
ℎ
ℎ
ℎ2
𝑓′ (𝑥) = 𝐴 ( ) − 𝑟2 − 𝑟3 − …
2
2
4
𝑓′ (𝑥) = 𝐴(ℎ) − ℎ𝑟2 − ℎ2 𝑟3 − …
N o w
m u l t i p l y t h e fi r s t e q u a t i o n
b y
2
a n d
s u b tr a c t th e s e c o n d :
𝑓′ (𝑥) = 2𝐴(ℎ/2) − 𝐴(ℎ) − (ℎ2 /2 + ℎ2 )𝑟3 − …
106/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Richardson extrapolation
S o w h a t h a p p e n e d ?
T h e r e is n o w
a n o th e r e s tim a te fo r
𝑓′ (𝑥):
𝑓′ (𝑥) = 2𝐴(ℎ/2) − 𝐴(ℎ) − (ℎ2 /2 + ℎ2 )𝑟3 − …
B u t w ith
r e d u c e d
e r r o r :
𝑓′ (𝑥) = 2𝐴(ℎ/2) − 𝐴(ℎ) + 𝑂(ℎ2 )
T h e e r r o r te r m
w e n t fr o m
𝑂(ℎ) t o 𝑂(ℎ2 )!
107/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
More generally
K n o w in g th e e r r o r s tr u c tu r e m a k e s it p o s s ib le to c o m b in e m u ltip le p o o r e s tim a te s to
in c r e a s e a c c u r a c y !
108/118
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
109/118
fu n c t io n s
Romberg integration
R ic h a r d s o n
b o th
e x t r a p o la t io n
d e r iv a t iv e s a n d
T h e m o s t c o m m o n
c a n
b e
u s e d
e q u a lly
w e ll
fo r
c a lc u la tin g
in te g r a ls
a p p lic a t io n
is k n o w n
in te r v a l is in te g r a te d
in t e g r a t io n
1 .
a fu n c t io n
2 .
th e in te r v a l is th e n
3 .
th e tw o
4 .
fu r t h e r s u b in t e r v a ls a r e s p lit u n t il t h e a p p r o x im a t io n
s p lit in
tw o
u s in g
a s R o m b e r g
a n d
e s tim a te s a r e c o m b in e d
to
t h e t r a p e z o id
a n e w
r u le
e s tim a te is c a lc u la te d
g e t a h ig h e r o r d e r e s t im a t e
c o n v e r g e s
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
110/118
fu n c t io n s
Romberg integration
T h e t r a p e z o id
r u le e r r o r is
𝑂(ℎ2 ) a n d b a s e d o n t h e s t r u c t u r e o f t h a t e r –
𝑂(ℎ2 ) e s t i m a t e s w i t h d i f f e r e n t s t e p s i z e s c a n b e u s e d t o g e n 4
e r a t e a n 𝑂(ℎ ) e s t i m a t e :
r o r, t w o
𝐴4 =
4𝐴2 (ℎ/2) − 𝐴2 (ℎ)
3
M o r e g e n e r a lly, tw o e s tim a te s w ith o r d e r
a n
im p r o v e d
e s tim a te o f o r d e r
𝑘c a n b e c o m b in e d to g e n e r a te
𝑘 + 2:
2𝑘 𝐴𝑘 (ℎ/2) − 𝐴𝑘 (ℎ)
𝐴𝑘+2 =
2𝑘 − 1
Interpolating polynomials
Derivatives and integrals
In te g r a tin g
fu n c t io n s
Example
P r o b le m
P e r fo r m
3
it e r a t io n s o f R o m b e r g
in t e g r a t io n
to
fi n d
1 0
th e
in te –
𝑒𝑥 f r o m 0 t o 1 . C o m p a r e t h e e s t i m a t e s t o t h e t r u e v a l u e
1
0
o f 𝑒 − 𝑒
= 1.7182.
g r a l o f
111/118
Interpolating polynomials
Derivatives and integrals
M e th o d
112/118
c o m p a r is o n
Algorithm selection
A lg o r ith m
fo llo w in g
s e le c t io n
In te g r a ls fr o m
C a lc u la tin g
th a t
a la r g e n u m b e r o f d iffe r e n t fa c to r s , th e
is ju s t a s u g g e s t io n :
D e r iv a t iv e s fr o m
N o te
d e p e n d s o n
d a ta o n
a n
a n
e v e n
e v e n
g r i d : fi n i t e – d i f f e r e n c e e q u a t i o n s
g r id : N e w t o n – C o t e s e q u a t io n s
th e in te g r a l o f a k n o w n
th e s e
p r o c e s s is to
d a ta o n
o p t io n s
d o
fi t a f u n c t i o n
o f t h a t fu n c t io n .
to
n o t
c o v e r
fu n c t io n : R o m b e r g
in t e g r a t io n
a ll
T h e
p o s s ib le
y o u r d a ta a n d
c a s e s .
g e n e r a l
t a k e t h e d e r iv a t iv e / in t e g r a l
Interpolating polynomials
Derivatives and integrals
M e th o d
c o m p a r is o n
Further reading
T h e b o o k s e p a r a t e s d iffe r e n t ia t io n
te r s 5
in g
a n d
a n d in t e g r a t io n
6 , w h e r e a s t h e s lid e s t r y t o
s im ila r it ie s .
t io n s fo r t h e t w o
S e c t io n
a n d
6 .1
h ig h lig h t t h e o v e r a r c h o ffe r
s e p a r a te
t o p ic s . F in it e d iffe r e n c e a n d
e q u a t io n s a r e c o v e r e d
s e e s e c t io n s 6 .4
5 .1
a n d
in
6 .5 .
5 .3
a n d
in to C h a p –
in tr o d u c –
N e w to n – C o a te s
6 .3 . F o r a d a p t i v e i n t e g r a t i o n ,
113/118
Final thoughts
Interpolating polynomials
Final thoughts
115/118
Interpolation is the core of numerical methods
A n a ly t ic a l
m e th o d s
a r e
g e n e r a lly
n u m e r ic a l m e t h o d s w o r k
o n
c o n tin u o u s
w h e r e a s
m o s t
d is c r e t e d a t a . In t e r p o la t io n
fu n –
d a m e n t a lly s e r v e s t o c o n v e r t d is c r e t e d a t a in t o fu n c t io n a l fo r m .
Y o u
w ill c o m e
a c r o s s
m a n y
d iffe r e n t n u m e r ic a l “ r u le s ” ,
m o s t o f t h e s e a r e d e r iv e d d ir e c t ly fr o m
b u t
in t e r p o la t io n . It is n e c –
e s s a r y t o d e v e lo p a g o o d u n d e r s t a n d in g o f in t e r p o la t io n t o u n d e r s ta n d th e p r in c ip le s b e h in d o th e r ta s k s lik e c a lc u la tin g d e r iv a t iv e s a n d
in te g r a ls .
Interpolating polynomials
Final thoughts
116/118
Interpolation algorithm selection
A lg o r ith m
fo llo w in g
If y o u
s e le c t io n
d e p e n d s o n
is ju s t a s u g g e s t io n :
a r e d e a lin g
If y o u r d a ta is o n
w ith
a n
O t h e r w is e : d iv id e d
T h e
L a g r a n g e
e a s y
to
m e th o d
a la r g e n u m b e r o f d iffe r e n t fa c to r s , th e
m o r e th a n
e v e n ly
s p a c e d
p o in ts : s p lin e s
g r id : N e w t o n
p o ly n o m ia l
d iffe r e n c e p o ly n o m ia l
in te r p o la tin g
u n d e r s ta n d .
2 0
Its
p o ly n o m ia l w a s
o n ly
is t h a t it is e a s ie r t o
a d v a n ta g e
p r o g r a m .
in tr o d u c e d
o v e r
th e
b e c a u s e
d iv id e d
it
is
d iffe r e n c e
Interpolating polynomials
Final thoughts
117/118
Differentiation/integration algorithm selection
A lg o r ith m
fo llo w in g
s e le c t io n
In te g r a ls fr o m
C a lc u la tin g
th a t
a la r g e n u m b e r o f d iffe r e n t fa c to r s , th e
is ju s t a s u g g e s t io n :
D e r iv a t iv e s fr o m
N o te
d e p e n d s o n
d a ta o n
a n
a n
e v e n
e v e n
g r i d : fi n i t e – d i f f e r e n c e e q u a t i o n s
g r id : N e w t o n – C o t e s e q u a t io n s
th e in te g r a l o f a k n o w n
th e s e
p r o c e s s is to
d a ta o n
o p t io n s
d o
fi t a f u n c t i o n
o f t h a t fu n c t io n .
to
n o t
c o v e r
fu n c t io n : R o m b e r g
in t e g r a t io n
a ll
T h e
p o s s ib le
y o u r d a ta a n d
c a s e s .
g e n e r a l
t a k e t h e d e r iv a t iv e / in t e g r a l
Interpolating polynomials
Final thoughts
Caution
A l l i n t e r p o l a t i n g t e c h n i q u e s d e fi n e a f u n c t i o n t h a t p a s s e s t h r o u g h
e v e r y s in g le o b s e r v e d d a ta p o in t. Y o u s h o u ld n o t d o th is if y o u r
d a ta is n o is y !
118/118