Function of #cas

ChebyshevT

The Chebyshev polynomial Tn in monomials, proved in every commutative ring, and its exact values at rational points.

#cas (ChebyshevT n x)
gives the Chebyshev polynomial of the first kind Tn in the variable x, in monomials with integer coefficients, and proves the expansion in every commutative ring.
#cas (ChebyshevT n q)
gives the exact value of Tn at the rational number q and proves it.
#cas [N d] (ChebyshevT n q)
gives the exact value of Tn at q with its first d significant digits, truncated toward zero, and proves their decimal bounds.

ChebyshevT writes the Chebyshev polynomial of the first kind in monomials, or gives its exact value at a rational point. The theorem is unusually general. For the polynomial it is about Mathlib’s Polynomial.Chebyshev.T R n, and it holds in every commutative ring R : Type at once, so a proof can specialize it to the ring it works in, whether that is ℝ, ℤ or a finite field.

Details and Options

  • n is a natural number with n≤80, a literal or a closed integer expression such as 2 * 3.
  • The second argument is a variable or a rational number. The polynomial is written in the variable, which may have any name other than pi, π, Pi, e and E.
  • For the polynomial the theorem is ∀ (R : Type) [CommRing R], Polynomial.Chebyshev.T R n = p for the printed p, written in Polynomial.X. The kernel evaluates the coefficient list of degree n, and CAS.Analysis.SpecialFunctions.chebyshevT_eq_intPoly, proved from Mathlib’s recurrence Polynomial.Chebyshev.T_add_two, identifies it with Mathlib’s polynomial.
  • At a rational q the theorem is Polynomial.eval q (Polynomial.Chebyshev.T ℝ n) = v. With [N d] it adds the first d significant digits of v, truncated toward zero, and their decimal bounds. The report prints v = digits when the digits are exact and v ≈ digits otherwise.
  • With [N d], 1≤d≤2000, as for N.
  • #cas [expand] (ChebyshevT n x) prints the same polynomial as #cas (ChebyshevT n x).
  • There are no options.

Examples (11)#

Basic Examples (2)

T5 in monomials, with the theorem in every commutative ring:

In[1]:=
#cas (ChebyshevT 5 x)
Out[1]=

polynomial with integer coefficients

16x5−20x3+5x
16*x^5 - 20*x^3 + 5*x
Domain
Polynomial.Chebyshev.T R 5, every commutative ring R : Type
Input (polynomial in x)
ChebyshevT 5 x

Checked by Lean’s kernel: Monomial expansion of ChebyshevT 5

∀ (R : Type) [inst : CommRing R],
  Polynomial.Chebyshev.T R 5 = 16 * Polynomial.X ^ 5 - 20 * Polynomial.X ^ 3 + 5 * Polynomial.X
The certificate: 1 checked step
  1. Monomial expansion of ChebyshevT 5

    ∀ (R : Type) [inst : CommRing R],
      Polynomial.Chebyshev.T R 5 = 16 * Polynomial.X ^ 5 - 20 * Polynomial.X ^ 3 + 5 * Polynomial.X

    Checked by Lean’s kernel


The exact value at a rational point:

In[2]:=
#cas (ChebyshevT 5 (1/2))
Out[2]=

exact rational value

12
1/2
Domain
ChebyshevT polynomial at a rational point

Checked by Lean’s kernel: Exact value of ChebyshevT 5

Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 5) = 1 / 2
The certificate: 1 checked step
  1. Exact value of ChebyshevT 5

    Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 5) = 1 / 2

    Checked by Lean’s kernel

Scope (3)

The degree may be a closed integer expression:

In[3]:=
#cas (ChebyshevT (2 + 1) x)
Out[3]=

polynomial with integer coefficients

4x3−3x
4*x^3 - 3*x
Domain
Polynomial.Chebyshev.T R 3, every commutative ring R : Type
Input (polynomial in x)
ChebyshevT 3 x

Checked by Lean’s kernel: Monomial expansion of ChebyshevT 3

∀ (R : Type) [inst : CommRing R],
  Polynomial.Chebyshev.T R 3 = 4 * Polynomial.X ^ 3 - 3 * Polynomial.X
The certificate: 1 checked step
  1. Monomial expansion of ChebyshevT 3

    ∀ (R : Type) [inst : CommRing R],
      Polynomial.Chebyshev.T R 3 = 4 * Polynomial.X ^ 3 - 3 * Polynomial.X

    Checked by Lean’s kernel


The variable need not be x, and expand prints the same polynomial:

In[4]:=
#cas [expand] (ChebyshevT 1 t)
Out[4]=

polynomial with integer coefficients

t
Domain
Polynomial.Chebyshev.T R 1, every commutative ring R : Type
Input (polynomial in t)
ChebyshevT 1 t

Checked by Lean’s kernel: Monomial expansion of ChebyshevT 1

