Skip to content

Solve a linear function times an exponential by the Lambert W function - #2203

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-linear-times-an-exponential-is-solved-by-the-lambert-w-function
Oct 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-linear-times-an-exponential-is-solved-by-the-lambert-w-function

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Part of #2182.

K (a x + b) c^(g x + d) = k, with exactly one such term in x, is solved by the Lambert W function: x = W(A) / (g ln c) - b / a.

  • Over the complex numbers: { lambertw(n_1, A) }, every branch, written the way the periodic solvers write theirs.
  • Over the reals: W_0 for A >= 0 or A = -1/e, W_0 and W_(-1) for -1/e < A < 0, nothing below -1/e. A symbolic A carries those ranges as conditions.
2.6.0 now
x e^x = 2 Newton's decimal roots { lambertw(n_1, 2) }
x e^x = 2, reals the same complex decimals { lambertw(2) }
x e^x = -1/4, reals complex decimals { lambertw(-1/4), lambertw(-1, -1/4) }
x e^x = -1, reals complex decimals { }
x * 2^x = 5 decimals { lambertw(n_1, 5 ln 2) / ln 2 }

The solver runs after the polynomial solver and before the exponential and substitution solvers. It needs an exponential, so it never answers a polynomial, and it needs a factor linear in x, so a sum of exponentials stays with the existing solvers.

Tests: LambertWSolveTest, 10 cases. Every numeric root is substituted back and must leave under 1e-25, the complex families at branches -2, 0, 1 and 3; the real roots are also compared with their closed forms, and the symbolic case checks that both roots carry their conditions. Full suite 17823/0; interactive trio; AOT smoke 63/0; all frameworks build.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

An equation K (a x + b) c^(g x + d) = k, with one such term in x, has
the roots W(A) / (g ln c) - b / a, where
A = k g ln c e^(b g ln c / a - d ln c) / (K a).

Over the complex numbers the answer is the family over every branch,
lambertw(n, A). Over the reals it is W_0 alone for A >= 0 or A = -1/e,
both W_0 and W_-1 for -1/e < A < 0, and nothing below -1/e; a symbolic
A carries those ranges as conditions.

x e^x = 2 was a decimal root found by Newton's method, and over the
reals a set of complex decimals as well; it is now { lambertw(2) }.

Part of #2182

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.58%. Comparing base (97843f4) to head (f01b23e).

Files with missing lines Patch % Lines
...ontinuous/Solvers/EquationSolver/LambertWSolver.cs 88.88% 2 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2203      +/-   ##
==========================================
+ Coverage   86.55%   86.58%   +0.02%     
==========================================
  Files         300      301       +1     
  Lines       66717    66764      +47     
  Branches    19357    19372      +15     
==========================================
+ Hits        57747    57805      +58     
+ Misses       4882     4870      -12     
- Partials     4088     4089       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.13% <89.36%> (+0.02%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...Solvers/EquationSolver/AnalyticalEquationSolver.cs 96.24% <100.00%> (+0.05%) ⬆️
...ontinuous/Solvers/EquationSolver/LambertWSolver.cs 88.88% <88.88%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit cefe104 into master Oct 29, 2026
37 of 38 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 29, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-linear-times-an-exponential-is-solved-by-the-lambert-w-function branch October 29, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant