You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Over the complex numbers an exponential equation is answered with its principal root only #2319
Over the complex numbers, the default codomain, Solve answers an exponential equation with its principal root only:
Solve("x")
answer
the roots
e^x = 2
{ ln(2) }
ln(2) + 2 pi i n for every whole n
e^x = -1
{ ln(-1) }
(2n + 1) pi i
e^(2x) - 3e^x + 2 = 0
{ 0, ln(2) }
2 pi i n and ln(2) + 2 pi i n
2^x = 5
{ log(2, 5) }
log(2, 5) + 2 pi i n / ln(2)
The other periodic and multivalued routes already answer the whole family with an integer parameter: sin(x) = 0 is { 2 * pi * n_1, pi + 2 * pi * n_1 }, and x e^x = 2 is { lambertw(n_1, 2) }. A finite set says these are all the roots, so the exponential answers are incomplete. Powf's inversion carries a TODO for it: "determine how we should return periodic roots".
A cross-check of random exponential equations against a Newton search finds every root it reaches, and these answers lack them. Over the reals the principal root is the only one, and nothing there changes.
Two ways:
Answer the family over the complex numbers, ln(c) + 2 pi i n_1, as the trigonometric equations and the Lambert W route do, keeping ln(c) over the reals. That changes the answer to every exponential equation in the default codomain, and whatever reads those answers (substitutions, systems) has to take a parameter.
Keep the principal root and say so where Solve is documented, as a known incompleteness.
I'd go with 1, since it's what the rest of the solver already does. Which do you prefer?
For marking n as whole, I measured two spellings on master:
{ 2 pi n provided n in ZZ }
union({ 2 pi n }, n in ZZ)
4 pi in
undecided
yes
3 pi in
undecided
undecided
n
free, so it can clash with an n elsewhere
bound
union(A_n, n in ZZ) is the indexed union from #1409. It already exists and answers membership through exists n in ZZ. I'd use it for every family, so the trigonometric and Lambert W answers read the same as the new exponential ones. The cost is that a periodic answer stops being a finite set, so whatever takes an answer apart (systems, substituting roots back) has to read the union. I'll measure that on the branch.
Is the union OK, or do you prefer provided n in ZZ?
A recommendation: the whole family, written as an indexed union, union({ln(2) + 2*pi*i*n}, n in ZZ).
Today (master 3abd4d9be), over the complex numbers: e^x = 2 is { ln(2) }, 2^x = 5 is { log(2, 5) }, and sin(e^x) = 0 is { ln(2*pi*n_1), ln(pi + 2*pi*n_1) }, which loses the inner family too. A finite set claims to be every root, so these are incomplete rather than partial.
Union, not provided. The union binds n and decides membership: 4*pi in union({2*pi*n}, n in ZZ) is decided as yes, while with provided n in ZZ, or today's free n_1, it is undecided. The union is SymPy's ImageSet over Integers (solveset) in the library's notation; Wolfram writes C[1] ∈ Integers as a ConditionalExpression (Solve).
Consistency: move the trigonometric and Lambert W families (2*pi*n_1, lambertw(n_1, 2)) to the union in the same change, and keep a free n_1 only in system rows, where a matrix entry cannot bind it. Support parametric solutions #212's option 1 then names it (n_1, ZZ), so the two decisions fit together.
Over the reals, keep ln(c) through the codomain.
What it needs, in order:
The exponential's period under forall. A family is checked by substituting it back, as forall n in ZZ : residual = 0. The trigonometric families pass: forall n in ZZ : sin(x + 2*pi*n) = sin(x) is True. These would not: forall n in ZZ : e^(2*pi*i*n) = 1, forall n in ZZ : e^(x + 2*pi*i*n) = e^x and forall n in ZZ : 2^(log(2, 5) + 2*pi*i*n/ln(2)) = 5 are all left undecided. A whole number of periods has to come out of an exponential as it does out of a sine.
A second index, and an index set without 0.sin(e^x) = 0 is e^x = pi*k for a whole k other than 0, since e^x is never 0. Its roots are union(union({ln(pi*k) + 2*pi*i*m}, m in ZZ), k in ZZ \ {0}). That parses today, and ln(3*pi) + 4*pi*i in it is decided as yes. Today's answer has ln(0) at n_1 = 0.
Readers of a root set. Everything that takes a root set apart (systems, substituting roots back, the root-completeness harnesses) has to read a union.
#2458, FreeVariables reporting the union's index as free, is fixed (#2464).
That is medium to large, and it changes every complex exponential and trigonometric answer, so it needs a breaking-change entry. It fits 2.8 as a fix for incomplete answers. If the trigonometric re-spelling is judged a change of representation rather than a fix, it can split off to v3.
Edited 2026-11-16: re-measured on 3abd4d9be. #2458 was listed as the first step and is fixed; steps 1 and 2 are new.
Activity
Rafael-SOWNet commentedon Nov 1, 2026
The same holds for a trigonometric equation solved through
e^(ix), as a polynomial in it withx = ln(root) / i. Those lose their families too:Solve("x")cos(x) = 3 sin(x){ ln(sqrt(4/5 + 3/5 i)) / i, ln(-sqrt(4/5 + 3/5 i)) / i }arctan(1/3) + pi nsin(2x) = sin(x){ ln(-1) / i, 0, … }2 pi n,pi + 2 pi n,±pi/3 + 2 pi ntan(x) = 1/3{ arctan(1/3) + pi * n_1 }So with option 1 the families would come back for these as well, from the same place.
Happypig375 commentedon Nov 2, 2026
need to indicate that n is integer as well, maybe
provided n in ZZ?Happypig375 commentedon Nov 2, 2026
solve is supposed to do for all solutions; the "principal" solution is probably the one when n is 0?
Rafael-SOWNet commentedon Nov 2, 2026
Yes,
n = 0is the principal root,ln(c).For marking
nas whole, I measured two spellings on master:{ 2 pi n provided n in ZZ }union({ 2 pi n }, n in ZZ)4 pi in3 pi innnelsewhereunion(A_n, n in ZZ)is the indexed union from #1409. It already exists and answers membership throughexists n in ZZ. I'd use it for every family, so the trigonometric and Lambert W answers read the same as the new exponential ones. The cost is that a periodic answer stops being a finite set, so whatever takes an answer apart (systems, substituting roots back) has to read the union. I'll measure that on the branch.Is the union OK, or do you prefer
provided n in ZZ?Rafael-SOWNet commentedon Nov 15, 2026
A recommendation: the whole family, written as an indexed union,
union({ln(2) + 2*pi*i*n}, n in ZZ).Today (master
3abd4d9be), over the complex numbers:e^x = 2is{ ln(2) },2^x = 5is{ log(2, 5) }, andsin(e^x) = 0is{ ln(2*pi*n_1), ln(pi + 2*pi*n_1) }, which loses the inner family too. A finite set claims to be every root, so these are incomplete rather than partial.provided. The union bindsnand decides membership:4*pi in union({2*pi*n}, n in ZZ)is decided as yes, while withprovided n in ZZ, or today's freen_1, it is undecided. The union is SymPy'sImageSetoverIntegers(solveset) in the library's notation; Wolfram writesC[1] ∈ Integersas aConditionalExpression(Solve).2*pi*n_1,lambertw(n_1, 2)) to the union in the same change, and keep a freen_1only in system rows, where a matrix entry cannot bind it. Support parametric solutions #212's option 1 then names it(n_1, ZZ), so the two decisions fit together.ln(c)through the codomain.What it needs, in order:
forall. A family is checked by substituting it back, asforall n in ZZ : residual = 0. The trigonometric families pass:forall n in ZZ : sin(x + 2*pi*n) = sin(x)isTrue. These would not:forall n in ZZ : e^(2*pi*i*n) = 1,forall n in ZZ : e^(x + 2*pi*i*n) = e^xandforall n in ZZ : 2^(log(2, 5) + 2*pi*i*n/ln(2)) = 5are all left undecided. A whole number of periods has to come out of an exponential as it does out of a sine.sin(e^x) = 0ise^x = pi*kfor a wholekother than 0, sincee^xis never 0. Its roots areunion(union({ln(pi*k) + 2*pi*i*m}, m in ZZ), k in ZZ \ {0}). That parses today, andln(3*pi) + 4*pi*i init is decided as yes. Today's answer hasln(0)atn_1 = 0.#2458,
FreeVariablesreporting the union's index as free, is fixed (#2464).That is medium to large, and it changes every complex exponential and trigonometric answer, so it needs a breaking-change entry. It fits 2.8 as a fix for incomplete answers. If the trigonometric re-spelling is judged a change of representation rather than a fix, it can split off to v3.
Edited 2026-11-16: re-measured on
3abd4d9be. #2458 was listed as the first step and is fixed; steps 1 and 2 are new.Take whole periods out of an exponential under a quantifier over the …
Answer a family of roots as an indexed union, and an exponential equa…
Check each member of a family of roots in CasBench
Record the families of roots in BREAKING-CHANGES.md
Initialize one half exactly in the trigonometric angle expansion
Read a value linear in a whole parameter off its terms, not by gather…
Meet a family of roots with a set of reals in its real members
Record a family met with the reals in BREAKING-CHANGES.md
Read a family of roots in the Modenov corpus