|
| 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 AngouriMath.Extensions; |
| 12 | +using Xunit; |
| 13 | + |
| 14 | +namespace AngouriMath.Tests.Calculus |
| 15 | +{ |
| 16 | + /// <summary> |
| 17 | + /// A base tending to a positive number or to +oo, to a constant real exponent, is continuous, and the power's |
| 18 | + /// limit is read from the base's. The whole power was simplified first, and Simplify expands it: |
| 19 | + /// (x + 1 + i / ln(x))^(-16) at +oo took 7.8 s, and to the power -24 more than 30 s, for 0. |
| 20 | + /// Found by limitcheck; no issue was filed. |
| 21 | + /// </summary> |
| 22 | + [Trait("Area", "Calculus")] |
| 23 | + public sealed class APowerOfAPositiveLimitIsContinuousTest |
| 24 | + { |
| 25 | + [Theory] |
| 26 | + [InlineData("(x + 1 + i / ln(x)) ^ (-32)", "0")] |
| 27 | + [InlineData("(x + 1 + i / ln(x)) ^ 32", "+oo")] |
| 28 | + [InlineData("((x + 1) - log(x, -1)) ^ (2 ^ 3 * (-1 + -1))", "0")] |
| 29 | + public void TheLimitAtInfinityIsAnswered(string input, string expected) |
| 30 | + { |
| 31 | + var limit = Task.Run(() => input.ToEntity().Limit("x", "+oo", ApproachFrom.BothSides)); |
| 32 | + Assert.True(limit.Wait(TimeSpan.FromSeconds(30)), $"{input} at +oo did not finish in 30 seconds"); |
| 33 | + Assert.Equal(expected.ToEntity().Evaled, limit.Result.Evaled); |
| 34 | + } |
| 35 | + |
| 36 | + [Theory] |
| 37 | + [InlineData("(2 + 1 / x) ^ (-3)", "1/8")] |
| 38 | + [InlineData("(4 + i / ln(x)) ^ (1/2)", "2")] |
| 39 | + [InlineData("(x + 1 + i / ln(x)) ^ (-1/2)", "0")] |
| 40 | + public void APositiveOrInfiniteBaseLimitIsRaisedToTheExponent(string input, string expected) |
| 41 | + => Assert.Equal(expected.ToEntity().Evaled, input.ToEntity().Limit("x", "+oo", ApproachFrom.BothSides).Evaled); |
| 42 | + } |
| 43 | +} |
0 commit comments