The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Lagrange

74 declarations. Mathlib docs · Source

Lagrange interpolation

Main definitions

  • In everything that follows, s : Finset ι is a finite set of indices, with v : ι → 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, with x y : F. These are the normalised irreducible factors of the Lagrange basis polynomials. They evaluate to 1 at x and 0 at y when x and y are distinct.
  • Lagrange.basis v i with i : ι: the Lagrange basis polynomial that evaluates to 1 at v i and 0 at v j for i ≠ j.
  • Lagrange.interpolate v r where r : ι → F is a function from the fintype to the field: the Lagrange interpolant that evaluates to r i at x i for all i : ι. The r i are the values associated with the nodes x i.

theorem Lagrange.basis.congr_simp E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} {inst_1 : DecidableEq ι} [inst_2 : DecidableEq ι] (s s_1 : Finset ι),
  s = s_1 → ∀ (v v_1 : ι → F), v = v_1 → ∀ (i i_1 : ι), i = i_1 → Lagrange.basis s v i = Lagrange.basis s_1 v_1 i_1

theorem Lagrange.nodalWeight.congr_simp E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} {inst_1 : DecidableEq ι} [inst_2 : DecidableEq ι] (s s_1 : Finset ι),
  s = s_1 →
    ∀ (v v_1 : ι → F), v = v_1 → ∀ (i i_1 : ι), i = i_1 → Lagrange.nodalWeight s v i = Lagrange.nodalWeight s_1 v_1 i_1

def Lagrange.basisDivisor E1 #

{F : Type u_1} → [inst : Field F] → F → F → Polynomial F

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.

theorem Lagrange.basisDivisor_self E1 #

∀ {F : Type u_1} [inst : Field F] {x : F}, Lagrange.basisDivisor x x = 0

theorem Lagrange.basisDivisor_inj E1 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, Lagrange.basisDivisor x y = 0 → x = y

theorem Lagrange.basisDivisor_eq_zero_iff E0 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, Lagrange.basisDivisor x y = 0 ↔ x = y

theorem Lagrange.basisDivisor_ne_zero_iff E0 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, Lagrange.basisDivisor x y ≠ 0 ↔ x ≠ y

theorem Lagrange.degree_basisDivisor_of_ne E1 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, x ≠ y → (Lagrange.basisDivisor x y).degree = 1

theorem Lagrange.degree_basisDivisor_self E0 #

∀ {F : Type u_1} [inst : Field F] {x : F}, (Lagrange.basisDivisor x x).degree = ⊥

theorem Lagrange.natDegree_basisDivisor_self E1 #

∀ {F : Type u_1} [inst : Field F] {x : F}, (Lagrange.basisDivisor x x).natDegree = 0

theorem Lagrange.natDegree_basisDivisor_of_ne E1 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, x ≠ y → (Lagrange.basisDivisor x y).natDegree = 1

theorem Lagrange.eval_basisDivisor_right E0 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, Polynomial.eval y (Lagrange.basisDivisor x y) = 0

theorem Lagrange.eval_basisDivisor_left_of_ne E1 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, x ≠ y → Polynomial.eval x (Lagrange.basisDivisor x y) = 1

def Lagrange.basis E1 #

{F : Type u_1} → [inst : Field F] → {ι : Type u_2} → [DecidableEq ι] → Finset ι → (ι → F) → ι → Polynomial F

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.

theorem Lagrange.basis_empty E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {v : ι → F} {i : ι}, Lagrange.basis ∅ v i = 1

theorem Lagrange.basis_singleton E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {v : ι → F} (i : ι),
  Lagrange.basis {i} v i = 1

theorem Lagrange.basis_pair_left E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {v : ι → F} {i j : ι},
  i ≠ j → Lagrange.basis {i, j} v i = Lagrange.basisDivisor (v i) (v j)

theorem Lagrange.basis_pair_right E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {v : ι → F} {i j : ι},
  i ≠ j → Lagrange.basis {i, j} v j = Lagrange.basisDivisor (v j) (v i)

theorem Lagrange.basis_ne_zero E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → Lagrange.basis s v i ≠ 0

theorem Lagrange.eval_basis_self E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → Polynomial.eval (v i) (Lagrange.basis s v i) = 1

theorem Lagrange.eval_basis_of_ne E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i j : ι},
  i ≠ j → j ∈ s → Polynomial.eval (v j) (Lagrange.basis s v i) = 0

theorem Lagrange.natDegree_basis E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → (Lagrange.basis s v i).natDegree = s.card - 1

theorem Lagrange.degree_basis E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → (Lagrange.basis s v i).degree = ↑(s.card - 1)

