Function of #cas

BesselJ

Proved decimal enclosures of Mathlib’s Bessel function Complex.besselJ at an integer order and a rational point.

#cas [N d] (BesselJ n q)
proves a decimal enclosure of width at most 10−d of the Bessel function Jn(q) at an integer order n and a rational q, and prints it.

BesselJ gives you digits of the Bessel function of the first kind, and a proof that they are right. The function is Mathlib’s Complex.besselJ. The answer is a decimal interval of width at most 10−d, with a theorem that Jn(q) is a real number inside it. The call computes enclosures only, so you always say how many digits you want with [N d].

Details and Options

  • n is an integer with |n|≤50, q a rational with |q|≤50 and a denominator of at most 1000, and 1≤d≤30.
  • The theorem is ∃ r : ℝ, Complex.besselJ n q = r ∧ a ≤ r ∧ r ≤ b ∧ b - a ≤ 1 / 10 ^ d for the printed interval [a,b], so the width is part of the theorem. Here d bounds the width of the interval. It does not promise d significant digits, as N does for a closed real expression: near a zero of Jn the interval gives fewer.
  • The kernel checks a partial sum of the power series with a bound on its tail. The Output line says how many terms of the series the check used.
  • At q=0 the enclosure is a point and the output is the exact value: J0(0)=1, and Jn(0)=0 otherwise. A negative order uses J−n=(−1)nJn, Mathlib’s Complex.besselJ_neg_int.
  • The call computes enclosures only, so #cas (BesselJ n q) is refused and points to #cas [N d] (BesselJ n q). Mathlib’s Complex.besselJ_zero gives the exact value at 0.
  • There are no options.

Examples (10)#

Basic Examples (1)

Ten proved digits of J0(1):

In[1]:=
#cas [N 10] (BesselJ 0 1)
Out[1]=

decimal enclosure of width at most 10^-10, with 8 terms of the series

[0.76519768655, 0.76519768656]
[0.76519768655, 0.76519768656]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ 0 1

∃ r,
  Complex.besselJ ↑0 ↑1 = ↑r ∧
    ↑(15303953731 / 20000000000) ≤ r ∧
      r ≤ ↑(4782485541 / 6250000000) ∧ ↑(4782485541 / 6250000000) - ↑(15303953731 / 20000000000) ≤ 1 / 10 ^ 10
The certificate: 1 checked step
  1. Enclosure of BesselJ 0 1

    ∃ r,
      Complex.besselJ ↑0 ↑1 = ↑r ∧
        ↑(15303953731 / 20000000000) ≤ r ∧
          r ≤ ↑(4782485541 / 6250000000) ∧ ↑(4782485541 / 6250000000) - ↑(15303953731 / 20000000000) ≤ 1 / 10 ^ 10

    Checked by Lean’s kernel

Scope (3)

A higher order at a larger point:

In[2]:=
#cas [N 10] (BesselJ 2 10)
Out[2]=

decimal enclosure of width at most 10^-10, with 22 terms of the series

[0.25463031368, 0.25463031369]
[0.25463031368, 0.25463031369]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ 2 10

∃ r,
  Complex.besselJ ↑2 ↑10 = ↑r ∧
    ↑(3182878921 / 12500000000) ≤ r ∧
      r ≤ ↑(25463031369 / 100000000000) ∧
        ↑(25463031369 / 100000000000) - ↑(3182878921 / 12500000000) ≤ 1 / 10 ^ 10
The certificate: 1 checked step
  1. Enclosure of BesselJ 2 10

    ∃ r,
      Complex.besselJ ↑2 ↑10 = ↑r ∧
        ↑(3182878921 / 12500000000) ≤ r ∧
          r ≤ ↑(25463031369 / 100000000000) ∧
            ↑(25463031369 / 100000000000) - ↑(3182878921 / 12500000000) ≤ 1 / 10 ^ 10

    Checked by Lean’s kernel


A negative rational point:

In[3]:=
#cas [N 20] (BesselJ 1 (-7/3))
Out[3]=

decimal enclosure of width at most 10^-20, with 15 terms of the series

[−0.533700789836125818642, −0.533700789836125818641]
[-0.533700789836125818642, -0.533700789836125818641]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ 1 -7/3

∃ r,
  Complex.besselJ ↑1 ↑(-(7 / 3)) = ↑r ∧
    ↑(-(266850394918062909321 / 500000000000000000000)) ≤ r ∧
      r ≤ ↑(-(533700789836125818641 / 1000000000000000000000)) ∧
        ↑(-(533700789836125818641 / 1000000000000000000000)) -
            ↑(-(266850394918062909321 / 500000000000000000000)) ≤
          1 / 10 ^ 20
The certificate: 1 checked step
  1. Enclosure of BesselJ 1 -7/3

    ∃ r,
      Complex.besselJ ↑1 ↑(-(7 / 3)) = ↑r ∧
        ↑(-(266850394918062909321 / 500000000000000000000)) ≤ r ∧
          r ≤ ↑(-(533700789836125818641 / 1000000000000000000000)) ∧
            ↑(-(533700789836125818641 / 1000000000000000000000)) -
                ↑(-(266850394918062909321 / 500000000000000000000)) ≤
              1 / 10 ^ 20

    Checked by Lean’s kernel


At 0 the enclosure is a point, and the report prints the exact value J0(0)=1:

In[4]:=
#cas [N 5] (BesselJ 0 0)
Out[4]=

exact value

1
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ 0 0

