lagrange_polynomials
moment_kinetics.lagrange_polynomials
— ModuleLagrange 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.
moment_kinetics.lagrange_polynomials.lagrange_poly
— MethodLagrange polynomial args: j - index of lj from list of nodes xnodes - array of x node values x - point where interpolated value is returned
moment_kinetics.lagrange_polynomials.lagrange_poly_derivative_optimised
— Methodlagrange_poly_derivative_optimised(other_nodes, one_over_denominator, x)
Optimised calculation of the first derivative of a Lagrange polynomial, 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.
moment_kinetics.lagrange_polynomials.lagrange_poly_optimised
— Methodlagrange_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.