theorem Lagrange.sum_basis E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F},
  Set.InjOn v ↑s → s.Nonempty → ∑ j ∈ s, Lagrange.basis s v j = 1

theorem Lagrange.basisDivisor_add_symm E1 #

∀ {F : Type u_1} [inst : Field F] {x y : F}, x ≠ y → Lagrange.basisDivisor x y + Lagrange.basisDivisor y x = 1

theorem Lagrange.leadingCoeff_basis E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → (Lagrange.basis s v i).leadingCoeff = (∏ j ∈ s.erase i, (v i - v j))⁻¹

def Lagrange.interpolate E3 #

{F : Type u_1} → [inst : Field F] → {ι : Type u_2} → [DecidableEq ι] → Finset ι → (ι → F) → (ι → F) →ₗ[F] Polynomial F

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 that takes value r i on v i for all i in s.

theorem Lagrange.interpolate_apply E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] (s : Finset ι) (v r : ι → F),
  (Lagrange.interpolate s v) r = ∑ i ∈ s, Polynomial.C (r i) * Lagrange.basis s v i

theorem Lagrange.interpolate_empty E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {v : ι → F} (r : ι → F),
  (Lagrange.interpolate ∅ v) r = 0

theorem Lagrange.interpolate_singleton E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {i : ι} {v : ι → F} (r : ι → F),
  (Lagrange.interpolate {i} v) r = Polynomial.C (r i)

theorem Lagrange.interpolate_one E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F},
  Set.InjOn v ↑s → s.Nonempty → (Lagrange.interpolate s v) 1 = 1

theorem Lagrange.eval_interpolate_at_node E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {i : ι} {v : ι → F}
  (r : ι → F), Set.InjOn v ↑s → i ∈ s → Polynomial.eval (v i) ((Lagrange.interpolate s v) r) = r i

theorem Lagrange.degree_interpolate_le E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F),
  Set.InjOn v ↑s → ((Lagrange.interpolate s v) r).degree ≤ ↑(s.card - 1)

theorem Lagrange.degree_interpolate_lt E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F),
  Set.InjOn v ↑s → ((Lagrange.interpolate s v) r).degree < ↑s.card

theorem Lagrange.degree_interpolate_erase_lt E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {i : ι} {v : ι → F}
  (r : ι → F), Set.InjOn v ↑s → i ∈ s → ((Lagrange.interpolate (s.erase i) v) r).degree < ↑(s.card - 1)

theorem Lagrange.values_eq_on_of_interpolate_eq E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r r' : ι → F),
  Set.InjOn v ↑s → (Lagrange.interpolate s v) r = (Lagrange.interpolate s v) r' → ∀ i ∈ s, r i = r' i

theorem Lagrange.interpolate_eq_of_values_eq_on E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r r' : ι → F),
  (∀ i ∈ s, r i = r' i) → (Lagrange.interpolate s v) r = (Lagrange.interpolate s v) r'

theorem Lagrange.interpolate_eq_iff_values_eq_on E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r r' : ι → F),
  Set.InjOn v ↑s → ((Lagrange.interpolate s v) r = (Lagrange.interpolate s v) r' ↔ ∀ i ∈ s, r i = r' i)

def Lagrange.funEquivDegreeLT E1 #

{F : Type u_1} →
  [inst : Field F] →
    {ι : Type u_2} →
      [DecidableEq ι] → {s : Finset ι} → {v : ι → F} → Set.InjOn v ↑s → ↥(Polynomial.degreeLT F s.card) ≃ₗ[F] ↥s → F

Lagrange interpolation induces isomorphism between functions from s and polynomials of degree less than Fintype.card ι.

theorem Lagrange.interpolate_eq_sum_interpolate_insert_sdiff E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s t : Finset ι} {v : ι → F} (r : ι → F),
  Set.InjOn v ↑t →
    s.Nonempty →
      s ⊆ t →
        (Lagrange.interpolate t v) r = ∑ i ∈ s, (Lagrange.interpolate (insert i (t \ s)) v) r * Lagrange.basis s v i

theorem Lagrange.interpolate_eq_add_interpolate_erase E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {i j : ι} {v : ι → F}
  (r : ι → F),
  Set.InjOn v ↑s →
    i ∈ s →
      j ∈ s →
        i ≠ j →
          (Lagrange.interpolate s v) r =
            (Lagrange.interpolate (s.erase j) v) r * Lagrange.basisDivisor (v i) (v j) +
              (Lagrange.interpolate (s.erase i) v) r * Lagrange.basisDivisor (v j) (v i)

theorem Lagrange.interpolate_eq_sum E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F),
  (Lagrange.interpolate s v) r =
    ∑ i ∈ s, Polynomial.C (r i / ∏ j ∈ s.erase i, (v i - v j)) * ∏ j ∈ s.erase i, (Polynomial.X - Polynomial.C (v j))

