Skip to content

Read a vanishing factor by its order in l'Hôpital's quotient at a point - #2406

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/limit-of-a-tanh-times-a-log
Nov 10, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/limit-of-a-tanh-times-a-log

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

At a finite point, when l'Hôpital's rule gets a quotient back, it can read that quotient term by term as a value or a pole instead of taking another step. The reading stopped at any factor that was a sum or that vanished at the point. ln(cos(x) * sqrt(x)) / (1 / (e^(2x) - 1)) at 0 from the right steps to

-1/2 * (x^(-1/2) * cos(x) / 2 - sqrt(x) * sin(x)) * (e^(2x) - 1)^2 / (sqrt(x) * cos(x) * e^(2x))

and was left unevaluated. That quotient has a sum of order -1/2 in it and (e^(2x) - 1)^2, of order 2, so its order is 1 and it tends to 0. Such a factor is now read by its leading term:

  • a sum by its lowest-order terms, where their coefficients do not cancel;
  • a factor that vanishes at the point by the first of its derivatives that does not vanish there, up to the third.

The reading goes through derivatives only where the factor is smooth at the point, so not through an abs, and a step in the quotient stops it.

The reading is also tried before another step, not only once the step has grown. tanh(x) * ln(cos(x) * sqrt(x)) reaches the rule with e^(2x) + 1 taken out. So the step did not count as grown, and the descent through the quotient ran out of time. The fix is in ItsValueOrPoleAt and ApplylHopitalRuleImpl in Transformations.cs.

Answered, where master declines:

limit at 0 this PR master 2.6.0
(cos(x) * sqrt(x)) ^ arctan(tanh(x)), right 1, 0.4 s unevaluated, 9.0 s unevaluated
the same, left 1, 3.7 s unevaluated, 13.7 s timeout
tanh(x) * ln(cos(x) * sqrt(x)), right 0 unevaluated unevaluated
sinh(x) * ln(cos(x) * sqrt(x)), right 0 unevaluated unevaluated
tanh(erf(x)) ^ x, each side 1 unevaluated unevaluated
arcsin(erf(x)) ^ x, each side 1 unevaluated unevaluated
(x^3 - arcsin(x)) ^ x, each side 1 unevaluated unevaluated
arctan(sinh(x)) ^ x^(2 pi), right 1 unevaluated unevaluated
(arcsin(1) ^ x^3) ^ ln(arcsin(x)), each side 1 unevaluated unevaluated
log(arcsin(x), cos(x) / x), right -1 unevaluated unevaluated
log(arctan(tanh(x)), x), right and two-sided 1 unevaluated timeout
log(tanh(tanh(x)), arcsin(sinh(x))), each side and two-sided 1 unevaluated timeout
log(2 pi, log(arctan(x), tanh(x))), right 0 unevaluated timeout

2.6.0 answers none of these, so no answer changes against it and there is no BREAKING-CHANGES entry.

Faster, same answer: 1/x^2 - 1/sin(x)^2 at 0 goes from 0.7 s to 0.2 s.

Still unevaluated here and on master:

  • (x - sin(x)) * ln(x) / x^3 at 0 from the right
  • (e^x - 1 - x) * ln(cos(x) * sqrt(x)) / x^2 at 0 from the right

The calculus tests pass, and so do the full suite (19252), the MCP, terminal, interactive and F# suites, the AOT build and every harness. limitcheck against master over all seeds moves only the rows above: one row it timed out on, and twenty that were unevaluated. None of them disagrees with the values.

New test: AVanishingFactorIsReadByItsOrderTest.

🤖 Generated with Claude Code

At a finite point the rule reads the quotient it gets term by term, as a
value or a pole, but a factor that was a sum or vanished there stopped
the reading. ln(cos(x) * sqrt(x)) / (1 / (e^(2x) - 1)) steps to a quotient
with x^(-1/2) * cos(x) / 2 - sqrt(x) * sin(x) and (e^(2x) - 1)^2 in it,
of orders -1/2 and 2, and was left unevaluated. Such a factor is now
read as its leading term: a sum by its terms of the lowest order, a
function that vanishes by its first derivative that does not.

The reading is also asked before another step, not only once the step
has grown: tanh(x) * ln(cos(x) * sqrt(x)) at 0 from the right reached the
rule with e^(2x) + 1 taken out, so the step did not count as grown, and
the descent through the quotient ran out of time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.54545% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.78%. Comparing base (2bfd522) to head (5eab0e0).

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2406      +/-   ##
==========================================
- Coverage   86.81%   86.78%   -0.03%     
==========================================
  Files         312      312              
  Lines       69345    69387      +42     
  Branches    20238    20254      +16     
==========================================
+ Hits        60199    60220      +21     
- Misses       4920     4939      +19     
- Partials     4226     4228       +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.32% <79.54%> (-0.03%) ⬇️
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 87.85% <79.54%> (-0.47%) ⬇️

... and 4 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 605f530 into master Nov 10, 2026
35 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/limit-of-a-tanh-times-a-log branch November 10, 2026 06:20
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 10, 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.

1 participant