cmlabs.interpolate.test_interpolate_remainder

cmlabs.interpolate.test_interpolate_remainder()[source]

Estimate the remainder of interpolation.

\[\begin{split}\begin{aligned} R_n(x) &= f(x) - L_n(x) \\ &= \frac{f^{(n+1)}(\xi)}{(n+1)!} \cdot \omega_{n+1}(x) \\ \end{aligned}\end{split}\]

for \(n = 9\) have

\[\begin{aligned} (x + \log_{10}(x + 2))^{(10)} = \frac{362880}{\ln(10) \cdot (x + 2)^{10}} \end{aligned}\]

Results

>>> # Test 7: Estimate Remainder Of 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]
>>> # - x** =  0.52
>>> # - x*** =  0.97
>>> # - x**** =  0.73
>>> # M_min = 2.6689153346043457
>>> # M_max = 16.52522028557161
>>> interpolate([0.5   0.556 0.611 ... 0.889 0.944 1.   ], 0.52, yvals=[...])
>>> # Using Newton's forward interpolation formula for 0.52
>>> # 0.1185994592184786
>>> # R_min = 8.579275443070178e-15
>>> # R_max = 5.312061223865951e-14
>>> 8.579275443070178e-15 <= 2.2662427490161008e-14 <= 5.312061223865951e-14
>>> True
>>> interpolate([0.5   0.556 0.611 ... 0.889 0.944 1.   ], 0.97, yvals=...)
>>> # Using Newton's backward interpolation formula for 0.97
>>> # 0.4972435506828018
>>> # R_min = 6.312938757056343e-15
>>> # R_max = 3.9088052834446335e-14
>>> 6.312938757056343e-15 <= 1.4155343563970746e-14 <= 3.9088052834446335e-14
>>> True
>>> interpolate([0.5   0.556 0.611 ... 0.889 0.944 1.   ], 0.73, yvals=...)
>>> # Using Gauss's forward interpolation formula for 0.73
>>> # 0.29383735295924407
>>> # R_min = 7.849181383895046e-17
>>> # R_max = 4.860006226068698e-16
>>> 7.849181383895046e-17 <= 1.1102230246251565e-16 <= 4.860006226068698e-16
>>> True