Skip to content

Commit 0116c08

Browse files
Ask a quotient of logarithms' derivatives as one quotient (#2354)
Where both logarithms of a quotient diverge, SolveAsLogarithmDivision takes the limit of the ratio of their logarithmic derivatives, and asked it as a quotient of quotients, (u'/u) / (v'/v). For ln(x - 1) / ln(ln(x)) at 1 that is (1/(x - 1)) / ((1/x) / ln(x)), and its limit took 8.7 s, where x ln(x) / (x - 1), the same function, takes 26 ms. The limit at 1 took 11.9 s from the left, 6 s from the right and 16 s two-sided. The left side took 14 ms before #2275, which rightly sent it to this rule; the right was already 5.5 s in 2.6.0. limitcheck, which gives each limit five seconds, found it on SEED=16. The ratio is asked as u' v / (u v'). The limit at 1 is 1 from each side, as before, in 191 ms, 40 ms and 59 ms. limitcheck on seeds 14 to 16 finds no limit of another value and no new NaN, and the two that did not finish now agree with the values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5a665c6 commit 0116c08

2 files changed

Lines changed: 45 additions & 3 deletions

File tree

‎Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Limit.Solvers.cs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,12 @@ private static bool LogarithmDiverges(Entity argumentLimit)
331331
if (upperDerivative.Nodes.Any(node => node is Derivativef)
332332
|| lowerDerivative.Nodes.Any(node => node is Derivativef))
333333
return null;
334-
var p = (upperDerivative / upperLogArgument).InnerSimplified;
335-
var q = (lowerDerivative / lowerLogArgument).InnerSimplified;
336-
return LimitFunctional.ComputeLimit(p / q, x, Real.PositiveInfinity);
334+
// (u'/u) / (v'/v) asked as the one quotient u' v / (u v'): asked as a quotient of
335+
// quotients, the limit of ln(x - 1) / ln(ln(x)) at 1 from the left took twelve
336+
// seconds over (1/(x - 1)) / ((1/x) / ln(x)), where x ln(x) / (x - 1) takes a
337+
// hundredth of one. It took 14 ms before #2275 sent it to this rule.
338+
var ratio = (upperDerivative * lowerLogArgument / (upperLogArgument * lowerDerivative)).InnerSimplified;
339+
return LimitFunctional.ComputeLimit(ratio, x, Real.PositiveInfinity);
337340
}
338341
else
339342

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Copyright (c) 2019-2026 Angouri.
3+
// AngouriMath is licensed under MIT.
4+
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
5+
// Website: https://am.angouri.org.
6+
//
7+
8+
using System;
9+
using System.Threading.Tasks;
10+
using AngouriMath.Core;
11+
using Xunit;
12+
using static AngouriMath.Entity;
13+
14+
namespace AngouriMath.Tests.Calculus
15+
{
16+
/// <summary>
17+
/// A quotient of two logarithms that both diverge is the limit of the quotient of their logarithmic derivatives,
18+
/// and that was asked as a quotient of quotients, <c>(u'/u) / (v'/v)</c>. For <c>ln(x - 1) / ln(ln(x))</c> at 1 that
19+
/// is <c>(1/(x - 1)) / ((1/x) / ln(x))</c>, whose limit took twelve seconds from the left and six from the right,
20+
/// where <c>x ln(x) / (x - 1)</c>, the same function, takes a fraction of one. Found by limitcheck, which gave each
21+
/// side five seconds; no issue was filed. The cap here is far from both: the fixed limit takes about 0.2 s.
22+
/// </summary>
23+
[Trait("Area", "Calculus")]
24+
public sealed class AQuotientOfLogarithmsIsAskedAsOneQuotientTest
25+
{
26+
[Theory]
27+
[InlineData("ln(x - 1) / ln(ln(x))", ApproachFrom.Left)]
28+
[InlineData("ln(x - 1) / ln(ln(x))", ApproachFrom.Right)]
29+
[InlineData("ln(x - 1) / ln(ln(x))", ApproachFrom.BothSides)]
30+
[InlineData("log(ln(x), x - 1)", ApproachFrom.Left)]
31+
[InlineData("ln(1 - x) / ln(-ln(x))", ApproachFrom.Left)]
32+
public void IsOneAtOne(string input, ApproachFrom side)
33+
{
34+
var task = Task.Factory.StartNew(() => MathS.FromString(input).Limit("x", 1, side), TaskCreationOptions.LongRunning);
35+
Assert.True(task.Wait(TimeSpan.FromSeconds(4)), $"the limit of {input} at 1, {side}, did not finish in four seconds");
36+
Assert.Equal(Number.Integer.One, task.Result);
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)