Docsity

Splines: Interpolating Smoothly with Piecewise Polynomials - Prof. Luke Olson, Study notes of Computer Science

Partial preview of the text

Download Splines: Interpolating Smoothly with Piecewise Polynomials - Prof. Luke Olson and more Study notes Computer Science in PDF only on Docsity!

Lecture 18

Splines

L. Olson

Department of Computer Science

University of Illinois at Urbana-Champaign

November 1, 2006

Today

finish up quadrature

start splines

Quadrature

40K tetrahedrons.

Quadrature

40K tetrahedrons.

need to integrate a function f (x) over each tet Ωi:

Ωi

f (x) dx

needs quadrature

map the integration to a reference tetrahedron

perform Gauss Quadrature using (n + 1 )(n + 2 )(n + 3 )/ 6 quadrature

points (where n is the 1-D number of points).

f (x) is often a product of degree m Lagrange interpolating polynomials

...needs large n

results in # of tetrahedrons × n

3 / 6 function evaluations

Piecewise Polynomial

A function f (x) is considered a piecewise polynomial on [a, b] if there exists a

(finite) partition P of [a, b] such that f (x) is a polynomial on each [ti, ti+ 1 ] ∈ P.

Example

f (x) =

x

3 x ∈ [ 0 , 1 ]

x x ∈ ( 1 , 2 )

3 x ∈ [ 2 , 3 ]

What do we want?

we would like the piecewise polynomial to do two things

1 interpolate (or be close to) some set of data points

2 look nice (smooth)

one option is called a spline

degree 1 spline

definition

A function S(x) is a spline of degree 1 if:

1 The domain of S(x) is an interval [a, b]

2 S(x) is continuous on [a, b]

3 There is a partition a = t 0 < t 1 < · · · < tn = b such that S(x) is linear on

each subinterval [ti, ti+ 1 ].

Example

S(x) =

x x ∈ [− 1 , 0 ]

1 x ∈ ( 0 , 1 )

2 x − 2 x ∈ [ 1 , 2 ]

degree 1 spline

Given data t 0

,... , t n

and y 0

,... , y n

, how do we form a spline? We need two

things to hold in the interval [a, b] = [t 0 , tn]:

1 S(ti) = yi for i = 0 ,... , n

2 Si(x) = aix + bi for i = 0 ,... , n

Write Si(x) in point-slope form

Si(x) = yi + mi(x − ti)

= yi +

y i+ 1

− y i

ti+ 1 − ti

(x − ti)

Done.

degree 1 spline

Interesting:

input n + 1 data points t 0

,... , t n

,y 0

,... , y n

in each interval we have S i

(x) = a i

x + b i

2 unknowns per interval [t i

, t i+ 1

]

or 2 n total unknowns

the n + 1 pieces of input contraints S(t i

) = y i

gives 2 constraints per

interval

or 2 n total constraints

degree 2 splines

definition

A function S(x) is a spline of degree 2 if:

1 The domain of S(x) is an interval [a, b]

2 S(x) is continuous on [a, b]

3 S

′ (x) is continuous on [a, b]

4 There is a partition a = t 0

< t 1

< · · · < t n

= b such that S(x) is quadratic

on each subinterval [t i

, t i+ 1

].

degree 2 splines

3 unknowns in each interval

3 n total unknowns

2 n constraints for matching up the input data (2 per interval)

n − 1 interior points require continuity of the derivative:

S

′

i

(x i+ 1

) = S

′

i+ 1

(x i+ 1

but this is just n − 1 constraints

total of 3 n − 1 constraints

extra consraint: S

′ (x 0

) =given, for example.

Next time...

degree 3 splines: cubic splines

most common

full algorithm

the B-splines/Bezier Curves