Run an example 'Interpolation: Newton'.
()
| 266 | |
| 267 | @print_docstring |
| 268 | def example_interpolation_newton(): |
| 269 | """Run an example 'Interpolation: Newton'.""" |
| 270 | x = np.array([0.1, 0.3, 0.4, 0.6, 0.7]) |
| 271 | y = np.array([0.3162, 0.5477, 0.6325, 0.7746, 0.8367]) |
| 272 | x_int = 0.2 |
| 273 | |
| 274 | print("Inputs:") |
| 275 | print(f"x = {x}") |
| 276 | print(f"y = {y}") |
| 277 | print(f"x_int = {x_int}") |
| 278 | |
| 279 | y_int = interpolation.newton(x, y, x_int) |
| 280 | |
| 281 | print("Output:") |
| 282 | print(f"y_int = {y_int:.5f}") |
| 283 | |
| 284 | |
| 285 | @print_docstring |