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

Cubic Spline Interpolation lab report

A worked cubic spline interpolation lab report with iteration data tables, logarithmic graphs, calculations, uncertainty and conclusions.

WORKED EXAMPLE · BENCHMARK OBSERVATIONS

A complete example laboratory report.

Simulated demonstration data.

This report illustrates formal numerical analysis, iteration tracking, and convergence rate extraction. Replace its observations with your own computational telemetry when preparing a practical submission.

Student: __________________Student ID: __________________Course: __________________Date: __________________Partner: __________________Instructor: __________________

1. Title and aim

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.

2. Abstract

Six computational trials were executed across standardized inputs Step = 1.0 to Step = 6.0 for Cubic Spline Interpolation: Natural and Clamped Boundary Conditions. An ordinary least-squares regression yielded an empirical Spline Convergence Order (α) of 4.000 order (difference from theoretical reference = 0.0000%). The empirical telemetry conclusively validates the theoretical model and complexity scaling with R² = 1.000000.

3. Apparatus and fixed settings

4. Theory and graph choice

While global polynomial interpolation attempts to fit a single high-degree polynomial through all data points—often incurring Runge's wild boundary oscillations—spline interpolation adopts a piecewise paradigm. Originating from the physical flexible wooden splines used by naval draftsmen to draw smooth ship hulls, mathematical cubic splines connect adjacent data pairs using cubic polynomials joined with C² continuity (matching values, first derivatives, and second derivatives). The resulting system of continuity equations is tridiagonal and strictly diagonally dominant, enabling direct solution in linear O(N) time via the Thomas algorithm. In this laboratory, we construct natural and clamped cubic splines, examine the tridiagonal curvature system, and confirm the optimal O(h⁴) error convergence rate.

ln(E_max) = α · ln(h) + ln(C)

The mathematical regression linearizes the relationship into the form y = mx + b. Here, the independent variable x represents Logarithmic Mesh Spacing ln(h), and the dependent variable y represents Logarithmic Spline Error ln(E_max). The slope m directly extracts Spline Convergence Order (α), while the intercept b accounts for residual baseline offsets.

5. Method

  1. 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.
  2. Compute exact function ordinates y_i = f(x_i) at all knots x_i = i · h for i = 0, ..., N.
  3. 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}].
  4. Apply clamped boundary conditions and execute the forward elimination and backward substitution of the Thomas algorithm to obtain all moments M_i.
  5. Sample S(x) across 1500 interior points and extract the maximum absolute deviation E_max = ||f - S||_∞.
  6. Plot ln(E_max) versus ln(h) and perform linear regression to quantitatively confirm the theoretical order α = 4.000.

6. Observations and calculation table

All iterative observations use strictly controlled 64-bit IEEE 754 precision buffers. Residuals are computed relative to the ordinary least-squares regression line.

Table 1. Six simulated observations; x and y represent transformed mathematical metrics.
No.Mesh Refinement Level (k) (step)Maximum Spline Error ||f - S||_∞ (error norm)Logarithmic Mesh Spacing ln(h)Logarithmic Spline Error ln(E_max)Fitted yResidual
11.00.000357-1.6094-7.9376-7.93760.0000
22.02.2e-05-2.3026-10.7104-10.71040.0000
33.01e-06-2.9957-13.4828-13.48280.0000
44.00.0-3.6889-16.2556-16.25560.0000
55.00.0-4.3820-19.0280-19.02800.0000
66.00.0-5.0752-21.8008-21.80080.0000

Download the sample observations (CSV) ↓

7. Worked calculation for one observation

For step k = 1.0: Logarithmic mesh coordinate x = ln(h) = -1.6094. Logarithmic error y = ln(E) = α · ln(h) + ln(C) = -7.9376. Empirical error: 0.000357.

8. Graph, gradient and final calculation

-23.88-5.49-19.37-4.42-14.87-3.34-10.36-2.27-5.86-1.19Logarithmic Mesh Spacing ln(h)Logarithmic Spline Error ln(E_max)

Circular markers represent empirical computational observations. The solid line represents the ordinary least-squares linear fit.

x̄ = -3.34230; ȳ = -14.86920
Σ(x − x̄)² = 8.40810
Σ(x − x̄)(y − ȳ) = 33.63240
m = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² = 4.00000000
b = ȳ − mx̄ = -1.50000000
ln(E) = 4.0000 · ln(h) + -1.5000 ⟹ α = 4.000 (theoretical α = 4.0)

9. Uncertainty and comparison

Percentage difference = |estimate − theoretical value| / |theoretical value| × 100 = 0.0000%.

For n = 6 observations, Σresidual² = 0.00000; s² = Σresidual²/(n − 2). Gradient standard error = √[s²/Σ(x − x̄)²] = 0.00000. Intercept standard error = √[s²(1/n + x̄²/Σ(x − x̄)²)] = 0.00000.

Propagating the fit parameters yields a fit standard error of 1.0000e-04 order, with an ideal coefficient of determination R² = 1.000000.

In computational mathematics and numerical analysis, errors arise from algorithmic discretization, finite precision IEEE 754 floating-point arithmetic (machine epsilon ε_mach ≈ 2.22 × 10⁻¹⁶ for 64-bit double precision), and condition number propagation. The ordinary least-squares fit across n = 6 standardized observations provides standard errors for the gradient and intercept. Because the mathematical recurrence is evaluated with high numerical precision, the residual sum of squares is vanishingly small, yielding a coefficient of determination R² ≥ 0.999999 and confirming the theoretical mathematical model.

10. Result and discussion

Spline Convergence Order (α) = 4.000 order
Theoretical reference value: 4.000 order

The empirical benchmark observations provide rigorous quantitative verification of Cubic Spline Interpolation: Natural and Clamped Boundary Conditions. In numerical analysis, scientific computing, and computational mathematics, algorithms are characterized by their asymptotic operational scaling, stability, and convergence rates. Across all six observations, the empirical slope m = 4.0000 confirms the theoretical model with near-zero residual variance. Furthermore, comparison with alternative algorithmic paradigms underscores critical trade-offs between memory footprint, condition number sensitivity, and operational throughput. The algorithm's behavior confirms the mathematical predictions established by numerical analysis literature.

11. Precautions and limitations

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.

12. Conclusion

This computational laboratory investigation quantitatively verified the mathematical formulation and asymptotic scaling of Cubic Spline Interpolation: Natural and Clamped Boundary Conditions. Through rigorous tracking across six observation points, we confirmed an empirical Spline Convergence Order (α) of 4.000 order matching the theoretical reference 4.000 order within 0.0000% error. The investigation demonstrates why this method serves as an indispensable tool in modern computational science.