Repository navigation
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 intoOct 21, 2026
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2022.
lim x->-oo ln(x) + ln(x + 1) - ln(x^2 + x)was0, on 2.5.0 and on master. Bothxandx + 1are negative there, so each of the first two logarithms carriesi piand the limit is2 pi i.The cause. On an approach the limit machinery gathers
ln(a) + ln(b)intoln(a b)whereaandbare both positive, and it reads their signs from the approach in scope.SolveByRewritingreads-ooas+oowith-xwritten forx, then simplified the result while the approach in scope still said-oo. Read against-oo,-xand1 - xare positive, soln(-x) + ln(1 - x)was gathered and cancelled againstln(x^2 - x). The rewriting now runs with+ooin scope, as the Gruntz branch andSimplifyAndComputeLimitToInfinityalready did.The memo. #2015's nested-
Simplifymemo 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. ThroughSimplifyof alimit(...)node, master answered2 ln(-1)only because the memo carried an answer across approaches; the bypass alone gives0, and the bypass with the limit fix gives2 ln(-1).Measured on builds of v2.5.0, master 6e16aae and this branch:
….Limit("x", "-oo")ofln(x) + ln(x + 1) - ln(x^2 + x)00ln(-1) + ln(-1)ln(x) + ln(x - 1) - ln(x^2 - x)00ln(-1) + ln(-1)(ln(x) + ln(x + 1) - ln(x^2 + x)) x/(x + 1)00ln(-1) + ln(-1)(ln(x) + ln(x + 1) - ln(x^2 + x))^200(ln(-1) + ln(-1))^2LogarithmsGatheredOnTheirOwnApproachTestholds these four and six limits that were already right, through bothLimitandSimplify. Without theSolveByRewritingchange 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