From 79359f735af9c03ce0145608254937caed626fcd Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Sat, 7 Nov 2026 14:37:59 +0000 Subject: [PATCH] Ask the descent's own question once The descent of a quotient asks the quotient's whole limit when its parts read as 0/0 or oo/oo. At the root of the descent that is the question being asked: the path that began the descent asks the indeterminate power, l'Hopital's rule and, at an infinity, the rewrites and Gruntz, the moment the descent has nothing to say. Asked from inside the descent as well, it descended again and repeated every step of it, including simplifying the expression moved out to infinity. (1 - tanh(x)^2) * x * (1 + x^2) / tanh(x) at 0 from the right simplified it twice, nine seconds each, before l'Hopital's rule answered 1. Co-Authored-By: Claude Opus 5.5 --- .../Functions/Continuous/Limits/Solvers/Limit.Classes.cs | 6 ++++++ .../Continuous/Limits/Solvers/Solvers.Definition.cs | 7 +++++++ .../Calculus/AContinuousFactorIsNotDifferentiatedTest.cs | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs index 1304075ff..1125bbea9 100644 --- a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs +++ b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs @@ -218,6 +218,12 @@ private static bool IsAnIndeterminateQuotient(Entity dividend, Entity divisor) // definite integral's bounds left the bounds none, and the integral unevaluated. if (Functions.Algebra.LimitFunctional.UnderALimitBudget) return null; + // Nor of the whole question, which the path that began the descent asks the rest of the + // machinery of once the descent has nothing to say. Asked here as well, it descended + // again and simplified the same expression twice: (1 - tanh(x)^2) * x * (1 + x^2) / tanh(x) + // at 0 from the right spent nine seconds on each before l'Hopital's rule answered 1. + if (Functions.Algebra.LimitFunctional.IsTheWholeQuestion(quotient)) + return null; quotientsAskedWhole ??= new(); if (quotientsAskedWhole.Count > 0 || !quotientsAskedWhole.Add(quotient)) return null; diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs index c860fc67d..83cabc536 100644 --- a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs +++ b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs @@ -298,6 +298,13 @@ bool PositiveOnBothSides(Entity node) internal static bool MayReadAPowerThroughItsExponent(Entity power) => !comparingSides && !ReferenceEquals(power, descentRoot); + /// + /// Whether is the whole of the question whose descent is under + /// way. The path that began the descent asks the rest of the machinery of it once the + /// descent has nothing to say, so the descent does not ask its whole limit as well. + /// + internal static bool IsTheWholeQuestion(Entity expr) => ReferenceEquals(expr, descentRoot); + /// /// A logarithm to a base other than e as a quotient of natural logarithms. /// diff --git a/Sources/Tests/UnitTests/Calculus/AContinuousFactorIsNotDifferentiatedTest.cs b/Sources/Tests/UnitTests/Calculus/AContinuousFactorIsNotDifferentiatedTest.cs index 4f9506131..a53278fac 100644 --- a/Sources/Tests/UnitTests/Calculus/AContinuousFactorIsNotDifferentiatedTest.cs +++ b/Sources/Tests/UnitTests/Calculus/AContinuousFactorIsNotDifferentiatedTest.cs @@ -26,6 +26,10 @@ public sealed class AContinuousFactorIsNotDifferentiatedTest [InlineData("sin(x)^tanh(x)")] [InlineData("tan(x)^sin(tanh(x))")] [InlineData("tan(2*x)^sin(tanh(x))")] + // The 1 - tanh(x)^2 the derivative of tanh brings, taken out at 0. The descent of the quotient + // asked its whole limit again from inside, which simplified the quotient moved out to infinity + // a second time before l'Hopital's rule answered. + [InlineData("(1 - tanh(x)^2) * x / tanh(x)")] public void IsOneFromTheRight(string input) => Assert.Equal(MathS.FromString("1"), MathS.FromString(input).Limit("x", 0, ApproachFrom.Right));