Skip to content

Read an even power of a real base as never negative in a limit - #2368

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/an-even-power-of-a-real-is-never-negative
Nov 4, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix/an-even-power-of-a-real-is-never-negative

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

1/((x^2)^tanh(1)) at 0 was NaN, the claim that the limit does not exist. The limit is +oo from both sides.

IsNeverNegative only counted a base as never negative when it was an absolute value, or a real power, product or quotient of never-negative parts. x^2 was none of those. So a vanishing power of it was left unevaluated from each side when its exponent was a constant other than a number, or tended to a negative number. The two-sided limit was then NaN because neither side had an answer. 2.6.0 gives the same results.

An even integer power is now never negative when TreeAnalyzer.IsRealValued says its base is real for real x. IsNeverNegative now takes the variable so it can ask that. The base has to be real, because sqrt(x)^2 is x. 1/(((i*x)^2)^tanh(1)) has base -x^2, and it is still not answered. A test pins that.

Input 2.6.0 and master Now
1/((x^2)^tanh(1)) at 0 NaN; each side unevaluated +oo
(sinh(x)^2)^(sin(x) - 1) at 0 NaN; each side unevaluated +oo
sqrt(x^2)^tan(pi - 1) at 0 NaN; each side unevaluated +oo

Measured

  • limitcheck at DEPTH=3 on 11 seeds (14, 16, 19, 23, 26, 28, 29, 31, 33, 34, 36), master against this branch: three NaNs are answered, all +oo. Two are at seed 36, 1/((x^2)^tanh(1)) and (sinh(x)^2)^(sin(x) - 1). One is at seed 29, sqrt(x^2)^tan(pi - 1). Nothing else changed.
  • The new tests fail on master: all 6 rows of the theory fail, and the guard on the complex base passes.
  • Suite: 18963 passed, 0 failed. AOT passed. BoundCheck, RootCheck, CasBench, PropCheck, SimpSweep, RuleCheck, CanonCheck and Confluence are clean.

Recorded in BREAKING-CHANGES.md.

🤖 Generated with Claude Code

1/((x^2)^tanh(1)) at 0 was NaN, the claim that the limit does not exist,
where it is +oo from both sides. IsNeverNegative read a base as never
negative only for an absolute value, or a real power, product or
quotient of never-negative parts, so x^2 was not one. A vanishing power
of it to a constant that is not a number, or to an exponent tending to
a negative number, was left unevaluated from each side, and the
two-sided limit was NaN for the sides not being answered. The same on
2.6.0.

An even integer power of a base that TreeAnalyzer.IsRealValued says is
real for real x is now never negative; IsNeverNegative takes the
variable for it. The base has to be real: sqrt(x)^2 is x, and
1/(((i*x)^2)^tanh(1)), whose base is -x^2, is still not answered.

limitcheck at DEPTH=3, seeds 14-36 (11 seeds), master against this:
three NaNs answered, (sinh(x)^2)^(sin(x) - 1) and 1/((x^2)^tanh(1)) at
seed 36 and sqrt(x^2)^tan(pi - 1) at seed 29, each +oo, and nothing else
changed. Suite 18963 passed, AOT and the eight harnesses clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 4, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.78%. Comparing base (984671d) to head (a98cc6f).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 0.00% 0 Missing and 1 partial ⚠️
...ath/Functions/Continuous/Limits/Transformations.cs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2368   +/-   ##
=======================================
  Coverage   86.78%   86.78%           
=======================================
  Files         312      312           
  Lines       68861    68865    +4     
  Branches    20066    20067    +1     
=======================================
+ Hits        59761    59765    +4     
+ Misses       4911     4910    -1     
- Partials     4189     4190    +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.32% <81.81%> (+<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 Δ
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 72.30% <100.00%> (-1.08%) ⬇️
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 89.40% <0.00%> (-0.47%) ⬇️
...ath/Functions/Continuous/Limits/Transformations.cs 88.37% <88.88%> (+0.07%) ⬆️

... and 9 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 f9a5b7f into master Nov 4, 2026
45 of 53 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 4, 2026
@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

Merged without the two macOS jobs. They never ran: GitHub had no macOS arm64 runner capacity, and each of three re-runs was cancelled with "The job was not acquired by Runner of type hosted even after multiple attempts". No macOS job has started on any branch since 14:31 UTC. In their place:

  • I ran every row of AnEvenPowerVanishesFromAboveTest on a 512 KB thread, the tightest stack the macOS leg gives. All 21 limits came out as the tests expect.
  • Every other check is green, on Linux and Windows.
  • The local chain, suite and harnesses all passed.

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