Lagrange interpolation #
Main definitions #
- In everything that follows,
s : Finset ι
is a finite set of indexes, withv : ι → F
an indexing of the field over some type. We call the image of v on s the interpolation nodes, though strictly unique nodes are only defined when v is injective on s. Lagrange.basisDivisor x y
, withx y : F
. These are the normalised irreducible factors of the Lagrange basis polynomials. They evaluate to1
atx
and0
aty
whenx
andy
are distinct.Lagrange.basis v i
withi : ι
: the Lagrange basis polynomial that evaluates to1
atv i
and0
atv j
fori ≠ j
.Lagrange.interpolate v r
wherer : ι → F
is a function from the fintype to the field: the Lagrange interpolant that evaluates tor i
atx i
for alli : ι
. Ther i
are the values associated with the nodesx i
.
Two polynomials, with the same degree and leading coefficient, which have the same evaluation on a set of distinct values with cardinality equal to the degree, are equal.
basisDivisor x y
is the unique linear or constant polynomial such that
when evaluated at x
it gives 1
and y
it gives 0
(where when x = y
it is identically 0
).
Such polynomials are the building blocks for the Lagrange interpolants.
Instances For
Lagrange basis polynomials indexed by s : Finset ι
, defined at nodes v i
for a
map v : ι → F
. For i, j ∈ s
, basis s v i
evaluates to 0 at v j
for i ≠ j
. When
v
is injective on s
, basis s v i
evaluates to 1 at v i
.
Equations
- Lagrange.basis s v i = Finset.prod (Finset.erase s i) fun (j : ι) => Lagrange.basisDivisor (v i) (v j)
Instances For
Lagrange interpolation: given a finset s : Finset ι
, a nodal map v : ι → F
injective on
s
and a value function r : ι → F
, interpolate s v r
is the unique
polynomial of degree < s.card
that takes value r i
on v i
for all i
in s
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This is the characteristic property of the interpolation: the interpolation is the
unique polynomial of degree < Fintype.card ι
which takes the value of the r i
on the v i
.
Lagrange interpolation induces isomorphism between functions from s
and polynomials of degree less than Fintype.card ι
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
nodal s v
is the unique monic polynomial whose roots are the nodes defined by v
and s
.
That is, the roots of nodal s v
are exactly the image of v
on s
,
with appropriate multiplicity.
We can use nodal
to define the barycentric forms of the evaluated interpolant.
Equations
- Lagrange.nodal s v = Finset.prod s fun (i : ι) => Polynomial.X - Polynomial.C (v i)
Instances For
The vanishing polynomial on a multiplicative subgroup is of the form X ^ n - 1.
This defines the nodal weight for a given set of node indexes and node mapping function v
.
Equations
- Lagrange.nodalWeight s v i = Finset.prod (Finset.erase s i) fun (j : ι) => (v i - v j)⁻¹
Instances For
This is the first barycentric form of the Lagrange interpolant.
This is the second barycentric form of the Lagrange interpolant.