Guide
Equations
Polynomial equations, systems and inequalities solved completely, and certified roots of other equations in an interval.
Before I solve anything, I ask myself whether I need every solution or one root in a particular interval. For a polynomial equation or system, SymLean gives every real solution, and the theorem says that the printed list holds all of them, so nothing is missing. That completeness is the important part. Rational solutions are exact. An irrational one is a closed form such as in solve, or it is named by an interval that holds exactly one solution. An inequality is reduced to a union of intervals. And for an equation with other functions, such as , I ask for a certified root in an interval.
Exact solutions
Roots
Newton showed his method on this cubic. It has one real solution, and the theorem says that there are no others. The decimal is truncated to 20 places, and the theorem puts the root in a rational interval of width :
#cas [roots x] (x^3 - 2*x - 5 = 0)
the only real solution, by 20 decimals, truncated
2.09455148154232659148- Input (polynomial equation)
(x^3 - 2*x - 5 = 0)
Checked by Lean’s kernel: Complete list of real solutions
(∃! x,
x ∈ Set.Ioo (209455148154232659148 / 10 ^ 20) (209455148154232659149 / 10 ^ 20) ∧ x ^ 3 - 2 * x - 5 = 0) ∧
∀ (x : ℝ),
x ^ 3 - 2 * x - 5 = 0 → x ∈ Set.Ioo (209455148154232659148 / 10 ^ 20) (209455148154232659149 / 10 ^ 20)from CAS.Polynomial.RealRoot.of_exprRootCheck
The certificate: 1 checked step
Complete list of real solutions
(∃! x, x ∈ Set.Ioo (209455148154232659148 / 10 ^ 20) (209455148154232659149 / 10 ^ 20) ∧ x ^ 3 - 2 * x - 5 = 0) ∧ ∀ (x : ℝ), x ^ 3 - 2 * x - 5 = 0 → x ∈ Set.Ioo (209455148154232659148 / 10 ^ 20) (209455148154232659149 / 10 ^ 20)
The computation
Certified isolation
Square-free polynomial of degree 3, Cauchy bound 8, 6 cells Guarantee: the listed solutions are distinct, each rational is a solution, each decimal interval contains exactly one solution, and there are no other real solutions
No algebra solves this next equation, so I ask for a root in . The theorem says that exactly one solution lies within of the printed value:
#cas [findRoot x in [0, 1]] (cos x = x)
certified simple root
x = 0.7390851332 ± 10^-10- Domain
x ∈ [0, 1]- Input (equation in ℝ)
(cos x = x)
Checked by Lean’s kernel: Unique root in the interval
∃! x, x ∈ Set.Icc (7390851331 / 10 ^ 10) (7390851333 / 10 ^ 10) ∧ Real.cos x = x
The certificate: 1 checked step
Unique root in the interval
∃! x, x ∈ Set.Icc (7390851331 / 10 ^ 10) (7390851333 / 10 ^ 10) ∧ Real.cos x = x
The computation
Certified root
Sign change found by interval sampling and bisection (not proof) Unique root in [0.7390851331, 0.7390851333], within 10^-10 of 0.7390851332: endpoint signs and a derivative of one sign, checked by the kernel
The exact modes stop at polynomials. solve and roots take polynomial equations with rational coefficients, reduce takes polynomial relations and quotients compared with 0, and for other equations findRoot is the mode. A nonlinear system goes through a Gröbner basis and needs finitely many complex solutions, so a circle on its own is refused. findRoot finds one simple root at a time. It samples the function at 65 points of the interval and narrows the first sign change from the left, and then the kernel checks opposite signs at the ends of a small interval and a derivative of one sign on it. That’s also where it stops. It refuses a double root, or any root where the derivative vanishes, two roots closer than the sample spacing, and a sign change across a pole. For a polynomial with a multiple root, roots is the mode to use.
The report of a nonlinear system, as on the solve page, uses three words that need a gloss. solve looks for a lexicographic Gröbner basis in shape position: one polynomial in a single quantity , and for each unknown an equation with a polynomial . The polynomial is the eliminant. Its real roots are isolated with a certificate that the kernel checks, and each root gives one solution, read off the equations . The quantity is one of the unknowns when that gives such a basis. When each unknown takes the same value at two of the solutions, is a separating form instead: a combination of the unknowns, tried for , and the report names it.
