Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines...
Transcript of Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines...
![Page 1: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/1.jpg)
IntroductionInterpolation
Splines
Mathematical ModellingLecture 5 – Interpolation
Phil [email protected]
Phil Hasnip Mathematical Modelling
![Page 2: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/2.jpg)
IntroductionInterpolation
Splines
Overview of Course
Model construction −→ dimensional analysisExperimental input −→ fittingFinding a ‘best’ answer −→ optimisationTools for constructing and manipulating models −→networks, differential equations, integrationTools for constructing and simulating models −→randomnessReal world difficulties −→ chaos and fractals
A First Course in Mathematical Modeling by Giordano, Weir &Fox, pub. Brooks/Cole. Today we’re in chapter 4.
Phil Hasnip Mathematical Modelling
![Page 3: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/3.jpg)
IntroductionInterpolation
Splines
Aim
The difference between these two aims is one of emphasis:
Model fitting: we expect some scatter in the experimentaldata, we want the best model of a given form – ‘theorydriven’Model interpolation: the existing data is good, model isless important – ‘data driven’
Today we’ll be focussing on the second aim: interpolation.
Phil Hasnip Mathematical Modelling
![Page 4: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/4.jpg)
IntroductionInterpolation
Splines
Interpolation
Basic problem is that we have some good output data forvarious experimental inputs, and we want a good estimate ofthe output for some similar inputs.
Phil Hasnip Mathematical Modelling
![Page 5: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/5.jpg)
IntroductionInterpolation
Splines
One-term models
If we have a simple model with one term, then we cantransform the data to ‘linearise’ it.
E.g. y = Aebx ⇒ ln y = ln A + bx
Plot ln(y) against x , and end up with a straight(-ish) line –simple to interpolate.
Phil Hasnip Mathematical Modelling
![Page 6: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/6.jpg)
IntroductionInterpolation
Splines
Example
Another example,
y = Ax2
⇒√
y =√
Ax
Plot√
y against x , and end up with a straight(-ish) line – simpleto interpolate.
Phil Hasnip Mathematical Modelling
![Page 7: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/7.jpg)
IntroductionInterpolation
Splines
One-term models
What do these transformations do? Taking y = x as ourreference:
y = x2 curves up, above and away from the line. Thetransformation
√y = x bends the curve back onto the
straight line.y =
√x curves down, below and away from the line. The
transformation y2 = x bends the curve back onto thestraight line.
There is a ladder of such transformations that rank them inorder of how much ‘bend’ they undo.
Phil Hasnip Mathematical Modelling
![Page 8: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/8.jpg)
IntroductionInterpolation
Splines
Ladder of transformations
ey
yn (n > 2)y2
y no change√
yn√
y (n > 2)ln y− 1√
y
− 1y
Phil Hasnip Mathematical Modelling
![Page 9: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/9.jpg)
IntroductionInterpolation
Splines
Transformations
These transformations can work well when there is a singledominant term. Their simple form means easy analysis.
Unfortunately their simple form means they are often unable tocapture key features −→ need a multi-term model.
Phil Hasnip Mathematical Modelling
![Page 10: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/10.jpg)
IntroductionInterpolation
Splines
Multi-term models
Polynomials are an obvious next-step.
We know (N+1) data points can be fitted exactly with (at most)an Nth-order polynormial.
Easiest expression is the Lagrangian form.
Phil Hasnip Mathematical Modelling
![Page 11: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/11.jpg)
IntroductionInterpolation
Splines
Lagrangian form polynomials
Suppose our data points are labelled (x0, y0) , . . . , (xN , yN).Then an Nth order polynomial of the form
PN(x) = y0L0(x) + y1L1(x) + . . . + yNLN(x)
is guaranteed to fit all the data, where
Lk (x) =(x − x0) . . . (x − xk−1) (x − xk+1) . . . (x − xN)
(xk − x0) . . . (xk − xk−1) (xk − xk+1) . . . (xk − xN)
so PN(xk ) = yk and χ2 = 0.
Phil Hasnip Mathematical Modelling
![Page 12: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/12.jpg)
IntroductionInterpolation
Splines
Polynomials
Easy to integrate and differentiate, but they do have problems...
Phil Hasnip Mathematical Modelling
![Page 13: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/13.jpg)
IntroductionInterpolation
Splines
Oscillations
Phil Hasnip Mathematical Modelling
![Page 14: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/14.jpg)
IntroductionInterpolation
Splines
Sensitivity
Phil Hasnip Mathematical Modelling
![Page 15: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/15.jpg)
IntroductionInterpolation
Splines
Model fitting
How can we eliminate these oscillations and sensitivity ofcoefficients?
Smooth data points – use lower order polynomialCalculate χ2 and use model fitting
Phil Hasnip Mathematical Modelling
![Page 16: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/16.jpg)
IntroductionInterpolation
Splines
Splines
There is an alternative to all this polynomial fitting −→ splines.
We represent the behaviour separately in between each pair ofdata points, and fit it piecewise.
Phil Hasnip Mathematical Modelling
![Page 17: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/17.jpg)
IntroductionInterpolation
Splines
Linear splines
Phil Hasnip Mathematical Modelling
![Page 18: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/18.jpg)
IntroductionInterpolation
Splines
Linear splines
Linear splines are effectively what we’re using when we dolinear interpolation. Between points (xk , yk ) and (xk+1, yk+1) werepresent the data as a linear spline Sk (x):
Sk (x) = ak + bkx
In fact:
Sk (x) = yk +
(yk+1 − yk
xk+1 − xk
)(x − xk )
Phil Hasnip Mathematical Modelling
![Page 19: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/19.jpg)
IntroductionInterpolation
Splines
Cubic splines
Linear splines are easy to use, but they give a very jagged fit. Abetter choice is cubic splines.
This is just the same idea as before, but because cubics havetwo extra parameters we can add two extra conditions:
First derivative of Sk+1 matches Sk at x = xk+1 (sameslope)Second derivative of Sk+1 matches Sk at x = xk+1 (samecurvature)
Phil Hasnip Mathematical Modelling
![Page 20: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/20.jpg)
IntroductionInterpolation
Splines
Boundary conditions
At the end points we now have some choice, since there are noadjacent splines to match – we have to choose some boundaryconditions. Either:
Natural spline assume curvature is zero at end points. Thisis the most common choice.Clamped spline assume some given slope at end points.
Phil Hasnip Mathematical Modelling
![Page 21: Mathematical Modelling Lecture 5 -- Interpolationpjh503/mathematical... · Interpolation Splines Aim The difference between these two aims is one of emphasis: Model fitting: we expect](https://reader035.fdocuments.us/reader035/viewer/2022063012/5fc895b36b8b8e17ee45ce64/html5/thumbnails/21.jpg)
IntroductionInterpolation
Splines
Summary
When we have good experimental data but little idea of asuitable model...
Ladder of Transformations – use to guess a simpleone-term modelPolynomials – multi-term, but problems with:
OscillationsSensitivity
Often better to use a low-order polynomial and fit.Splines
Linear – linear interpolation between data pointsCubic – smoother fit; natural or clamped? Need to thinkabout boundary conditions
Phil Hasnip Mathematical Modelling