Skip to content

Commit 9f82bd6

Browse files
Answer a limit of a quotient whose parts tend to a determinate form (#2410)
Record the quotients answered from the limits of their parts Answer a limit of a quotient whose parts tend to a determinate form l'Hopital's rule asks the limit of the numerator and the denominator, each whole, and went on only for 0/0 and oo/oo. Where the two make a determinate form it returned nothing, though the quotient of the two limits is the limit. The descent reads a part term by term and can see an indeterminate form the whole does not have: cot(x) - 1/x at 0 is +oo - +oo to it and 0 asked whole, so (cot(x) - 1/x) / ln(x) at 0, 0 over -oo, was left unevaluated. A finite limit over an infinite one is now 0, an infinite one over a finite nonzero one is the signed infinity, and a finite one over a finite nonzero one is their quotient. Asked two-sided at a point, it answers only where the quotient is real on both sides, the convention x^x at 0 is held to: sinh(-1) (x^x - 1) stays NaN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e994ffd commit 9f82bd6

3 files changed

Lines changed: 113 additions & 1 deletion

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,34 @@ arctangent of something real, and an arcsine and an arccosine inside (-1, 1). Wh
656656
| `"sqrt(x^2)^(-3/2)".ToEntity().Limit("x", 0)` | `NaN` | `+oo` |
657657
| `"sin(arcsin(x)) * (tan(-1) + 2/x)".ToEntity().Limit("x", 0)` | `NaN` | `2` |
658658

659+
### A quotient whose parts tend to a determinate form is answered in a limit
660+
661+
**Silent: a limit of a quotient whose numerator and denominator, each asked whole, tend to a form that is not
662+
indeterminate is the quotient of the two limits, where it was left unevaluated.** The descent reads a part term by
663+
term and can see an indeterminate form the whole does not have: `cot(x) - 1/x` at 0 is `+oo - +oo` to it and 0 asked
664+
whole, so `(cot(x) - 1/x) / ln(x)`, 0 over `-oo`, was not answered. Most of the rows answered are on the left of 0,
665+
where `x^x` and `ln(x)` are not real and each side's limit is the one of the complex values. Two-sided at a point it
666+
answers only where the quotient is real on both sides, the convention `x^x` at 0 is held to. A two-sided limit whose
667+
two sides are each answered and agree is that value, as `2 (x^x - 1)` at 0 already was, and two rows below move from
668+
`NaN` to it, though one side is not real. One row was `NaN` on a side where the limit is 1.
669+
670+
| Input | Was (2.6.0) | Now |
671+
|---|---|---|
672+
| `"(cot(x) - 1/x) / ln(x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | unevaluated | `0` |
673+
| `"(cot(x) - 1/x) / ln(x)".ToEntity().Limit("x", 0, ApproachFrom.Left)` | unevaluated | `0` |
674+
| `"(1/sin(x) - 1/x) / ln(x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | unevaluated | `0` |
675+
| `"ln(x) / (cot(x) - 1/x + 2)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | unevaluated | `-oo` |
676+
| `"(cot(x) - 1/x + 3) / (x + 2)".ToEntity().Limit("x", 0, ApproachFrom.BothSides)` | unevaluated | `3/2` |
677+
| `"(1/sin(x) - 1/x) / cot(x)".ToEntity().Limit("x", 0, ApproachFrom.BothSides)` | unevaluated | `0` |
678+
| `"tan(x)^2 / (x^x - 1)".ToEntity().Limit("x", 0, ApproachFrom.Left)` | unevaluated | `0` |
679+
| `"sin(x/2) / log(x, pi)^(x - 1)".ToEntity().Limit("x", 1, ApproachFrom.Left)` | unevaluated | `sin(1/2)` |
680+
| `"log(x, erf(x)) * (pi + 2 + x - 1)".ToEntity().Limit("x", "+oo")` | unevaluated | `0` |
681+
| `"(-ln(x))^(abs(x) * x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | unevaluated | `1` |
682+
| `"arctan(x) / x^x + abs(cos(x))".ToEntity().Limit("x", 0, ApproachFrom.Left)` | `NaN` | `1` |
683+
| `"log(1/(1 + pi), (-x)^tan(x))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | did not finish in 30 s | `0` |
684+
| `"log(1/(1 + pi), (-x)^tan(x))".ToEntity().Limit("x", 0, ApproachFrom.BothSides)` | did not finish in 30 s | `0` |
685+
| `"ln((-x)^tan(x))".ToEntity().Limit("x", 0, ApproachFrom.BothSides)` | `NaN` | `0` |
686+
659687
### A limit over a vanishing even power is not claimed not to exist
660688

661689
**Silent: `1/((x^2)^tanh(1))` at 0 is `+oo`, where it was `NaN`, the claim that the limit does not exist.** A base

‎Sources/AngouriMath/Functions/Continuous/Limits/Transformations.cs‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,19 @@ bool VanishesIdentically(Entity polynomial)
21212121
if (expr is not Divf && AsQuotient(expr, x, dest, side) is { } quotient)
21222122
expr = quotient;
21232123
if (expr is Divf(var num, var den))
2124-
if (EvalAssumingContinuous(num.Limit(x, dest, side)) is var numLimit && EvalAssumingContinuous(den.Limit(x, dest, side)) is var denLimit)
2124+
if (num.Limit(x, dest, side) is var numExact && den.Limit(x, dest, side) is var denExact
2125+
&& EvalAssumingContinuous(numExact) is var numLimit && EvalAssumingContinuous(denExact) is var denLimit)
2126+
{
2127+
// The parts asked whole may make a form that is not indeterminate, where the descent
2128+
// read one of them part by part as one that is: cot(x) - 1/x at 0 is +oo - +oo to the
2129+
// descent and 0 asked whole, and (cot(x) - 1/x) / ln(x) at 0 from the right, 0 over
2130+
// -oo, was left unevaluated. The rule has nothing to differentiate there, and the
2131+
// quotient of the two limits is the limit. Two-sided at a point, only where the
2132+
// quotient is real on both sides: a side with no real values makes no two-sided
2133+
// limit, the convention x^x at 0 is held to, and sinh(-1) (x^x - 1) is not 0.
2134+
if ((side is not ApproachFrom.BothSides || !dest.IsFinite || IsRealOnBothSides(expr, x, dest))
2135+
&& QuotientOfDeterminateLimits(numExact, numLimit, denExact, denLimit) is { } determinate)
2136+
return determinate;
21252137
if (numLimit == 0 && denLimit == 0 ||
21262138
DivergesDecidedly(numLimit) && DivergesDecidedly(denLimit))
21272139
if (num is not Number && den is not Number)
@@ -2206,6 +2218,7 @@ bool VanishesIdentically(Entity polynomial)
22062218
}
22072219
finally { lHopitalChain.RemoveAt(lHopitalChain.Count - 1); }
22082220
}
2221+
}
22092222
return null;
22102223
// A limit times the value taken out: unchanged where nothing was, exact where the limit is
22112224
// finite, and the infinity itself where it is one, since a finite non-zero real times +oo
@@ -2216,6 +2229,23 @@ static Entity Times(Entity taken, Entity limit)
22162229
: (taken * limit).InnerSimplified;
22172230
}
22182231

2232+
/// <summary>
2233+
/// The limit of a quotient whose parts' limits make a determinate form, or <see langword="null"/> where they
2234+
/// do not: a finite limit over an infinite one is 0, an infinite one over a finite one other than 0 is the
2235+
/// infinity with the sign of the two, and a finite one over a finite one other than 0 is their quotient.
2236+
/// 0/0 and oo/oo are left to l'Hopital's rule, and anything over 0 to the side it is approached from.
2237+
/// </summary>
2238+
private static Entity? QuotientOfDeterminateLimits(Entity numExact, Entity numLimit, Entity denExact, Entity denLimit)
2239+
=> (numLimit, denLimit) switch
2240+
{
2241+
(Real { IsNaN: false, IsFinite: true }, Real { IsNaN: false, IsFinite: false }) => Integer.Zero,
2242+
(Real { IsNaN: false, IsFinite: false } infinity, Real { IsNaN: false, IsFinite: true, IsZero: false } divisor)
2243+
=> infinity.IsNegative == divisor.IsNegative ? Real.PositiveInfinity : Real.NegativeInfinity,
2244+
(Real { IsNaN: false, IsFinite: true }, Real { IsNaN: false, IsFinite: true, IsZero: false })
2245+
=> (numExact / denExact).InnerSimplified,
2246+
_ => null
2247+
};
2248+
22192249
/// <summary>
22202250
/// How deep one limit may go into rewriting itself. Each of the rewrites below hands
22212251
/// back another limit to take, and that one is entitled to be rewritten in turn, so
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 AngouriMath.Extensions;
10+
using Xunit;
11+
12+
namespace AngouriMath.Tests.Calculus
13+
{
14+
/// <summary>
15+
/// A quotient whose parts, each asked whole, tend to a form that is not indeterminate has the quotient of their
16+
/// limits for its limit. cot(x) - 1/x at 0 is +oo - +oo read part by part and 0 asked whole, so
17+
/// (cot(x) - 1/x) / ln(x) at 0, 0 over -oo, is 0; l'Hopital's rule was asked of it, had nothing to
18+
/// differentiate, and it was left unevaluated. Found by limitcheck; no issue was filed.
19+
/// </summary>
20+
[Trait("Area", "Calculus")]
21+
public sealed class ADeterminateQuotientIsAnsweredTest
22+
{
23+
[Theory]
24+
[InlineData("(cot(x) - 1/x) / ln(x)", "0")]
25+
[InlineData("(cot(x) - 1/x) / ln(x)^2", "0")]
26+
[InlineData("(1/sin(x) - 1/x) / ln(x)", "0")]
27+
[InlineData("(cot(x) - 1/x) / cot(x)", "0")]
28+
[InlineData("ln(x) / (cot(x) - 1/x + 2)", "-oo")]
29+
[InlineData("(cot(x) - 1/x + 3) / (x + 2)", "3/2")]
30+
public void TheLimitFromTheRightIsAnswered(string input, string expected)
31+
=> Assert.Equal(expected.ToEntity().Evaled, input.ToEntity().Limit("x", 0, ApproachFrom.Right).Evaled);
32+
33+
[Theory]
34+
[InlineData("(cot(x) - 1/x) / ln(x)", "0")]
35+
[InlineData("ln(x) / (cot(x) - 1/x + 2)", "-oo")]
36+
public void TheLimitFromTheLeftIsAnswered(string input, string expected)
37+
=> Assert.Equal(expected.ToEntity().Evaled, input.ToEntity().Limit("x", 0, ApproachFrom.Left).Evaled);
38+
39+
[Theory]
40+
[InlineData("(cot(x) - 1/x + 3) / (x + 2)", "3/2")]
41+
[InlineData("(1/sin(x) - 1/x) / cot(x)", "0")]
42+
public void TheTwoSidedLimitIsAnswered(string input, string expected)
43+
=> Assert.Equal(expected.ToEntity().Evaled, input.ToEntity().Limit("x", 0).Evaled);
44+
45+
/// <summary>
46+
/// Two-sided, only where the quotient is real on both sides: a side with no real values makes no two-sided
47+
/// limit, the convention x^x at 0 is held to. Each side of sinh(-1) (x^x - 1) is 0, and read as a quotient it
48+
/// came to 0 two-sided.
49+
/// </summary>
50+
[Fact]
51+
public void AQuotientNotRealOnASideHasNoTwoSidedLimit()
52+
=> Assert.Equal(MathS.NaN, "sinh(-1) * (x^x - 1)".ToEntity().Limit("x", 0, ApproachFrom.BothSides).Evaled);
53+
}
54+
}

0 commit comments

Comments
 (0)