1/26
Looks like no tags are added yet.
Interpolation (definition)
Method to estimate unknown function values between known, nearby discrete data points (e.g., from measurements).
Nearest neighbor interpolation (idea & drawback)
Trivial "best guess": pick the value of the closest known data point. Rarely used in 1D because the error is generally too large.
Linear interpolation (how it works)
Divides data into segments between pairs of neighboring supporting points and connects each pair with a straight line (y = mx + b).
Assumptions for 1D linear interpolation
Sorted arrays where x is strictly monotonically increasing; spacing (Δx) can be arbitrary/non-uniform.
Main drawback of linear interpolation (continuous vs. smooth)
The resulting function is continuous (no jumps), but generally not smooth (sharp corners where the slope jumps at data points).
Smoothness classes (C^0 vs. C^1 vs. C^2)
C^0: continuous function (no jumps). C^1: continuous 1st derivative (no sharp corners). C^2: continuous 2nd derivative (smooth curvature).
Polynomial Interpolation Theorem
Given n distinct data points, a unique polynomial of degree n - 1 can be constructed that passes smoothly through all points.
3 ways to obtain polynomial interpolation coefficients
1) Vandermonde matrix (linear system), 2) Lagrange polynomials, 3) Newton polynomials.
What is Runge's phenomenon?
Strong oscillations near the boundaries of an interval when using high-degree polynomial interpolation on equidistant sample points.
Why avoid high-order polynomial interpolation?
It is numerically unstable and prone to large boundary oscillations (Runge's phenomenon); piecewise methods like splines are usually better.
Cubic spline interpolation (definition & main advantage)
Interpolation using piecewise cubic (degree-3) polynomials on each interval. Produces a smooth curve while avoiding Runge's phenomenon.
How smooth is a cubic spline?
C^2 smooth: the function, its 1st derivative (slope), and its 2nd derivative (curvature) are all continuous across data points.
Conceptually, how are cubic spline coefficients derived?
Rewrite each cubic segment using unknown 2nd derivatives M_i, enforce interpolation and C^1/C^2 continuity at inner points, add boundary conditions, and solve the linear system for M_i.
Natural boundary conditions (natural cubic splines)
Setting the 2nd derivative to zero at both endpoints (M_0 = 0, M_N = 0). It is the easiest way to supply the 2 missing equations at the ends.
Matrix structure of cubic splines & why it matters
The linear equation system is tridiagonal (only the main diagonal and its 2 neighbors are non-zero), so banded solvers (e.g., scipy.linalg.solve_banded) solve it much faster than general solvers.
Why cache the cubic spline matrix for repeated evaluations?
The matrix depends only on x-spacing (h_i), not on y-values. Caching it makes repeated interpolation efficient when y changes on the same x-grid.
Disadvantage of cubic splines (forcing C^2 smoothness)
Near sharp jumps or steps in data, forcing the 2nd derivative to remain continuous causes oscillations and overshoot.
Akima splines vs. Cubic splines
Akima splines are only C^1 smooth (relaxing 2nd-derivative continuity), which reduces overshoot/oscillations near sharp changes and makes them easier to derive.
Multi-D interpolation on regular grids
On grids with uniform spacing per dimension, 1D methods extend directly: 2D nearest-neighbor, bilinear (from linear), and bicubic (from cubic).
Linear interpolation on irregular multi-D grids
If a triangulation exists (splitting points into triangles), linear interpolation is still relatively easy to perform on irregular grids.
Interpolation vs. Curve fitting (core difference)
Interpolation passes exactly through all data points. Curve fitting adjusts a parametric model to noisy data without hitting every point, minimizing residuals.
Curve fitting model & residual (definition)
y_i = f(t_i, β) + ε_i. t_i is the independent variable, β are unknown parameters, and the residual ε_i (or r_i) is the deviation between observed y_i and model prediction f(t_i, β).
Degrees of freedom (in curve fitting)
The number of unknown parameters in β adjusted to fit the data (e.g., 4 for A * e^(λt) * sin(ωt + θ)).
Why can model parametrization be ambiguous? (e.g., Ae^(λt)sin(ωt + θ))
Different parameter combinations can yield the exact same curve — e.g., adding 2π to θ, or flipping the sign of A (or ω) while shifting θ by π.
Why is an initial guess (p0) needed in curve fitting, and how is it chosen?
Nonlinear optimization is iterative and needs a starting point β_0 to converge properly. Heuristics are often used to estimate p0 automatically.
Why must you inspect residuals after curve fitting?
A good fit leaves residuals looking like random noise around zero; visible non-random patterns signal a problem.
2 likely causes of non-random patterns in a residual plot
1) The optimizer failed to converge to the optimum (e.g., bad initial guess p0 or poor conditioning);
2) The chosen model cannot describe the data, even at the optimum.