Math (math)

Some mathematical utility functions

pypint.utilities.math.lagrange_polynome(j, base_points, x)[source]

Evaluates \(j\)-th Lagrange polynomial based on base_points at \(x\)

For a given set of \(n\) nodes \(\vec{b}\) (base_points) the \(j\)-th Lagrange polynomial is constructed and evaluated at the given point \(x\).

\[P_j(x) = \prod_{m=1, m \neq j}^{n} \frac{x - b_m}{b_j - b_m}\]
Parameters:
  • j (int) – descriptor of the Lagrange polynomial
  • base_points (numpy.ndarray of \(n\) float) – points to construct the Lagrange polynome on
  • x (float) – point to evaluate the Lagrange polynome at
Returns:

value – value of the specified Lagrange polynome

Return type:

float