lagrange_polynomials

moment_kinetics.lagrange_polynomialsModule

Lagrange polynomials can be useful for finite element methods on any set of basis points, as they give a representation of the interpolating function within an element whose coefficients are just the function values at the grid points.

This module collects some functions related to the use of Lagrange polynomials, to avoid their being scattered (and possibly duplicated) in other modules.

source
moment_kinetics.lagrange_polynomials.lagrange_poly_optimisedMethod
lagrange_poly_optimised(other_nodes, one_over_denominator, x)

Optimised version of Lagrange polynomial calculation, making use of pre-calculated quantities.

other_nodes is a vector of the grid points in this element where this Lagrange polynomial is zero (the other nodes than the one where it is 1).

one_over_denominator is 1/prod(x0 - n for n ∈ other_nodes) where x0 is the grid point where this Lagrange polynomial is 1.

x is the point to evaluate the Lagrange polynomial at.

source