Mathematics / Cubic Spline Interpolation
FREE TO EXPLORE
LABORATORY 24 · MATHEMATICS

Cubic Spline Interpolation: Natural and Clamped Boundary Conditions

Construct piecewise cubic spline interpolants satisfying C² continuity, assemble the strictly diagonally dominant tridiagonal continuity system, solve via the Thomas algorithm, and verify the optimal O(h⁴) uniform error convergence under mesh refinement. Explore interactive numerical methods, evaluate error attenuation and verify convergence orders.

COMPUTE · CONVERGE · ANALYSE

Your virtual mathematics laboratory.

MAXIMUM SPLINE ERROR ||F - S||_∞—
COMPUTATION STATUS

Ready to execute Step = 1.

1 step
Continuity requirement: Piecewise cubic polynomials S_i(x) with S ∈ C²[a, b] (continuous value, slope, and curvature)

Adjust Step, then execute computation.

Mathematical operations are computed deterministically using 64-bit IEEE 754 precision. Residuals reflect ordinary least-squares regression across successive observations.

Numerical assumptions and limits

Natural cubic splines exhibit boundary layer degradation to O(h²) error near endpoints unless the underlying function naturally satisfies f''(a) = f''(b) = 0. The simulation solves clamped cubic splines for mesh spacings h = 0.20 / 2^{k-1}. The maximum error ||f - S||_∞ is tracked over 1500 interior points. The log-log regression ln(E) = α·ln(h) + ln(C) extracts the asymptotic order α = 4.000 with R² = 1.000000.

Computational tools & numerical modules.

Piecewise Knot Mesh Discretizer

Divides the domain into N sub-intervals with knot coordinates x_0 < x_1 < ... < x_N and spacing h_i = x_{i+1} - x_i.

C² Continuity Matrix Assembler

Formulates the tridiagonal system for second derivatives M_i = S''(x_i) based on slope matching at interior knots.

Thomas Algorithm Engine

Solves the symmetric, strictly diagonally dominant tridiagonal system in O(N) operations without pivoting.

Boundary Condition Switcher

Applies either natural free-edge constraints (M_0 = M_N = 0) or clamped derivative constraints.

Piecewise Hermite Cubic Evaluator

Interpolates any query point x within its respective knot interval using the local cubic polynomial representation.

Curvature Energy Integrator

Computes the total bending energy ∫ (S''(x))² dx to verify the Holladay minimum curvature variational property.

FOLLOW THE METHOD

A reason behind every step.

Construct piecewise cubic spline interpolants satisfying C² continuity, assemble the strictly diagonally dominant tridiagonal continuity system, solve via the Thomas algorithm, and verify the optimal O(h⁴) uniform error convergence under mesh refinement. Standardized input settings: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 step.

01

Define Domain Knots & Mesh Spacing

Set up N = 2^{k+1} knot intervals on [0, 1] with uniform spacing h = 1.0 / N across refinement levels k = 1 to 6.

02

Evaluate Nodal Coordinates & Function Values

Compute exact function ordinates y_i = f(x_i) at all knots x_i = i · h for i = 0, ..., N.

03

Formulate Tridiagonal Curvature System

Set up the continuity equations h_{i-1} M_{i-1} + 2(h_{i-1} + h_i) M_i + h_i M_{i+1} = 6[(y_{i+1} - y_i)/h_i - (y_i - y_{i-1})/h_{i-1}].

04

Impose Boundary Conditions & Solve via TDMA

Apply clamped boundary conditions and execute the forward elimination and backward substitution of the Thomas algorithm to obtain all moments M_i.

05

Evaluate Supremum Norm Spline Error

Sample S(x) across 1500 interior points and extract the maximum absolute deviation E_max = ||f - S||_∞.

06

Linearize Logarithmic Coordinates & Fit Slope

Plot ln(E_max) versus ln(h) and perform linear regression to quantitatively confirm the theoretical order α = 4.000.

YOUR NOTEBOOK · 0 OBSERVATIONS

Turn measurements into mathematical insight.

See a complete example report ↗

Points are your recorded observations. The solid regression line validates Cubic Spline Interpolation mathematical scaling.

LINEAR ASYMPTOTIC FIT · y = mx + b
ln(E_max) = α · ln(h) + ln(C)
#Mesh Refinement Level (k) (step)Maximum Spline Error ||f - S||_∞ (error norm)Logarithmic Mesh Spacing ln(h)Logarithmic Spline Error ln(E_max)Remove

No readings yet. Execute a computation and record it.

Calculate it yourself.

CHECK YOUR UNDERSTANDING

Explain what the mathematical metrics mean.

What level of global smoothness does a cubic spline guarantee across all interior knots?

What is the asymptotic uniform error convergence order α for a clamped cubic spline as mesh spacing h → 0?

Which linear system solver achieves O(N) complexity for the cubic spline continuity equations?

What variational physical property does a natural cubic spline minimize?