Skip to content

Read the sign of a limit through a change of variable - #2395

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/sign-near-a-point-through-a-change-of-variable
Nov 9, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/sign-near-a-point-through-a-change-of-variable

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

In a limit, the sign of an expression h(u) is now read through a change of variable when the variable appears only inside one part u. The sign near the destination is then that of h(t) as t tends to the limit of u, from the side u arrives from.

Why. At an infinity, the sign of something that tends to 0 was read through 1/x, at 0 from the right. There sinh(e^(-1/x)) is flat, because every derivative of e^(-1/x) vanishes at 0. So sgn(sinh(e^x)) at −oo was left unevaluated, and SignNear's own comment names that limit. Read through u = e^x, it is (e^t - e^-t)/2 at 0 from the right, which has a slope.

The same reader settles a step function at a jump when the argument arrives through an inner function. For example, tanh(x) reaches −1 from above at −oo, so floor(tanh(x)) there is −1.

Termination. Each step recurses on a strictly smaller expression, except in one case: the side u arrives from is asked as the sign of u - L, and that question can be the expression itself. ln(1 + e^x) at −oo asks about (1 + e^x) - 1, whose own u - L is the same expression again. That recursion overflowed the stack in a first version. Such a part is now skipped, and the next one, e^x, answers.

Measured

  • limitcheck (depth 3, 600 expressions, 42 seeds) against master: 33 limits that were unevaluated are answered, and none got worse. I probed 20 of them on 2.6.0, master and this branch, and checked each value by hand: unevaluated on both older builds, right on this one. The other 13 are compositions of the same arguments, mostly floor(tanh(x)) at −oo. limitcheck flags one of them, sgn(sinh(e^x)) at −oo = 1, as "another value". That is its double-precision sampling: e^(-10^4) underflows to 0, so its samples read the sign as 0.
  • Suite and harnesses: the full suite, the other test projects, AOT and all harnesses pass.

Tests: ASignThroughAChangeOfVariableTest has nine of the new answers, the case that overflowed, and sgn(sin(x)) at +oo, which still declines.

BREAKING-CHANGES.md has an entry. Found by limitcheck; no issue was filed.

🤖 Generated with Claude Code

The sign of an expression that tends to 0 at an infinity was read
through 1/x, at 0 from the right, and sinh(e^(-1/x)) is flat there:
every derivative of e^(-1/x) vanishes at 0, so nothing had a sign for
it and sgn(sinh(e^x)) at -oo was left unevaluated, as were floor and
abs of such arguments.

Where the variable is only inside one part u, the expression is h(u),
and near the destination it has the sign h(t) has as t tends to the
limit of u from the side u arrives from. sinh(e^x) at -oo is
(e^t - e^-t) / 2 at 0 from the right, which has a slope. The side u
arrives from is the sign of u - L, and that is skipped where it is the
expression itself, which would recurse without end. Found by
limitcheck; no issue was filed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.80%. Comparing base (9a5503e) to head (9627b5b).

Files with missing lines Patch % Lines
...ath/Functions/Continuous/Limits/Transformations.cs 66.66% 2 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2395      +/-   ##
==========================================
- Coverage   86.81%   86.80%   -0.01%     
==========================================
  Files         312      312              
  Lines       69228    69242      +14     
  Branches    20187    20193       +6     
==========================================
+ Hits        60101    60108       +7     
- Misses       4912     4916       +4     
- Partials     4215     4218       +3     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.34% <66.66%> (-0.01%) ⬇️
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 Δ
...ath/Functions/Continuous/Limits/Transformations.cs 88.63% <66.66%> (-0.47%) ⬇️

... and 5 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 47b6600 into master Nov 9, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 9, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/sign-near-a-point-through-a-change-of-variable branch November 9, 2026 02:45
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