∀ (R : Type) [inst : CommRing R], Polynomial.Chebyshev.T R 1 = Polynomial.X
The certificate: 1 checked step
  1. Monomial expansion of ChebyshevT 1

    ∀ (R : Type) [inst : CommRing R], Polynomial.Chebyshev.T R 1 = Polynomial.X

    Checked by Lean’s kernel


[N d] adds the first digits of the exact value:

In[5]:=
#cas [N 10] (ChebyshevT 5 (1/3))
Out[5]=

exact rational value and its first 10 significant digits, truncated

241243≈0.9917695473
241/243 ≈ 0.9917695473
Domain
ChebyshevT polynomial at a rational point

Checked by Lean’s kernel: Exact value and digits of ChebyshevT 5

Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) = 241 / 243 ∧
  9917695473 / 10 ^ 10 ≤ Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) ∧
    Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) < (9917695473 + 1) / 10 ^ 10
The certificate: 1 checked step
  1. Exact value and digits of ChebyshevT 5

    Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) = 241 / 243 ∧
      9917695473 / 10 ^ 10 ≤ Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) ∧
        Polynomial.eval (1 / 3) (Polynomial.Chebyshev.T ℝ 5) < (9917695473 + 1) / 10 ^ 10

    Checked by Lean’s kernel

Applications (1)

A proof can take the printed theorem as a hypothesis and specialize it, here to R=ℝ at x=12:

In[6]:=
theorem chebyshevT_five_at_half
    (h : ∀ (R : Type) [CommRing R], Polynomial.Chebyshev.T R 5 =
      16 * Polynomial.X ^ 5 - 20 * Polynomial.X ^ 3 + 5 * Polynomial.X) :
    (Polynomial.Chebyshev.T ℝ 5).eval (1 / 2) = 1 / 2 := by
  rw [h ℝ]
  norm_num

#print axioms chebyshevT_five_at_half
Out[6]=

chebyshevT_five_at_half depends on the axioms propext, Classical.choice, Quot.sound.

Properties and Relations (2)

Tn(cosθ)=cosnθ. At cosπ3=12 this gives T3(12)=cosπ=−1, and the digits are exact:

In[7]:=
#cas [N 5] (ChebyshevT 3 (1/2))
Out[7]=

exact rational value and its first 5 significant digits, truncated

-1 = -1.0000
Domain
ChebyshevT polynomial at a rational point

Checked by Lean’s kernel: Exact value and digits of ChebyshevT 3

Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) = -1 ∧
  -(10000 + 1) / 10 ^ 4 < Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) ∧
    Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) ≤ -10000 / 10 ^ 4
The certificate: 1 checked step
  1. Exact value and digits of ChebyshevT 3

    Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) = -1 ∧
      -(10000 + 1) / 10 ^ 4 < Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) ∧
        Polynomial.eval (1 / 2) (Polynomial.Chebyshev.T ℝ 3) ≤ -10000 / 10 ^ 4

    Checked by Lean’s kernel


The derivative of Tn is nUn−1. For n=5 it is T5′=80x4−60x2+5=5U4, with U4 from ChebyshevU:

In[8]:=
#cas (ChebyshevU 4 x)
Out[8]=

polynomial with integer coefficients

16x4−12x2+1
16*x^4 - 12*x^2 + 1
Domain
Polynomial.Chebyshev.U R 4, every commutative ring R : Type
Input (polynomial in x)
ChebyshevU 4 x

Checked by Lean’s kernel: Monomial expansion of ChebyshevU 4

∀ (R : Type) [inst : CommRing R],
  Polynomial.Chebyshev.U R 4 = 16 * Polynomial.X ^ 4 - 12 * Polynomial.X ^ 2 + 1
The certificate: 1 checked step
  1. Monomial expansion of ChebyshevU 4

    ∀ (R : Type) [inst : CommRing R],
      Polynomial.Chebyshev.U R 4 = 16 * Polynomial.X ^ 4 - 12 * Polynomial.X ^ 2 + 1

    Checked by Lean’s kernel

Possible Issues (3)

The degree is at most 80. Mathlib’s recurrence Polynomial.Chebyshev.T_add_two gives higher degrees from two lower ones:

In[9]:=
#cas (ChebyshevT 81 x)
Out[9]=

Error

ChebyshevT accepts degrees up to 80

[N d] evaluates at a number, not at a variable:

In[10]:=
#cas [N 10] (ChebyshevT 3 x)
Out[10]=

Error

`[N d]` evaluates `ChebyshevT n x` at a number; `#cas (ChebyshevT 3 x)` gives the polynomial

The second argument is a variable or a rational number, not an expression in a variable:

In[11]:=
#cas (ChebyshevT 2 (x + 1))
Out[11]=

Error

the second argument of `ChebyshevT n x` is a variable, for the polynomial, or a rational number, for its value

See Also

ChebyshevU · LegendreP · HermiteHe · expand · N