Interpolation
This module contains a host of models and functions often used for testing interpolation algorithms.
- temfpy.interpolation.runge(x)[source]
Runge function.
\[f(x) = \frac{1}{1 + 25x^2}\]- Parameters
x (float) – Input number, which is usually evaluated on the interval \(x_i \in [-1, 1]\).
- Returns
Output domain
- Return type
float
Notes
Runge found that interpolating this function with a Polynomial \(p_n(x)\) of degree \(n\) on an equidistant grid with grid points \(x_i = \frac{2i}{n}-1\) results in an interpolation function that oscilliates close to the interval boundaries \(-1\) and \(1\).
References
- R1901
Runge, C. (1901). Über empirische Funktionen und die Interpolation zwischen äquidistanten Ordinaten. Zeitschrift für Mathematik und Physik, 46: 224-243.
Examples
>>> from temfpy.interpolation import runge >>> import numpy as np >>> >>> x = 0 >>> y = runge(x) >>> np.testing.assert_almost_equal(y, 1)