Mode of #cas
ndsolve
Certified enclosures of the solution of a polynomial initial-value problem, with a theorem of existence and uniqueness.
#cas [ndsolve y t in [t₀, T], y t₀ = y₀] (y' = f)#cas [ndsolve y t in [t₀, T], y t₀ = y₀, at [τ₁, …]] (y' = f)#cas (digits := d) [ndsolve y t in [t₀, T], y t₀ = y₀] (y' = f)An initial-value problem is often easier to study through bounds on its solution than through a closed formula. ndsolve gives you those bounds as a theorem with three parts: a solution exists on the whole interval, it is the only one, and at each output time it lies in the printed interval.
We get the enclosures from a piecewise Taylor approximation, and the kernel checks it piece by piece. If your equation is linear and has an exact solution, dsolve gives you the formula instead.
Examples (19)#
Basic Examples (2)
The solution of y' = y with y 0 = 1 is , and its enclosure at 1 holds :
#cas [ndsolve y t in [0, 1], y 0 = 1] (y' = y)
certified enclosures of width at most 10^-6; the solution exists and is unique on [0, 1] (4 pieces)
y(1) ∈ [2.7182818, 2.7182819]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = y), y 0 = 1
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → 2.7182818 ≤ y 1 ∧ y 1 ≤ 2.7182819 ∧ 2.7182819 - 2.7182818 ≤ 1 / 10 ^ 6
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → 2.7182818 ≤ y 1 ∧ y 1 ≤ 2.7182819 ∧ 2.7182819 - 2.7182818 ≤ 1 / 10 ^ 6
A Riccati equation, at the output times and :
#cas [ndsolve y t in [0, 1], y 0 = 1/2, at [1/2, 1]] (y' = y ^ 2 + t)
certified enclosures of width at most 10^-6; the solution exists and is unique on [0, 1] (6 pieces)
y(1/2) ∈ [0.8242620, 0.8242621], y(1) ∈ [2.1278712, 2.1278713]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = y ^ 2 + t), y 0 = 1/2
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 1 / 2 ∧ IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 / 2 → IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → z 0 = 1 / 2 → IsIntegralCurveOn z (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 / 2 → IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → (0.8242620 ≤ y (1 / 2) ∧ y (1 / 2) ≤ 0.8242621 ∧ 0.8242621 - 0.8242620 ≤ 1 / 10 ^ 6) ∧ 2.1278712 ≤ y 1 ∧ y 1 ≤ 2.1278713 ∧ 2.1278713 - 2.1278712 ≤ 1 / 10 ^ 6
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 1 / 2 ∧ IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 / 2 → IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → z 0 = 1 / 2 → IsIntegralCurveOn z (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 / 2 → IsIntegralCurveOn y (fun t y ↦ y ^ 2 + t) (Set.Icc 0 1) → (0.8242620 ≤ y (1 / 2) ∧ y (1 / 2) ≤ 0.8242621 ∧ 0.8242621 - 0.8242620 ≤ 1 / 10 ^ 6) ∧ 2.1278712 ≤ y 1 ∧ y 1 ≤ 2.1278713 ∧ 2.1278713 - 2.1278712 ≤ 1 / 10 ^ 6
Scope (3)
Other names for the function and the variable, an interval that starts at , and an output time at the start:
#cas [ndsolve x s in [-1, 1], x (-1) = 2, at [-1, 0, 1]] (x' = s * x - x ^ 2)
certified enclosures of width at most 10^-6; the solution exists and is unique on [-1, 1] (14 pieces)
x(-1) ∈ [2.0000000, 2.0000000], x(0) ∈ [0.4952166, 0.4952167], x(1) ∈ [0.5129370, 0.5129371]- Domain
s ∈ [-1, 1]- Input (polynomial initial value problem)
(x' = s * x - x ^ 2), x (-1) = 2
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ x, x (-1) = 2 ∧ IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1)) ∧ (∀ (x z : ℝ → ℝ), x (-1) = 2 → IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → z (-1) = 2 → IsIntegralCurveOn z (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → Set.EqOn x z (Set.Icc (-1) 1)) ∧ ∀ (x : ℝ → ℝ), x (-1) = 2 → IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → (2.0000000 ≤ x (-1) ∧ x (-1) ≤ 2.0000000 ∧ 2.0000000 - 2.0000000 ≤ 1 / 10 ^ 6) ∧ (0.4952166 ≤ x 0 ∧ x 0 ≤ 0.4952167 ∧ 0.4952167 - 0.4952166 ≤ 1 / 10 ^ 6) ∧ 0.5129370 ≤ x 1 ∧ x 1 ≤ 0.5129371 ∧ 0.5129371 - 0.5129370 ≤ 1 / 10 ^ 6
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ x, x (-1) = 2 ∧ IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1)) ∧ (∀ (x z : ℝ → ℝ), x (-1) = 2 → IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → z (-1) = 2 → IsIntegralCurveOn z (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → Set.EqOn x z (Set.Icc (-1) 1)) ∧ ∀ (x : ℝ → ℝ), x (-1) = 2 → IsIntegralCurveOn x (fun s x ↦ s * x - x ^ 2) (Set.Icc (-1) 1) → (2.0000000 ≤ x (-1) ∧ x (-1) ≤ 2.0000000 ∧ 2.0000000 - 2.0000000 ≤ 1 / 10 ^ 6) ∧ (0.4952166 ≤ x 0 ∧ x 0 ≤ 0.4952167 ∧ 0.4952167 - 0.4952166 ≤ 1 / 10 ^ 6) ∧ 0.5129370 ≤ x 1 ∧ x 1 ≤ 0.5129371 ∧ 0.5129371 - 0.5129370 ≤ 1 / 10 ^ 6
Rational endpoints and a rational initial value:
#cas (digits := 8) [ndsolve y t in [-1/2, 3/4], y (-1/2) = -3/7, at [0, 3/4]] (y' = t ^ 2 - y / 3)
certified enclosures of width at most 10^-8; the solution exists and is unique on [-1/2, 3/4] (8 pieces)
y(0) ∈ [-0.325987844, -0.325987843], y(3/4) ∈ [-0.121621874, -0.121621873]- Domain
t ∈ [-1/2, 3/4]- Input (polynomial initial value problem)
(y' = t ^ 2 - y / 3), y (-1/2) = -3/7
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y,
y (-(1 / 2)) = -(3 / 7) ∧ IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4))) ∧
(∀ (y z : ℝ → ℝ),
y (-(1 / 2)) = -(3 / 7) →
IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) →
z (-(1 / 2)) = -(3 / 7) →
IsIntegralCurveOn z (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) →
Set.EqOn y z (Set.Icc (-(1 / 2)) (3 / 4))) ∧
∀ (y : ℝ → ℝ),
y (-(1 / 2)) = -(3 / 7) →
IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) →
(-0.325987844 ≤ y 0 ∧ y 0 ≤ -0.325987843 ∧ -0.325987843 + 0.325987844 ≤ 1 / 10 ^ 8) ∧
-0.121621874 ≤ y (3 / 4) ∧ y (3 / 4) ≤ -0.121621873 ∧ -0.121621873 + 0.121621874 ≤ 1 / 10 ^ 8The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y (-(1 / 2)) = -(3 / 7) ∧ IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4))) ∧ (∀ (y z : ℝ → ℝ), y (-(1 / 2)) = -(3 / 7) → IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) → z (-(1 / 2)) = -(3 / 7) → IsIntegralCurveOn z (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) → Set.EqOn y z (Set.Icc (-(1 / 2)) (3 / 4))) ∧ ∀ (y : ℝ → ℝ), y (-(1 / 2)) = -(3 / 7) → IsIntegralCurveOn y (fun t y ↦ t ^ 2 - y / 3) (Set.Icc (-(1 / 2)) (3 / 4)) → (-0.325987844 ≤ y 0 ∧ y 0 ≤ -0.325987843 ∧ -0.325987843 + 0.325987844 ≤ 1 / 10 ^ 8) ∧ -0.121621874 ≤ y (3 / 4) ∧ y (3 / 4) ≤ -0.121621873 ∧ -0.121621873 + 0.121621874 ≤ 1 / 10 ^ 8
The logistic equation on , where the solution comes close to 1:
#cas (digits := 8) [ndsolve y t in [0, 10], y 0 = 1/10] (y' = y * (1 - y))
certified enclosures of width at most 10^-8; the solution exists and is unique on [0, 10] (13 pieces)
y(10) ∈ [0.999591567, 0.999591568]- Domain
t ∈ [0, 10]- Input (polynomial initial value problem)
(y' = y * (1 - y)), y 0 = 1/10
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 1 / 10 ∧ IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 / 10 → IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → z 0 = 1 / 10 → IsIntegralCurveOn z (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → Set.EqOn y z (Set.Icc 0 10)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 / 10 → IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → 0.999591567 ≤ y 10 ∧ y 10 ≤ 0.999591568 ∧ 0.999591568 - 0.999591567 ≤ 1 / 10 ^ 8
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 1 / 10 ∧ IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 / 10 → IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → z 0 = 1 / 10 → IsIntegralCurveOn z (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → Set.EqOn y z (Set.Icc 0 10)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 / 10 → IsIntegralCurveOn y (fun t y ↦ y * (1 - y)) (Set.Icc 0 10) → 0.999591567 ≤ y 10 ∧ y 10 ≤ 0.999591568 ∧ 0.999591568 - 0.999591567 ≤ 1 / 10 ^ 8
Options (2)
(digits := 10) gives enclosures of width at most . The solution here is :
#cas (digits := 10) [ndsolve y t in [0, 3], y 0 = 0, at [1, 2, 3]] (y' = 1 - y ^ 2)
certified enclosures of width at most 10^-10; the solution exists and is unique on [0, 3] (12 pieces)
y(1) ∈ [0.76159415595, 0.76159415596], y(2) ∈ [0.96402758007, 0.96402758008], y(3) ∈ [0.99505475368, 0.99505475369]- Domain
t ∈ [0, 3]- Input (polynomial initial value problem)
(y' = 1 - y ^ 2), y 0 = 0
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → Set.EqOn y z (Set.Icc 0 3)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → (0.76159415595 ≤ y 1 ∧ y 1 ≤ 0.76159415596 ∧ 0.76159415596 - 0.76159415595 ≤ 1 / 10 ^ 10) ∧ (0.96402758007 ≤ y 2 ∧ y 2 ≤ 0.96402758008 ∧ 0.96402758008 - 0.96402758007 ≤ 1 / 10 ^ 10) ∧ 0.99505475368 ≤ y 3 ∧ y 3 ≤ 0.99505475369 ∧ 0.99505475369 - 0.99505475368 ≤ 1 / 10 ^ 10
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → Set.EqOn y z (Set.Icc 0 3)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 - y ^ 2) (Set.Icc 0 3) → (0.76159415595 ≤ y 1 ∧ y 1 ≤ 0.76159415596 ∧ 0.76159415596 - 0.76159415595 ≤ 1 / 10 ^ 10) ∧ (0.96402758007 ≤ y 2 ∧ y 2 ≤ 0.96402758008 ∧ 0.96402758008 - 0.96402758007 ≤ 1 / 10 ^ 10) ∧ 0.99505475368 ≤ y 3 ∧ y 3 ≤ 0.99505475369 ∧ 0.99505475369 - 0.99505475368 ≤ 1 / 10 ^ 10
A decaying solution keeps its accuracy, because the Lipschitz bound in the check is one-sided, so the negative slope of -10 * y costs only a small positive constant. Here , within . In the theorem, Lean prints the decimals 0.0000453999297 and 0.0000453999298 as 453999297e-13 and 453999298e-13:
#cas (digits := 12) [ndsolve y t in [0, 1], y 0 = 1] (y' = -10 * y)
certified enclosures of width at most 10^-12; the solution exists and is unique on [0, 1] (15 pieces)
y(1) ∈ [0.0000453999297, 0.0000453999298]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = -10 * y), y 0 = 1
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ -10 * y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1) → 453999297e-13 ≤ y 1 ∧ y 1 ≤ 453999298e-13 ∧ 453999298e-13 - 453999297e-13 ≤ 1 / 10 ^ 12
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ -10 * y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ -10 * y) (Set.Icc 0 1) → 453999297e-13 ≤ y 1 ∧ y 1 ≤ 453999298e-13 ∧ 453999298e-13 - 453999297e-13 ≤ 1 / 10 ^ 12
Applications (1)
The enclosure of in a proof. cas bounds Real.exp 1 directly, and only the three standard axioms are used:
theorem ndsolve_exp_bounds : 2.7182818 ≤ Real.exp 1 ∧ Real.exp 1 ≤ 2.7182819 := by cas #print axioms ndsolve_exp_bounds
ndsolve_exp_bounds depends on the axioms propext, Classical.choice, Quot.sound.
Properties and Relations (2)
The solution of y' = y with y 0 = 1 is , so the enclosures at and hold and :
#cas (digits := 10) [ndsolve y t in [0, 1], y 0 = 1, at [1/2, 1]] (y' = y)
certified enclosures of width at most 10^-10; the solution exists and is unique on [0, 1] (5 pieces)
y(1/2) ∈ [1.64872127070, 1.64872127071], y(1) ∈ [2.71828182845, 2.71828182846]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = y), y 0 = 1
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → (1.64872127070 ≤ y (1 / 2) ∧ y (1 / 2) ≤ 1.64872127071 ∧ 1.64872127071 - 1.64872127070 ≤ 1 / 10 ^ 10) ∧ 2.71828182845 ≤ y 1 ∧ y 1 ≤ 2.71828182846 ∧ 2.71828182846 - 2.71828182845 ≤ 1 / 10 ^ 10
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 1 ∧ IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → z 0 = 1 → IsIntegralCurveOn z (fun t y ↦ y) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 1 → IsIntegralCurveOn y (fun t y ↦ y) (Set.Icc 0 1) → (1.64872127070 ≤ y (1 / 2) ∧ y (1 / 2) ≤ 1.64872127071 ∧ 1.64872127071 - 1.64872127070 ≤ 1 / 10 ^ 10) ∧ 2.71828182845 ≤ y 1 ∧ y 1 ≤ 2.71828182846 ∧ 2.71828182846 - 2.71828182845 ≤ 1 / 10 ^ 10
When f does not involve y, the solution is a primitive of f. Here , and the enclosure is the single point :
#cas [ndsolve y t in [0, 1], y 0 = 0] (y' = t)
certified enclosures of width at most 10^-6; the solution exists and is unique on [0, 1] (4 pieces)
y(1) ∈ [0.5000000, 0.5000000]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = t), y 0 = 0
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ t) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1) → 0.5000000 ≤ y 1 ∧ y 1 ≤ 0.5000000 ∧ 0.5000000 - 0.5000000 ≤ 1 / 10 ^ 6
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ t) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ t) (Set.Icc 0 1) → 0.5000000 ≤ y 1 ∧ y 1 ≤ 0.5000000 ∧ 0.5000000 - 0.5000000 ≤ 1 / 10 ^ 6
Possible Issues (8)
The solution of y' = y ^ 2 with y 0 = 1 blows up at , and no certified step gets past it. Solve on an interval that ends before 1:
#cas [ndsolve y t in [0, 2], y 0 = 1] (y' = y ^ 2)
Error
ndsolve: no certified step at t = 49841/50000; the solution may blow up there
f must be a polynomial in t and y. For a linear equation, dsolve takes sines, cosines and exponentials of the variable:
#cas [ndsolve y t in [0, 1], y 0 = 1] (y' = sin y)
Error
ndsolve: f must be a polynomial in t and y with rational coefficients
The degree in y is at most 4, and so is the degree in t:
#cas [ndsolve y t in [0, 1], y 0 = 1] (y' = y ^ 5)
Error
ndsolve accepts degree at most 4 in y
The initial condition is at the left end of the interval. To start at 1, write [ndsolve y t in [1, 2], y 1 = 1]:
#cas [ndsolve y t in [0, 1], y 1 = 1] (y' = y)
Error
ndsolve: the initial condition must be at t₀ = 0
The output times lie in the interval:
#cas [ndsolve y t in [0, 1], y 0 = 1, at [2]] (y' = y)
Error
ndsolve: the output time 2 is not in [0, 1]
The interval has length at most 20:
#cas [ndsolve y t in [0, 30], y 0 = 1] (y' = -y)
Error
ndsolve accepts T - t₀ ≤ 20
At most 15 digits:
#cas (digits := 16) [ndsolve y t in [0, 1], y 0 = 1] (y' = y)
Error
ndsolve accepts between 1 and 15 digits
The equation is about the function named in the brackets:
#cas [ndsolve y t in [0, 1], y 0 = 1] (z' = y)
Error
ndsolve: expected an equation y' = f
Neat Examples (1)
The solution of y' = 1 + y ^ 2 with y 0 = 0 is , and the enclosure holds :
#cas [ndsolve y t in [0, 1], y 0 = 0] (y' = 1 + y ^ 2)
certified enclosures of width at most 10^-6; the solution exists and is unique on [0, 1] (5 pieces)
y(1) ∈ [1.5574077, 1.5574078]- Domain
t ∈ [0, 1]- Input (polynomial initial value problem)
(y' = 1 + y ^ 2), y 0 = 0
Checked by Lean’s kernel: Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → 1.5574077 ≤ y 1 ∧ y 1 ≤ 1.5574078 ∧ 1.5574078 - 1.5574077 ≤ 1 / 10 ^ 6
The certificate: 1 checked step
Existence, uniqueness and enclosures
(∃ y, y 0 = 0 ∧ IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1)) ∧ (∀ (y z : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → z 0 = 0 → IsIntegralCurveOn z (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → Set.EqOn y z (Set.Icc 0 1)) ∧ ∀ (y : ℝ → ℝ), y 0 = 0 → IsIntegralCurveOn y (fun t y ↦ 1 + y ^ 2) (Set.Icc 0 1) → 1.5574077 ≤ y 1 ∧ y 1 ≤ 1.5574078 ∧ 1.5574078 - 1.5574077 ≤ 1 / 10 ^ 6
See Also
dsolve · nintegrate · findRoot · enclose · N
