Lecture 22 Flashcards
Interpolation VS data fitting
Interpolation: we want a linear combination of basis functions s.t. it passes through each data points (1 unique solution, m points - m basis functions)
Least squares: we have a given model, we want parameters s.t. it fits the best (lot of points, noise) - often useful to find a function to integrate/derivate
Interpolation
Given (ti,yi), find f s.t. f(ti)=yi (interpolant or interpolation function)
Basis functions
A set of elements in a vector space V is a basis if:
- they’re lin independent
- every element of V can be written as a linear combination of the basis elements
V=set of functions f(t)=at+b, appropriate basis function? {1,0},{0,1} {1, 0} {1, x} {0, x}
f(t) = a.ɸ1(t) + b.ɸ2(t)
(ɸ1(t) = t, ɸ2(t) = 1)
So: {1, x}
Interpolation function
f(t) = Σ_{j=0}^{n-1} xj.ɸj(t) xj : coefficients ɸj : basis functions 1) Select the basis functions 2) Find the coefficients s.t f(ti)=yi for all i
Interpolation matrix form (general Vendermonde matrix)
Ax = y [[ɸ0(t0) ɸ1(t0) ... ɸn-1(t0)] ... [ɸ0(tn-1) ... ɸn-1(tn-1)]] (mxn, each column corresponds to a basis function > full rank matrix, each row corresponds to a data point) x [[x0], ..., [xn-1]] = [[y0], ..., [ym-1]]
Interpolation dimensions of A
- m>n then data fitting (more eq than unknowns, overdetermined)
- m=n then unique solution (same number of points/basis functions)
- m
Interpolation with monomials
{1, t, t^2, …}, i.e. ɸj(t)=t^j (j=0,..,n-1 & m=n)
f(t) = Σ_{j=0}^{n-1} xj.t^j = p_{n-1}(t) (polynomial of degree n-1, n coefficients)
Ax = y
[[1 t0 t0^2 … t0^n-1], …, [1 tn-1 tn-1^2 … tn-1^n-1]] [[x0], …, [xn]] = [[y0], …,[yn]]
How many interpolants of degree at most (n-1) can be found to pass through n points?
1 (n functions, from 0 to n-1, n datapoint needed to obtain unique interpolation)
If we use different polynomial basis functions (not monomial) whose highest degree is n-1 (n points), we might obtain a different interpolating function
False
Cost interpolate and get new points
Solve O(n^3), but n small. New points n^2 (matrix vector mult)
Error in interpolation
If ti are equally spaced on an interval of length h and f(t) is sufficiently smooth:
error = O(h^n) = O(h^{degree+1})
error = |f(t) - pn-1(t)| (0 at points ti)
Using 4 equispaced interpolation nodes, which of these functions would be interpolated exactly with monomial basis functions? A) f(x) = 3x^3+4x^2 B) f(x) = sin(x) C) f(x) = 3 D) f(x) = 5x^4+6x+7
4 nodes, at most we can interpolate p3(t) = x0 + x1t + x2t^2 + x3t^3
So A and C.
We compute p5(t) for the interval [-1,1] and obtain an error ~ 10^{-1}
what error if interval reduced to [-.5,.5]?
0.0015
Integrals using interpolants
Int sum(0>n-1) xj.t^j = sum(0>n-1)xj Int t^j = sum(0>n-1) xj t^{j+1}/(j+1)