cmlabs.interpolate.test_lagrange_remainder_2
- cmlabs.interpolate.test_lagrange_remainder_2()[source]
Estimate the derivative and remainder degree 2.
\[\begin{split}\begin{gather} R_2(x) = f(x) - L_2(x) \\ \\ f(x) = x - \log_{10}(x + 2) \\ f^{(3)}(x) = \frac{-2}{(x + 2)^3 \cdot \ln(10)} \\ \min{f^{(3)}_{[x_{i-1}, x_{i+1}]}} = \min_{x \in [x_{i-1}, x_{i+1}]} |f^{(3)}(x)| = \frac{-2}{(x_{i+1} + 2)^3 \cdot \ln(10)} \\ \max{f^{(3)}_{[x_{i-1}, x_{i+1}]}} = \max_{x \in [x_{i-1}, x_{i+1}]} |f^{(3)}(x)| = \frac{-2}{(x_{i-1} + 2)^3 \cdot \ln(10)} \\ \\ \left|\frac{\min{f^{(3)}(x)}}{6} \cdot \omega_3(x)\right| \leq |R_2(x)| \leq \left|\frac{\max{f^{(3)}(x)}}{6} \cdot \omega_3(x)\right|, \quad x \in [x_{i-1}, x_{i+1}] \end{gather}\end{split}\]Results
>>> # Test 4: Estimating Remainder Degree 2 In Lagrange Interpolation Formula >>> # - X: [0.5 0.556 0.611 ... 0.889 0.944 1. ] >>> # - x* = 0.77 >>> # Nearest points: [0.722 0.778 0.833] >>> # Nearest f(x) values: [0.287 0.334 0.381] >>> # f'''(x) min: -0.03818750583802256 >>> # f'''(x) max: -0.04305698167361838 >>> f(0.77) - lagrange([0.722 0.778 0.833], [0.287 0.334 0.381], 0.77) >>> # 1.5933154223768398e-07 >>> # R_min: -1.4979036069111843e-07 >>> # R_max: -1.6889086295708034e-07 >>> |-1.4979036069111843e-07| <= |1.5933154223768398e-07| <= |-1.688908629...| >>> # True >>> abs(-1.6889086295708034e-07) <= 1e-5 >>> # True
See also
lagrange_remainder