Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ limitcheck; no issue was filed.
| `"1/2 * x ^ abs(x)".ToEntity().Limit("x", 0, ApproachFrom.Left)` | `limitleft(1/2 * x ^ abs(x), x, 0)` | `1/2` |
| `"(pi / x) ^ erf(x) * e ^ log(x, x)".ToEntity().Limit("x", 0, ApproachFrom.Left)` | `limitleft((pi / x) ^ erf(x) * e ^ log(x, x), x, 0)` | `e` |

### A negative whole power of a base growing without bound tends to 0 in a limit

**Silent: a power to a constant negative whole exponent whose base grows without bound in modulus, in any direction, is
answered as 0** where its reciprocal's limit is 0. Before, the whole power was simplified, and `Simplify` expanded it.
`log(x, -1)` is `i pi / ln(x)`, so near 1 the base below tends to a complex infinity. limitcheck over 42 seeds
answers the same rows as before, except the three below that did not finish.

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"((x + 1) - log(x, -1)) ^ (-16)".ToEntity().Limit("x", 1, ApproachFrom.Right)` | did not finish in 30 s | `0` |
| `"((x + 1) - log(x, -1)) ^ (-16)".ToEntity().Limit("x", 1, ApproachFrom.BothSides)` | did not finish in 30 s | `0` |

### A logarithm of a part tending to 1 is read as the part less 1 in a limit

**Silent: a factor `ln(u)` whose antilogarithm tends to 1 is read as `u - 1`, as `sin(f)` is read as `f` where `f`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,25 @@ partial record Powf
// and nothing about the whole has to be read. Asking the whole first simplifies it,
// and Simplify expands the power: (x + 1 + i / ln(x))^(-16) at +oo, which is 0, took
// 7.8 s for it.
if (!Exponent.ContainsNode(x) && Exponent.Evaled is Real { IsFinite: true, IsZero: false }
&& Base.ComputeLimitDivideEtImpera(x, dist, side) is { } positiveBaseLimit
&& positiveBaseLimit.Evaled is Real { IsPositive: true } positiveBase
&& (positiveBase.IsFinite || positiveBase == Real.PositiveInfinity))
return ComputeLimitImpl(New(positiveBaseLimit, Exponent), x, dist, side);
if (!Exponent.ContainsNode(x) && Exponent.Evaled is Real { IsFinite: true, IsZero: false } constantExponent)
{
var constantBaseLimit = Base.ComputeLimitDivideEtImpera(x, dist, side);
if (constantBaseLimit?.Evaled is Real { IsPositive: true } positiveBase
&& (positiveBase.IsFinite || positiveBase == Real.PositiveInfinity))
return ComputeLimitImpl(New(constantBaseLimit, Exponent), x, dist, side);
// A base whose reciprocal tends to 0 grows without bound in modulus, in whatever
// direction, and to a negative exponent the power's modulus is the base's to it on the
// principal branch, so it tends to 0. ((x + 1) - log(x, -1))^(-16) at 1, where the
// base tends to a complex infinity, did not finish in 30 s, while its reciprocal is
// read as 0 in a quarter of a second. The reciprocal is asked whole, under the guards
// that keep a whole limit from being asked again inside it: the descent through its
// parts reads the base as 2 - ln(-1) / 0 and settles nothing. A whole exponent only, so
// that the power is single-valued: a power of a base tending to -oo to one that is not
// whole lies along the logarithm's cut, and is declined below.
if (constantExponent is Integer { IsNegative: true } && constantBaseLimit?.Evaled is not Real { IsFinite: true }
&& AsTheWholeLimit(1 / Base, x, dist, side)?.Evaled is Integer { IsZero: true })
return Integer.Zero;
}
if (ComputeLimitImpl(this, x, dist, side) is { } lim)
return lim;
var baseLimit = Base.ComputeLimitDivideEtImpera(x, dist, side);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// 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
{
/// <summary>
/// A power to a constant negative whole exponent whose base grows without bound in modulus tends to 0, read from the
/// reciprocal of the base: ((x + 1) - log(x, -1))^(-16) at 1, where log(x, -1) = i pi / ln(x) takes the base to a
/// complex infinity, did not finish in 30 s from any side, because the whole power was simplified and Simplify
/// expanded it. Found by limitcheck; no issue was filed.
/// </summary>
[Trait("Area", "Calculus")]
public sealed class ANegativePowerOfAGrowingBaseVanishesTest
{
[Theory]
[InlineData(ApproachFrom.Left)]
[InlineData(ApproachFrom.Right)]
[InlineData(ApproachFrom.BothSides)]
public void TheLimitAtOneIsZero(ApproachFrom side)
{
var limit = Task.Run(() => "((x + 1) - log(x, -1)) ^ (-16)".ToEntity().Limit("x", 1, side));
Assert.True(limit.Wait(TimeSpan.FromSeconds(30)), $"the limit from {side} did not finish in 30 seconds");
Assert.Equal(Entity.Number.Integer.Zero, limit.Result.Evaled);
}

// A base with no limit at all keeps its reciprocal from tending to 0, and is not answered.
[Fact]
public void ABaseWithZerosArbitrarilyFarOutIsNotAnswered()
=> Assert.IsType<Entity.Limitf>("(x * sin(x)) ^ (-2)".ToEntity().Limit("x", "+oo", ApproachFrom.BothSides));
}
}
Loading