∃ r, Complex.besselJ ↑0 ↑0 = ↑r ∧ ↑1 ≤ r ∧ r ≤ ↑1 ∧ ↑1 - ↑1 ≤ 1 / 10 ^ 5
The certificate: 1 checked step
  1. Enclosure of BesselJ 0 0

    ∃ r, Complex.besselJ ↑0 ↑0 = ↑r ∧ ↑1 ≤ r ∧ r ≤ ↑1 ∧ ↑1 - ↑1 ≤ 1 / 10 ^ 5

    Checked by Lean’s kernel

Applications (1)

A proof can take an enclosure as a hypothesis, here a coarser one than the printed interval, and show that J0(1)>0:

In[5]:=
theorem besselJ_zero_one_pos
    (h : ∃ r : ℝ, Complex.besselJ (0 : ℂ) (1 : ℂ) = r ∧ 3 / 4 ≤ r ∧ r ≤ 4 / 5) :
    ∃ r : ℝ, Complex.besselJ (0 : ℂ) (1 : ℂ) = r ∧ 0 < r := by
  obtain ⟨r, hr, hlo, -⟩ := h
  exact ⟨r, hr, by linarith⟩

#print axioms besselJ_zero_one_pos
Out[5]=

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

Properties and Relations (1)

A negative order uses J−n=(−1)nJn, so J−2(12)=J2(12) is positive and J−3(12)=−J3(12) is negative:

In[6]:=
#cas [N 5] (BesselJ (-2) (1/2))
Out[6]=

decimal enclosure of width at most 10^-5, with 3 terms of the series

[0.030604, 0.030605]
[0.030604, 0.030605]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ -2 1/2

∃ r,
  Complex.besselJ ↑(-2) ↑(1 / 2) = ↑r ∧
    ↑(7651 / 250000) ≤ r ∧ r ≤ ↑(6121 / 200000) ∧ ↑(6121 / 200000) - ↑(7651 / 250000) ≤ 1 / 10 ^ 5
The certificate: 1 checked step
  1. Enclosure of BesselJ -2 1/2

    ∃ r,
      Complex.besselJ ↑(-2) ↑(1 / 2) = ↑r ∧
        ↑(7651 / 250000) ≤ r ∧ r ≤ ↑(6121 / 200000) ∧ ↑(6121 / 200000) - ↑(7651 / 250000) ≤ 1 / 10 ^ 5

    Checked by Lean’s kernel

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

decimal enclosure of width at most 10^-5, with 3 terms of the series

[−0.002564, −0.002563]
[-0.002564, -0.002563]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ -3 1/2

∃ r,
  Complex.besselJ ↑(-3) ↑(1 / 2) = ↑r ∧
    ↑(-(641 / 250000)) ≤ r ∧ r ≤ ↑(-(2563 / 1000000)) ∧ ↑(-(2563 / 1000000)) - ↑(-(641 / 250000)) ≤ 1 / 10 ^ 5
The certificate: 1 checked step
  1. Enclosure of BesselJ -3 1/2

    ∃ r,
      Complex.besselJ ↑(-3) ↑(1 / 2) = ↑r ∧
        ↑(-(641 / 250000)) ≤ r ∧ r ≤ ↑(-(2563 / 1000000)) ∧ ↑(-(2563 / 1000000)) - ↑(-(641 / 250000)) ≤ 1 / 10 ^ 5

    Checked by Lean’s kernel

Possible Issues (3)

#cas gives no exact value of BesselJ, and the message points to [N d]:

In[8]:=
#cas (BesselJ 0 1)
Out[8]=

Error

`#cas` computes no exact value of `BesselJ n x`; `#cas [N d] (BesselJ n x)` gives its digits

Mathlib defines Complex.besselJ at every complex order, but the series check is written for integer orders:

In[9]:=
#cas [N 5] (BesselJ (1/2) 1)
Out[9]=

Error

BesselJ accepts integer orders

The point is a rational with |q|≤50 and a denominator of at most 1000:

In[10]:=
#cas [N 5] (BesselJ 0 51)
Out[10]=

Error

BesselJ accepts rational points with |q| ≤ 50 and a denominator of at most 1000

Neat Examples (1)

Thirty decimals of J0(50), at the end of the range, from 97 terms of the series:

In[11]:=
#cas [N 30] (BesselJ 0 50)
Out[11]=

decimal enclosure of width at most 10^-30, with 97 terms of the series

[0.0558123276692518150047504785294, 0.0558123276692518150047504785295]
[0.0558123276692518150047504785294, 0.0558123276692518150047504785295]
Domain
Bessel function J_n at a rational point

Checked by Lean’s kernel: Enclosure of BesselJ 0 50

∃ r,
  Complex.besselJ ↑0 ↑50 = ↑r ∧
    ↑(279061638346259075023752392647 / 5000000000000000000000000000000) ≤ r ∧
      r ≤ ↑(111624655338503630009500957059 / 2000000000000000000000000000000) ∧
        ↑(111624655338503630009500957059 / 2000000000000000000000000000000) -
            ↑(279061638346259075023752392647 / 5000000000000000000000000000000) ≤
          1 / 10 ^ 30
The certificate: 1 checked step
  1. Enclosure of BesselJ 0 50

    ∃ r,
      Complex.besselJ ↑0 ↑50 = ↑r ∧
        ↑(279061638346259075023752392647 / 5000000000000000000000000000000) ≤ r ∧
          r ≤ ↑(111624655338503630009500957059 / 2000000000000000000000000000000) ∧
            ↑(111624655338503630009500957059 / 2000000000000000000000000000000) -
                ↑(279061638346259075023752392647 / 5000000000000000000000000000000) ≤
              1 / 10 ^ 30

    Checked by Lean’s kernel

See Also

erf · N · enclose