theorem Lagrange.iterate_derivative_interpolate E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F),
  Set.InjOn v ↑s →
    ∀ {k : ℕ},
      k < s.card →
        (⇑Polynomial.derivative)^[k] ((Lagrange.interpolate s v) r) =
          ↑k.factorial *
            ∑ i ∈ s,
              Polynomial.C (r i / ∏ j ∈ s.erase i, (v i - v j)) *
                ∑ t ∈ Finset.powersetCard (s.card - (k + 1)) (s.erase i), ∏ a ∈ t, (Polynomial.X - Polynomial.C (v a))

theorem Lagrange.eval_iterate_derivative_eq_sum E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F},
  Set.InjOn v ↑s →
    ∀ {P : Polynomial F},
      P.degree < ↑s.card →
        ∀ {k : ℕ},
          k < s.card →
            ∀ (x : F),
              Polynomial.eval x ((⇑Polynomial.derivative)^[k] P) =
                ↑k.factorial *
                  ∑ i ∈ s,
                    (Polynomial.eval (v i) P / ∏ j ∈ s.erase i, (v i - v j)) *
                      ∑ t ∈ Finset.powersetCard (s.card - (k + 1)) (s.erase i), ∏ a ∈ t, (x - v a)

theorem Lagrange.coeff_eq_sum E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F},
  Set.InjOn v ↑s →
    ∀ {P : Polynomial F},
      P.degree < ↑s.card → P.coeff (s.card - 1) = ∑ i ∈ s, Polynomial.eval (v i) P / ∏ j ∈ s.erase i, (v i - v j)

theorem Lagrange.leadingCoeff_eq_sum E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F},
  Set.InjOn v ↑s →
    ∀ {P : Polynomial F},
      ↑s.card = P.degree + 1 → P.leadingCoeff = ∑ i ∈ s, Polynomial.eval (v i) P / ∏ j ∈ s.erase i, (v i - v j)

theorem Polynomial.exists_eval_eq_iff E0 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_3} [Finite ι] (x y : ι → F),
  (∃ q, ∀ (i : ι), Polynomial.eval (x i) q = y i) ↔ ∀ (i j : ι), x i = x j → y i = y j

def Lagrange.nodal E1 #

{R : Type u_1} → [inst : CommRing R] → {ι : Type u_2} → Finset ι → (ι → R) → Polynomial R

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.

theorem Lagrange.nodal_eq E0 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} (s : Finset ι) (v : ι → R),
  Lagrange.nodal s v = ∏ i ∈ s, (Polynomial.X - Polynomial.C (v i))

theorem Lagrange.nodal_empty E0 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {v : ι → R}, Lagrange.nodal ∅ v = 1

theorem Lagrange.natDegree_nodal E0 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [Nontrivial R],
  (Lagrange.nodal s v).natDegree = s.card

theorem Lagrange.nodal_ne_zero E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [Nontrivial R], Lagrange.nodal s v ≠ 0

theorem Lagrange.degree_nodal E0 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [Nontrivial R],
  (Lagrange.nodal s v).degree = ↑s.card

theorem Lagrange.nodal_monic E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R}, (Lagrange.nodal s v).Monic

theorem Lagrange.eval_nodal E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} {x : R},
  Polynomial.eval x (Lagrange.nodal s v) = ∏ i ∈ s, (x - v i)

theorem Lagrange.eval_nodal_at_node E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} {i : ι},
  i ∈ s → Polynomial.eval (v i) (Lagrange.nodal s v) = 0

theorem Lagrange.eval_nodal_not_at_node E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [Nontrivial R] [NoZeroDivisors R]
  {x : R}, (∀ i ∈ s, x ≠ v i) → Polynomial.eval x (Lagrange.nodal s v) ≠ 0

theorem Lagrange.nodal_eq_mul_nodal_erase E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [inst_1 : DecidableEq ι] {i : ι},
  i ∈ s → Lagrange.nodal s v = (Polynomial.X - Polynomial.C (v i)) * Lagrange.nodal (s.erase i) v

theorem Lagrange.X_sub_C_dvd_nodal E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} (v : ι → R) {i : ι},
  i ∈ s → Polynomial.X - Polynomial.C (v i) ∣ Lagrange.nodal s v

theorem Lagrange.nodal_insert_eq_nodal E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [inst_1 : DecidableEq ι] {i : ι},
  i ∉ s → Lagrange.nodal (insert i s) v = (Polynomial.X - Polynomial.C (v i)) * Lagrange.nodal s v

