Skip to content

Keep an irrational exponent exact in the power rule - #2393

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
feature/limit-of-a-sum-with-a-log-quotient
Nov 8, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
feature/limit-of-a-sum-with-a-log-quotient

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The power rule wrote a constant exponent as its evaluated value, so an exponent that is not rational became a decimal: x^pi differentiated to 3.14159... * x^2.14159.... l'Hôpital's rule then answered limits whose value is pi with a hundred-digit decimal, and limits that needed the decimal read as pi again were left unevaluated.

The value is kept where it is rational, and the exponent is written as it is otherwise.

Input 2.6.0 and master This PR
x^pi differentiated 3.14159... * x ^ 2.14159... pi * x ^ (pi - 1)
(x^pi - 1) / (x - 1) at 1 3.14159... pi
(x^sqrt(2) - 1) / ln(x) at 1 1.41421... sqrt(2)
(x^ln(2) - 1) / (x - 1) at 1 0.69314... ln(2)
x^pi / log(x, 2) - 2 at 0 from the right unevaluated -2
x^(abs(x)^arctan(2)) at 0 from each side unevaluated 1

x^(abs(x)^arctan(2)) at 0 from the left is 1: the exponent t tends to 0 and t ln(x) = t (ln|x| + i pi) tends to 0. Two-sided it stays NaN on every build, which is the convention for a complex branch on one side and is not changed here.

x^pi / log(x, 2) - 2 now answers, but takes about 12 s, because l'Hôpital's rule differentiates that quotient about ten times. That is a separate defect.

The new ADerivativeKeepsAnIrrationalExponentExactTest fails on master in 7 of its 8 rows; the eighth pins a rational exponent, which is unchanged. Entry in BREAKING-CHANGES.md.

Measured

  • Suite, wrappers, AOT and the harnesses are green; canoncheck and confluence match their baselines.
  • limitcheck at DEPTH=3, across 42 seeds against master: only the x^(abs(x)^arctan(2)) rows move, from unevaluated to 1.

Found by limitcheck; no issue was filed.

🤖 Generated with Claude Code

Rafael-SOWNet and others added 2 commits November 8, 2026 19:07
The power rule wrote a constant exponent as its evaluated value, so an
exponent that is not rational became a decimal: x^pi differentiated to
3.14159... * x^2.14159.... l'Hopital's rule then answered
(x^pi - 1) / (x - 1) at 1 with that decimal instead of pi, and
x^pi / log(x, 2) - 2 at 0 from the right was left unevaluated, since
nothing reads the decimal as pi again.

The value is kept where it is rational, and the exponent is written as
it is otherwise. Found by limitcheck; no issue was filed.

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

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.79%. Comparing base (5f620b1) to head (c723a6d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2393      +/-   ##
==========================================
- Coverage   86.80%   86.79%   -0.02%     
==========================================
  Files         312      312              
  Lines       69223    69224       +1     
  Branches    20186    20186              
==========================================
- Hits        60090    60083       -7     
- Misses       4917     4925       +8     
  Partials     4216     4216              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.33% <100.00%> (-0.02%) ⬇️
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 Δ
...ngouriMath/Functions/Continuous/Differentiation.cs 89.57% <100.00%> (+0.06%) ⬆️

... 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 d682f0d into master Nov 8, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 8, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/limit-of-a-sum-with-a-log-quotient branch November 8, 2026 21:03
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