Skip to content

Read a limit at -oo on the approach it is rewritten to, and simplify without the memo while one is read - #2029

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
read-a-limit-at-minus-infinity-on-its-own-approach
Oct 21, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
read-a-limit-at-minus-infinity-on-its-own-approach

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2022.

lim x->-oo ln(x) + ln(x + 1) - ln(x^2 + x) was 0, on 2.5.0 and on master. Both x and x + 1 are negative there, so each of the first two logarithms carries i pi and the limit is 2 pi i.

The cause. On an approach the limit machinery gathers ln(a) + ln(b) into ln(a b) where a and b are both positive, and it reads their signs from the approach in scope. SolveByRewriting reads -oo as +oo with -x written for x, then simplified the result while the approach in scope still said -oo. Read against -oo, -x and 1 - x are positive, so ln(-x) + ln(1 - x) was gathered and cancelled against ln(x^2 - x). The rewriting now runs with +oo in scope, as the Gruntz branch and SimplifyAndComputeLimitToInfinity already did.

The memo. #2015's nested-Simplify memo is keyed on the tree, the level and the settings, and not on the approach. On an approach a simplification can gather logarithms it does not gather on its own, so one tree has an answer per approach. The memo is now bypassed while an approach is being read. Through Simplify of a limit(...) node, master answered 2 ln(-1) only because the memo carried an answer across approaches; the bypass alone gives 0, and the bypass with the limit fix gives 2 ln(-1).

Measured on builds of v2.5.0, master 6e16aae and this branch:

….Limit("x", "-oo") of v2.5.0 master this
ln(x) + ln(x + 1) - ln(x^2 + x) 0 0 ln(-1) + ln(-1)
ln(x) + ln(x - 1) - ln(x^2 - x) 0 0 ln(-1) + ln(-1)
(ln(x) + ln(x + 1) - ln(x^2 + x)) x/(x + 1) 0 0 ln(-1) + ln(-1)
(ln(x) + ln(x + 1) - ln(x^2 + x))^2 0 0 (ln(-1) + ln(-1))^2

LogarithmsGatheredOnTheirOwnApproachTest holds these four and six limits that were already right, through both Limit and Simplify. Without the SolveByRewriting change the four fail and the six pass. The suite passes locally: 16353 passed, 0 failed. Indefinite integration never reads an approach, so the bypass does not reach the integrator.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…without the memo while one is read

lim x->-oo ln(x) + ln(x + 1) - ln(x^2 + x) was 0, on 2.5.0 and on master. Both x and x + 1 are
negative there, so each of the first two logarithms carries i pi and the limit is 2 pi i.

The limit machinery gathers ln(a) + ln(b) into ln(a b) where a and b hold a positive sign on the
approach, which it reads from the approach in scope. SolveByRewriting reads a destination of -oo
as +oo with -x written for x, and then simplified the rewritten expression while the approach in
scope still said -oo. Against -oo, -x and 1 - x are positive, so ln(-x) + ln(1 - x) was gathered,
and it cancelled against ln(x^2 - x). The rewriting now runs with +oo in scope, as the Gruntz
branch and SimplifyAndComputeLimitToInfinity already did.

And a nested Simplify is no longer looked up in what an earlier one answered while an approach
is being read. The memo is keyed on the tree, the level and the settings, and on an approach a
simplification can gather logarithms it does not gather on its own account, so one tree has an
answer per approach. Through Simplify of a limit node master happened to answer 2 ln(-1) here,
because the memo carried an answer across; with the memo bypassed and the limit unfixed it came
back 0.

Measured on builds of v2.5.0, master 6e16aae and this change: the four limits in the new test
that were 0 are now 2 pi i (or its square), and the six that were right are unchanged, through
both Limit and Simplify. Without the SolveByRewriting change, those four fail and the rest pass.
Indefinite integration never reads an approach, so the bypass does not reach it.

Fixes #2022.

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 Oct 21, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 2e3078d into master Oct 21, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Oct 21, 2026
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.

lim x->-oo of ln(x) + ln(x+1) - ln(x^2+x) is 0; it is 2 pi i, and master answers it only by reusing a simplification across limit approaches

1 participant