cmlabs.interpolate.test_cubic_spline
- cmlabs.interpolate.test_cubic_spline()[source]
Cubic spline interpolation/differentiation.
\[\begin{split}\begin{gather} S(x) = \sum_{i=0}^{n} S_i(x) \\ S_i(x) = a_i + b_i (x - x_i) + c_i (x - x_i)^2 + d_i (x - x_i)^3 \\ \left(x - \lg(x+2)\right)'' = \frac{1}{(x + 2)^2 \cdot \ln(10)} \end{gather}\end{split}\]Results
>>> # Test 8: Cubic Spline Interpolation >>> # - X: [0.5 0.556 0.611 ... 0.889 0.944 1. ] >>> # - Y: [0.102 0.148 0.194 ... 0.428 0.475 0.523] >>> CubicSpline(X, Y, bc_type='not-a-knot) >>> # f(0.77) >>> # 0.32752023093555144 >>> spline.interpolate(0.77) >>> # 0.3275202307162315 >>> f''(0.77) >>> # 0.056601087190404124 >>> spline.derivative(0.77, order=2) >>> # 0.05659785880306364
See also