Skip to content

An equation between two powers of numeric bases is answered exactly (#1007) - #1097

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/exponential-two-bases-exact-1007
Aug 27, 2026
Merged

An equation between two powers of numeric bases is answered exactly (#1007)#1097
Rafael-SOWNet merged 1 commit into
masterfrom
fix/exponential-two-bases-exact-1007

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Collaborator

Closes #1007.

3 ^ (x+1) = 2 ^ (x-1) has the exact root -ln(6) / ln(3/2).

before now
"3^(x+1) - 2^(x-1)".SolveEquation("x") { ln(0.04674569822628630438865471319331845734268426895141… ^ (1 / ln(2))) } { -(ln(3) + ln(2)) / (ln(3) + -ln(2)) }
"3^(x+1) - 2^x".SolveEquation("x") a decimal { -ln(3) / (ln(3) + -ln(2)) }
"5^(2x) - 7^(x+3)".SolveEquation("x") { }no answer at all { 3 * ln(7) / (2 * ln(5) + -ln(7)) }
"3^x - 2^x", "2^(2x) - 5·2^x + 4", "ln(x)² - 3ln(x) + 2", … exact unchanged

Why the decimal appeared

The multiplicative solver divides one exponent by the other. For two different integer bases that
ratio is ln(3)/ln(2) — irrational — so InnerSimplified settles it to a decimal and everything
downstream is numeric. The answer then agrees with the exact one to seventeen significant figures
and diverges, which is the signature of a double promoted to a decimal rather than a number that
was computed.

Taking logarithms has no such step: a ^ p = b ^ q is p ln a = q ln b, an ordinary equation the
analytical solver answers exactly. It is tried before the multiplicative solver, because that
is where the exactness is lost.

Both bases must be decidably positive reals — that is what makes ln of them real and the
step an equivalence rather than a branch choice. Anything else declines and the multiplicative
path still gets its turn, so this only ever adds answers.

Two notes on getting there

A trace found in one run what reading the code had not. The first version did not fire at all:
the solver is handed lhs - rhs - 0, so a two-power equation arrives with three terms and the
count guard rejected it. Terms evaluating to zero are dropped before counting.

The test substitutes each root back rather than comparing printed text, as the issue asks — a
decimal right to seventeen figures passes any test that reads the answer and fails the equation.
It also pins that the six equations exact before are unchanged, since this branch runs ahead of
the one that answers them.

Fails 4 of its 13 cases without the change. Full suite: 8775 passed, 0 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bjumi5K7fg8yx6UK1mZTQd

…1007)

`3 ^ (x+1) = 2 ^ (x-1)` has the exact root `-ln(6) / ln(3/2)`. The multiplicative solver
reached it by dividing one exponent by the other, and for two different integer bases that
ratio is `ln(3)/ln(2)` -- irrational -- so `InnerSimplified` settled it to a decimal and
everything downstream was numeric. The answer agreed with the exact one to seventeen
significant figures and then diverged, which is a `double` promoted to a decimal rather
than a number that was computed.

Taking logarithms has no such step: `a ^ p = b ^ q` is `p ln a = q ln b` for positive real
`a` and `b`, and that is an ordinary equation the analytical solver answers exactly. Tried
before the multiplicative solver, because it is the substitution that loses the exactness.

Both bases must be **decidably positive reals**, which is what makes `ln` of them real and
the step an equivalence rather than a branch choice. Anything else declines and the
multiplicative path still gets its turn, so this only ever adds answers -- and it does add
one: `5 ^ (2x) - 7 ^ (x+3)` was the empty set and is now
`3 * ln(7) / (2 * ln(5) + -ln(7))`.

**The zero term is why the first version did not fire**, and a trace found it in one run
where reading the code had not: the solver is handed `lhs - rhs - 0`, so a two-power
equation arrives with three terms. Terms that evaluate to zero are dropped before counting.

The test substitutes each root back rather than comparing printed text, which is what the
issue asks for: a decimal right to seventeen figures passes any test that reads the answer
and fails the equation. It also asserts that the six equations that were exact before are
unchanged, since this branch runs ahead of the one that answers them.

Fails 4 of its 13 cases without the change.
@Rafael-SOWNet
Rafael-SOWNet merged commit 540a38e into master Aug 27, 2026
31 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the fix/exponential-two-bases-exact-1007 branch August 27, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A mixed-base exponential equation is solved with a double where an exact closed form exists

1 participant