Euler and Picard iterations for an initial value problem
DefinitionMetodosNumericos_edoDefsThe Euler iterates with step , and the Picard iterates , .
import Mathlib
namespace MetodosNumericos
/-- Euler's method for the initial value problem `y' = f(x, y)`, `y(x₀) = y₀`,
with step `h`: `y₀` given and `y_{i+1} = yᵢ + h f(xᵢ, yᵢ)` where `xᵢ = x₀ + i h`. -/
noncomputable def eulerSeq (f : ℝ → ℝ → ℝ) (x0 y0 h : ℝ) : ℕ → ℝ
| 0 => y0
| i + 1 => eulerSeq f x0 y0 h i + h * f (x0 + i * h) (eulerSeq f x0 y0 h i)
/-- The Picard iterates for `y' = f(x, y)`, `y(x₀) = y₀`:
`y₀(x) = y₀` and `y_{k+1}(x) = y₀ + ∫_{x₀}^{x} f(t, y_k(t)) dt`. -/
noncomputable def picardSeq (f : ℝ → ℝ → ℝ) (x0 y0 : ℝ) : ℕ → (ℝ → ℝ)
| 0 => fun _ => y0
| k + 1 => fun x => y0 + ∫ t in x0..x, f t (picardSeq f x0 y0 k t)
end MetodosNumericosRead-back
What the Lean code literally says, in plain math · self-authored-by-drafting-agent (non-blind)
Disclosure: this read-back is not blind. It was written by the same agent that drafted the Lean code, at the explicit instruction of the mission's human owner, and not by an independent auditor with fresh context.
Two definitions are given, both parameterised by a function of two real variables and reals , .
The first also takes a real and defines a sequence of reals indexed by the natural numbers: its value at is , and its value at is
where is cast into . Nothing requires .
The second defines a sequence of functions of a real variable: the function at index is the constant function with value , and the function at index sends to
the interval integral with respect to Lebesgue measure. The integral is a total operation: if the integrand is not integrable the value is by convention, so the definition imposes no continuity or integrability hypothesis, and the sign convention of the interval integral applies when .