Skip to content

Commit 4c203f0

Browse files
Ask the whole limit of a quotient of two infinities in the descent (#2369)
exp(log(1/x, arcsin(x))) at 0 from the right was left unevaluated, where the logarithm alone is -1 and the limit is 1/e. The logarithm reaches the descent as ln(arcsin(x)) / ln(1/x). The limit its derivatives' quotient was taken to came back as the form 0 * +oo / 0, which has no value, and the quotient's descent returned that at once as the exponent's limit. And with parts tending to -oo and +oo, the descent asked the quotient's whole limit only when a substitution of finite parts came back NaN, which two infinite parts never are. A sine of the logarithm was left unevaluated too, and a hyperbolic sine after ten seconds. The same on 2.6.0. A form with no value from the first reading is now kept for the end, where it was answered before, and the parts are read first; and the whole limit is asked where the parts' own limits make oo/oo and the substitution has no value. Only a value is taken from it. The 0 * oo in the product below was not touched: from both sides ln(x) at 0 reads as -oo, and the NaN that 0 * -oo comes back as is what keeps x * ln(x) NaN there under the two-sided convention. Declining it, or asking the product's whole limit, answered 0. limitcheck at DEPTH=3, 15 seeds 14-42, master against this: 22 more compared over 11 seeds, among them tanh(log(x, arcsin(x))) at 0 from the left, which master declines after six seconds and this answers with tanh(1) in one. One row crossed the harness's 5 s cap, (log(pi, x))^sinh(x) * sin(1) at 0 from the left, which declines in 7.05 s here and 7.09 s on master. Suite 18968 passed, AOT and the eight harnesses clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f9a5b7f commit 4c203f0

3 files changed

Lines changed: 85 additions & 6 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,23 @@ Two-sided, each side is now taken with its own value, and `floor(x)^x` at 0 is 1
467467
| `"floor(x)^tanh(x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | unevaluated | `0` |
468468
| `"floor(x)^x".ToEntity().Limit("x", 0)` | unevaluated | `NaN`, the sides differ |
469469

470+
### A function of a quotient tending to oo/oo has the value at the quotient's limit
471+
472+
**`exp(log(1/x, arcsin(x)))` at 0 from the right is `1/e`, where it was left unevaluated.** The logarithm alone is
473+
-1, and it reaches the descent as `ln(arcsin(x)) / ln(1/x)`, a quotient of two infinities. The limit its derivatives'
474+
quotient was taken to came back as the form `0 * +oo / 0`, which has no value, and that was handed on as the
475+
exponent's limit. The whole limit of the quotient was asked only for a 0/0 read off two finite parts. It is now asked
476+
for -oo/+oo too, and a form with no value is kept only where nothing better is found. A sine of the logarithm is
477+
answered as well. A hyperbolic sine took ten seconds to be left unevaluated, and is answered in under three.
478+
`x * ln(x)` at 0 is still `NaN`, since ln(x) has no real values to the left of 0.
479+
480+
| Input | Was (2.6.0) | Now |
481+
|---|---|---|
482+
| `"e^log(1/x, arcsin(x))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(e ^ log(1 / x, arcsin(x)), x, 0)` | `1 / e` |
483+
| `"sin(log(1/x, arcsin(x)))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(sin(log(1 / x, arcsin(x))), x, 0)` | `sin(-1)` |
484+
| `"sinh(log(1/x, arcsin(x)))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright((e ^ log(1 / x, arcsin(x)) - e ^ (-log(1 / x, arcsin(x)))) / 2, x, 0)` | `(1 / e - e) / 2` |
485+
| `"tanh(log(x, arcsin(x)))".ToEntity().Limit("x", 0, ApproachFrom.Left)` | `limitleft((e ^ (2 * log(x, arcsin(x))) - 1) / (e ^ (2 * log(x, arcsin(x))) + 1), x, 0)` | `(e ^ 2 - 1) / (e ^ 2 + 1)` |
486+
470487
### A function of a quotient tending to 0/0 has the value at the quotient's limit
471488

472489
**Silent: a different answer.** A function of a quotient took the quotient's limit from the descent alone, which reads

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,20 @@ partial record Divf
9393
{
9494
internal override Entity? ComputeLimitDivideEtImpera(Variable x, Entity dist, ApproachFrom side)
9595
{
96-
if (ComputeLimitImpl(this, x, dist, side) is { } lim)
96+
// A form with no value -- 0 * +oo / 0, which is what -x / (sqrt(1 - x^2) * arcsin(x)) at 0
97+
// from the right comes back as -- is the claim that there is no limit, and the parts may
98+
// say otherwise. It is kept for the end, where it was answered before, and the parts are
99+
// read first.
100+
var whole = ComputeLimitImpl(this, x, dist, side);
101+
if (whole is { } lim && lim.Evaled != MathS.NaN)
97102
return lim;
98103
else
99104
{
100105

106+
var dividendLimit = Dividend.ComputeLimitDivideEtImpera(x, dist, side);
107+
var divisorLimit = Divisor.ComputeLimitDivideEtImpera(x, dist, side);
101108
var (dividend, divisor) =
102-
(Dividend.ComputeLimitDivideEtImpera(x, dist, side), Divisor.ComputeLimitDivideEtImpera(x, dist, side)) switch
109+
(dividendLimit, divisorLimit) switch
103110
{
104111
({ } lim1, { } lim2) when IsDeterminate(New(lim1, lim2), x) => (lim1, lim2),
105112
({ } lim1, { } lim2) when lim1.InnerSimplified.IsFinite && lim2.InnerSimplified.IsFinite && lim2.InnerSimplified != 0 => (lim1, lim2),
@@ -130,11 +137,19 @@ partial record Divf
130137
// written, sent a definite integral astray. Folded, it is 0, and ln(2) * 2^(1/+oo) is
131138
// ln(2), not its decimal. Where it has no
132139
// value, what was answered is kept.
133-
if (substituted?.Evaled == MathS.NaN && IsAnIndeterminateQuotient(dividend, divisor)
134-
&& AsTheWholeLimit(this, x, dist, side) is { } whole && whole.Evaled is Number { IsNaN: false } value)
135-
return whole.InnerSimplified is var folded && folded.Nodes.Any(static node => node is Number { IsFinite: false })
140+
// Two infinite parts are not put in place of the parts above, so the substitution is not
141+
// of the parts' limits, and the form is read off the parts' own limits instead:
142+
// exp(ln(arcsin(x)) / ln(1/x)) at 0 from the right, whose exponent is -oo / +oo and
143+
// tends to -1, was left unevaluated, and so were a sine of it and, after ten seconds, a
144+
// hyperbolic sine.
145+
if ((substituted?.Evaled == MathS.NaN && IsAnIndeterminateQuotient(dividend, divisor)
146+
|| (substituted is null || substituted.Evaled == MathS.NaN)
147+
&& dividendLimit is { } partLimit1 && divisorLimit is { } partLimit2
148+
&& IsAnIndeterminateQuotient(partLimit1, partLimit2))
149+
&& AsTheWholeLimit(this, x, dist, side) is { } asked && asked.Evaled is Number { IsNaN: false } value)
150+
return asked.InnerSimplified is var folded && folded.Nodes.Any(static node => node is Number { IsFinite: false })
136151
? value : folded;
137-
return substituted;
152+
return whole ?? substituted;
138153
}
139154
}
140155
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 AngouriMath.Core;
9+
using Xunit;
10+
11+
namespace AngouriMath.Tests.Calculus
12+
{
13+
/// <summary>
14+
/// <c>exp(log(1/x, arcsin(x)))</c> at 0 from the right was left unevaluated, where the logarithm alone is -1 and
15+
/// the limit is <c>1/e</c>. The logarithm reaches the descent as <c>ln(arcsin(x)) / ln(1/x)</c>, a quotient of
16+
/// two infinities, and the limit its derivatives' quotient was taken to came back as the form <c>0 * +oo / 0</c>,
17+
/// which has no value; the descent handed that on as the exponent's limit rather than asking the quotient's whole
18+
/// limit, which it asked only for a 0/0 read off two finite parts. A sine of it was left unevaluated too, and a
19+
/// hyperbolic sine after ten seconds. The same on 2.6.0. Found by limitcheck at <c>DEPTH=3</c>, <c>SEED=40</c>;
20+
/// no issue was filed.
21+
/// </summary>
22+
[Trait("Area", "Calculus")]
23+
public sealed class AFunctionOfAQuotientOfInfinitiesTest
24+
{
25+
[Theory]
26+
[InlineData("e^log(1/x, arcsin(x))", "1/e")]
27+
[InlineData("sin(log(1/x, arcsin(x)))", "sin(-1)")]
28+
[InlineData("sinh(log(1/x, arcsin(x)))", "(1/e - e)/2")]
29+
[InlineData("log(1/x, arcsin(x))", "-1")]
30+
public void IsTheLimitFromTheRight(string input, string expected)
31+
=> Assert.Equal(MathS.FromString(expected).Simplify(),
32+
MathS.FromString(input).Limit("x", 0, ApproachFrom.Right).Simplify());
33+
34+
// ln(arcsin(x)) / ln(x) tends to 1 from the left as well, and was left unevaluated there after six seconds.
35+
[Fact]
36+
public void IsTheLimitFromTheLeft()
37+
=> Assert.Equal(MathS.FromString("tanh(1)").Simplify(),
38+
MathS.FromString("tanh(log(x, arcsin(x)))").Limit("x", 0, ApproachFrom.Left).Simplify());
39+
40+
// The two-sided convention is kept: ln(x) has no real values to the left of 0.
41+
[Theory]
42+
[InlineData("x * ln(x)")]
43+
[InlineData("sin(x) * ln(x)")]
44+
public void HasNoTwoSidedLimit(string input)
45+
=> Assert.Equal(MathS.NaN, MathS.FromString(input).Limit("x", 0));
46+
}
47+
}

0 commit comments

Comments
 (0)