diff --git a/BREAKING-CHANGES.md b/BREAKING-CHANGES.md
index 6a6271474..fee09e766 100644
--- a/BREAKING-CHANGES.md
+++ b/BREAKING-CHANGES.md
@@ -42,6 +42,21 @@ A not-equal written `<>` is read as `not (a = b)`, and printed that way.
## Unreleased — since 2.6.0
+### A product with a quotient for a factor is read over that quotient's divisor in a one-sided limit
+
+**Silent: a one-sided limit of a product whose factors tend to 0 and to an infinity, one of them a quotient, is asked
+as that quotient with the other factor in its dividend.** Read as a product nothing settled the form. Some of these
+were left unevaluated, and some took half a minute through l'Hôpital's rule for what the same expression over one
+divisor answers at once. A two-sided limit is not changed. Found by limitcheck; no issue was filed.
+
+| Input | Was (2.6.0) | Now |
+|---|---|---|
+| `"sin(ln(x) * x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(sin(ln(x) * x), x, 0)` | `0` |
+| `"floor(x * log(pi, x))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(floor(x * log(pi, x)), x, 0)` | `-1` |
+| `"sgn(sin(x) * log(pi, x))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(sgn(sin(x) * log(pi, x)), x, 0)` | `-1` |
+| `"arcsin(-x * log(-1, x))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(arcsin(-x * log(-1, x)), x, 0)` | `0` |
+| `"x * log(2 + x, x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `0` after 27 s | `0` in 0.25 s |
+
### A limit at the jump of a step function is not answered by substitution
**Silent: a limit of an expression built on `floor`, `ceil`, `round` or `sgn`, where the step's argument arrives on one
diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs
index 1125bbea9..fd7d241fd 100644
--- a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs
+++ b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Classes.cs
@@ -79,6 +79,26 @@ partial record Mulf
return byMultiplier;
if (AnInfinityTimesASign(Multiplicand, Multiplier, multiplierLimit, dividing: false, x, dist, side) is { } byMultiplicand)
return byMultiplicand;
+ // 0 * oo from one side, with a quotient for one factor, is asked as that quotient
+ // with the other factor in its dividend, its whole limit once. Read as a product,
+ // nothing settles the form, and the rewriting solvers took x * (ln(x) / ln(2 + x)) at
+ // 0 from the right through l'Hopital's rule for longer than any caller waits, where
+ // (x ln(x)) / ln(2 + x) is 0 at once. One-sided only, and not while the sides of a
+ // two-sided limit are compared: two-sided, x * ln(x) / ln(2 + x) at 0 is NaN, its
+ // left side being complex, and regrouped there the same product written with
+ // brackets came back 0.
+ if (side is not ApproachFrom.BothSides && !IsComparingSides
+ && multiplierLimit is { } zeroOrInfinity1 && multiplicandLimit is { } zeroOrInfinity2
+ && IsZeroTimesAnInfinity(zeroOrInfinity1, zeroOrInfinity2)
+ && (Multiplicand, Multiplier) switch
+ {
+ (Divf(var dividend, var divisor), var other) => new Divf(other * dividend, divisor),
+ (var other, Divf(var dividend, var divisor)) => new Divf(dividend * other, divisor),
+ _ => null
+ } is { } regrouped
+ && AsTheWholeLimit(regrouped, x, dist, side) is { } overOneDivisor
+ && overOneDivisor.Evaled != MathS.NaN)
+ return overOneDivisor;
var (mp, md) =
(multiplierLimit, multiplicandLimit) switch
{
@@ -206,6 +226,15 @@ private static bool IsAnIndeterminateQuotient(Entity dividend, Entity divisor)
_ => false,
};
+ /// Whether two factors' limits make a product 0 * oo.
+ private static bool IsZeroTimesAnInfinity(Entity first, Entity second)
+ => (first.Evaled, second.Evaled) switch
+ {
+ (Complex { IsZero: true }, Number { IsFinite: false, IsNaN: false }) => true,
+ (Number { IsFinite: false, IsNaN: false }, Complex { IsZero: true }) => true,
+ _ => false,
+ };
+
/// The quotient whose whole limit is being asked from inside the descent, so that no other is asked inside it.
[System.ThreadStatic] private static HashSet? quotientsAskedWhole;
diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs
index 83cabc536..8a17942f3 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 the descent is reading the two sides of a two-sided limit to compare them. A
+ /// side read there is not that side's question, and a product regrouped there would decide
+ /// a two-sided limit with a complex side that the comparison leaves undecided.
+ ///
+ internal static bool IsComparingSides => comparingSides;
+
///
/// 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
diff --git a/Sources/Tests/UnitTests/Calculus/AProductWithAQuotientFactorTest.cs b/Sources/Tests/UnitTests/Calculus/AProductWithAQuotientFactorTest.cs
new file mode 100644
index 000000000..349872850
--- /dev/null
+++ b/Sources/Tests/UnitTests/Calculus/AProductWithAQuotientFactorTest.cs
@@ -0,0 +1,42 @@
+//
+// Copyright (c) 2019-2026 Angouri.
+// AngouriMath is licensed under MIT.
+// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
+// Website: https://am.angouri.org.
+//
+
+using System;
+using System.Threading.Tasks;
+using AngouriMath.Core;
+using AngouriMath.Extensions;
+using Xunit;
+
+namespace AngouriMath.Tests.Calculus
+{
+ ///
+ /// A product whose factors tend to 0 and to an infinity, one of them a quotient, from one side.
+ /// Read as a product nothing settled the form, and x * (ln(x) / ln(2 + x)) at 0 from the right
+ /// did not finish in thirty seconds, nor did x * log(2 + x, x), where x ln(x) / ln(2 + x), the
+ /// same thing over one divisor, was 0 at once; from the left each took twelve seconds. Found
+ /// by limitcheck at DEPTH=3, SEED=59; no issue was filed.
+ ///
+ [Trait("Area", "Calculus")]
+ public sealed class AProductWithAQuotientFactorTest
+ {
+ [Theory]
+ [InlineData("x * (ln(x) / ln(2 + x))", "0", ApproachFrom.Right)]
+ [InlineData("(ln(x) / ln(2 + x)) * x", "0", ApproachFrom.Right)]
+ [InlineData("x * log(2 + x, x)", "0", ApproachFrom.Right)]
+ [InlineData("x * log(2 + x, x)", "0", ApproachFrom.Left)]
+ [InlineData("sin(x) * (ln(x) / ln(3 - x))", "0", ApproachFrom.Right)]
+ [InlineData("x * (ln(-x) / ln(2 + x))", "0", ApproachFrom.Left)]
+ public void IsZero(string expr, string at, ApproachFrom side)
+ {
+ var asked = Task.Run(() => expr.ToEntity().Limit("x", at, side));
+ Assert.True(asked.Wait(TimeSpan.FromSeconds(20)), $"the limit of {expr} at {at} from the {side} did not finish");
+ var limit = asked.Result;
+ Assert.DoesNotContain(limit.Nodes, node => node is Entity.Limitf);
+ Assert.Equal(Entity.Number.Integer.Zero, limit.Simplify());
+ }
+ }
+}