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));