theorem Lagrange.derivative_nodal E1 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [inst_1 : DecidableEq ι],
  Polynomial.derivative (Lagrange.nodal s v) = ∑ i ∈ s, Lagrange.nodal (s.erase i) v

theorem Lagrange.eval_nodal_derivative_eval_node_eq E0 #

∀ {R : Type u_1} [inst : CommRing R] {ι : Type u_2} {s : Finset ι} {v : ι → R} [inst_1 : DecidableEq ι] {i : ι},
  i ∈ s →
    Polynomial.eval (v i) (Polynomial.derivative (Lagrange.nodal s v)) =
      Polynomial.eval (v i) (Lagrange.nodal (s.erase i) v)

theorem Lagrange.nodal_subgroup_eq_X_pow_card_sub_one E0 #

∀ {R : Type u_1} [inst : CommRing R] [IsDomain R] (G : Subgroup Rˣ) [inst_2 : Fintype ↥G],
  Lagrange.nodal (↑G).toFinset Units.val = Polynomial.X ^ Fintype.card ↥G - 1

The vanishing polynomial on a multiplicative subgroup is of the form X ^ n - 1.

def Lagrange.nodalWeight E1 #

{F : Type u_1} → [Field F] → {ι : Type u_2} → [DecidableEq ι] → Finset ι → (ι → F) → ι → F

This defines the nodal weight for a given set of node indexes and node mapping function v.

theorem Lagrange.nodalWeight_eq_eval_nodal_erase_inv E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Lagrange.nodalWeight s v i = (Polynomial.eval (v i) (Lagrange.nodal (s.erase i) v))⁻¹

theorem Lagrange.nodal_erase_eq_nodal_div E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  i ∈ s → Lagrange.nodal (s.erase i) v = Lagrange.nodal s v / (Polynomial.X - Polynomial.C (v i))

theorem Lagrange.nodalWeight_eq_eval_derivative_nodal E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  i ∈ s → Lagrange.nodalWeight s v i = (Polynomial.eval (v i) (Polynomial.derivative (Lagrange.nodal s v)))⁻¹

theorem Lagrange.nodalWeight_ne_zero E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  Set.InjOn v ↑s → i ∈ s → Lagrange.nodalWeight s v i ≠ 0

theorem Lagrange.basis_eq_prod_sub_inv_mul_nodal_div E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι},
  i ∈ s →
    Lagrange.basis s v i =
      Polynomial.C (Lagrange.nodalWeight s v i) * (Lagrange.nodal s v / (Polynomial.X - Polynomial.C (v i)))

theorem Lagrange.eval_basis_not_at_node E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {i : ι} {x : F},
  i ∈ s →
    x ≠ v i →
      Polynomial.eval x (Lagrange.basis s v i) =
        Polynomial.eval x (Lagrange.nodal s v) * (Lagrange.nodalWeight s v i * (x - v i)⁻¹)

theorem Lagrange.interpolate_eq_nodalWeight_mul_nodal_div_X_sub_C E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F),
  (Lagrange.interpolate s v) r =
    ∑ i ∈ s,
      Polynomial.C (Lagrange.nodalWeight s v i) * (Lagrange.nodal s v / (Polynomial.X - Polynomial.C (v i))) *
        Polynomial.C (r i)

theorem Lagrange.eval_interpolate_not_at_node E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F)
  {x : F},
  (∀ i ∈ s, x ≠ v i) →
    Polynomial.eval x ((Lagrange.interpolate s v) r) =
      Polynomial.eval x (Lagrange.nodal s v) * ∑ i ∈ s, Lagrange.nodalWeight s v i * (x - v i)⁻¹ * r i

This is the first barycentric form of the Lagrange interpolant.

theorem Lagrange.sum_nodalWeight_mul_inv_sub_ne_zero E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} {x : F},
  Set.InjOn v ↑s → (∀ i ∈ s, x ≠ v i) → s.Nonempty → ∑ i ∈ s, Lagrange.nodalWeight s v i * (x - v i)⁻¹ ≠ 0

theorem Lagrange.eval_interpolate_not_at_node' E1 #

∀ {F : Type u_1} [inst : Field F] {ι : Type u_2} [inst_1 : DecidableEq ι] {s : Finset ι} {v : ι → F} (r : ι → F)
  {x : F},
  Set.InjOn v ↑s →
    (∀ i ∈ s, x ≠ v i) →
      Polynomial.eval x ((Lagrange.interpolate s v) r) =
        (∑ i ∈ s, Lagrange.nodalWeight s v i * (x - v i)⁻¹ * r i) / ∑ i ∈ s, Lagrange.nodalWeight s v i * (x - v i)⁻¹

This is the second barycentric form of the Lagrange interpolant.