Skip to content

Gruntz answers the example it is introduced with - #1627

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
gruntz-reads-a-cancelled-constant-as-zero
Sep 30, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
gruntz-reads-a-cancelled-constant-as-zero

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Gonnet and Gruntz introduce their limit algorithm with lim e^x (exp(1/x + e^(-x)) - exp(1/x)) as x → ∞. Expanding in powers of 1/x gives O(x^-k) for every k and settles nothing. On master it came back as written.

GRUNTZ_DEBUG=1 shows the algorithm doing the paper's steps right: the mrv set {e^(-x), e^x}, and the rewrite (e^(w + 1/x) - e^(1/x))/w. The series engine then read a leading term where there is none, in three places:

  • A constant term was taken off by subtracting it. Exponentiate subtracted the constant term 1/x of its argument, leaving 1/x + -(1/x) at w^0. It then declined, taking the argument to run off to infinity.
  • Normalising divided the leading coefficient by itself. The inner simplification leaves x/x as written, so the rest of the series carried x/x + -1 at w^0. The geometric series then multiplied that out term by term. For the whole computation, GRUNTZ_DEBUG printed 7981 lines on master and prints 97 now.
  • e^(1/x) - e^(1/x) was not known to be zero. These are the two exponentials' constant terms. Collecting like terms gives 0 provided not x = 0, which is zero wherever the coefficient is defined. The excluded point says nothing about x → ∞, which is the reading Gruntz.Bare already makes.

The constant term is now removed exactly (WithoutConstant), the normalised leading coefficient is 1 exactly, and the zero test collects like terms and reads a conditional zero as zero. The paper's example and two variants are in GruntzTest.TheExampleTheAlgorithmIsIntroducedWith, all 1.

Suite, net10.0, at b204d304 on master ad02ebb7: 14153 passed, 0 failed. Every target framework builds; the 643 limit tests all pass.
Gate: allocation is what the baseline says on all 19 gated benchmarks. BREAKING-CHANGES.md has the three rows, measured on v2.5.0, where all three were left as written.

Part of #353, where the comparison of the paper with the implementation is posted.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits September 30, 2026 13:11
lim e^x (exp(1/x + e^(-x)) - exp(1/x)), x -> oo, is the example Gonnet and
Gruntz introduce the algorithm with, and it came back as written. The
algorithm did its steps right -- the mrv set {e^(-x), e^x}, the rewrite
(e^(w + 1/x) - e^(1/x))/w -- and the series engine then read a leading
term where there is none, in three places:

- a constant term was taken off by subtracting it, which left 1/x - 1/x
  at w^0 in the argument of an exponential, and Exponentiate declined an
  argument it took to run off to infinity;
- normalising a series divided the leading coefficient by itself, and the
  inner simplification leaves x/x as written, so the rest carried
  x/x - 1 at w^0 and the geometric series multiplied it out term by term;
- e^(1/x) - e^(1/x), the two exponentials' constant terms, was not known
  to be zero: collecting like terms gives 0 provided not x = 0, a zero
  wherever the coefficient is defined.

The constant term is now removed exactly, the normalised leading
coefficient is 1 exactly, and the zero test collects like terms and reads
a conditional zero as zero. Part of #353.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Sep 30, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 371b38e into master Sep 30, 2026
31 checks passed
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.

1 participant