diff --git a/BREAKING-CHANGES.md b/BREAKING-CHANGES.md
index fee09e766..25d6f2d54 100644
--- a/BREAKING-CHANGES.md
+++ b/BREAKING-CHANGES.md
@@ -72,6 +72,32 @@ A bare `floor(x)` or `sgn(x)` was already declined there. Away from a jump, noth
| `"limit(floor(x) + x, x, 1)".ToEntity().Simplify()` | `2` | `limit(floor(x) + x, x, 1)` |
| `"limitleft(-sgn(x), x, 0)".ToEntity().Simplify()` | `0` | `limitleft(-sgn(x), x, 0)` |
+### A logarithm of a power is read through the logarithm of its base in a limit
+
+**Silent: in a limit, the logarithm of a power to a constant real exponent, `log(f^c)`, is read as `c log(f)`, or as
+`c log(-f) + log((-1)^c)` where `f` is negative near the point.** Nothing read it through `log(f)`, so a logarithm to
+the base `x` of `arcsin(x)^tan(1/2)` was left unevaluated where that of `arcsin(x)` was 1 at once. Where `f` is negative
+the second form keeps the principal branch, and an answer that was a decimal is now exact. A left-sided limit at -1 that
+was a wrong finite value is now 0, and where a left side now agrees with the right, the two-sided limit that was NaN
+is that value. Found by limitcheck; no
+issue was filed.
+
+| Input | Was (2.6.0) | Now |
+|---|---|---|
+| `"log(x, arcsin(x)^tan(1/2))".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `limitright(log(x, arcsin(x) ^ tan(1/2)), x, 0)` | `sin(1/2) / cos(1/2)` |
+| `"log(x, arcsin(x)^tan(1/2))".ToEntity().Limit("x", 0, ApproachFrom.Left)` | `limitleft(log(x, arcsin(x) ^ tan(1/2)), x, 0)` | `sin(1/2) / cos(1/2)` |
+| `"log(x, arcsin(x)^tan(1/2))".ToEntity().Limit("x", 0)` | `limit(log(x, arcsin(x) ^ tan(1/2)), x, 0)` | `sin(1/2) / cos(1/2)` |
+| `"ln(arcsin(x)^pi) / ln(x)".ToEntity().Limit("x", 0)` | `limit(ln(arcsin(x) ^ pi) / ln(x), x, 0)` | `pi` |
+| `"ln((-x)^pi) / ln(x)".ToEntity().Limit("x", 0, ApproachFrom.Right)` | `1 + 2.14159265358979323846…`, the decimal of pi | `pi` |
+| `"e^(1/2)^x / log(x^2, arctan(x))".ToEntity().Limit("x", -1, ApproachFrom.Left)` | `e ^ 2 / (1/2 * 1 / (-pi / 4 * (-2)))`, wrong: the values tend to 0 | `0` |
+| `"e^(1/2)^x / log(x^2, arctan(x))".ToEntity().Limit("x", -1)` | `NaN` | `0` |
+| `"log(log(x - 1, 1/2), log(abs(x), x^2))".ToEntity().Limit("x", -1, ApproachFrom.Left)` | `NaN` | `-0.19160486490703… - 0.22317814847246…i`, as from the right |
+| `"log(log(x - 1, 1/2), log(abs(x), x^2))".ToEntity().Limit("x", -1)` | `NaN` | `-0.19160486490703… - 0.22317814847246…i` |
+| `"sqrt(x / 2)^(x^pi * x)".ToEntity().Limit("x", 0, ApproachFrom.Right)`, and from the left | `limitright(sqrt(x / 2) ^ (x ^ pi * x), x, 0)` | `1` |
+| `"log(x^pi, sgn(-1))^2".ToEntity().Limit("x", 1, ApproachFrom.Right)`, and from the left | `limitright(log(x ^ pi, sgn(-1)) ^ 2, x, 1)` | `-oo` |
+| `"log(x^pi, sgn(-1))^2".ToEntity().Limit("x", 1)` | `NaN` | `-oo` |
+| `"(tanh(x)^erf(2))^sin(x^3)".ToEntity().Limit("x", 0, ApproachFrom.Right)`, and from the left | `limitright((((e ^ (2 * x) - 1) / (e ^ (2 * x) + 1)) ^ erf(2)) ^ sin(x ^ 3), x, 0)` | `1` |
+
### An equation through a negative whole power is not answered with no roots
**Silent: an empty answer becomes the roots.** Inverting `x^n = v` for a negative whole `n` multiplied by the roots
diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs
index 8a17942f3..c56f7a4db 100644
--- a/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs
+++ b/Sources/AngouriMath/Functions/Continuous/Limits/Solvers/Solvers.Definition.cs
@@ -312,6 +312,36 @@ internal static bool MayReadAPowerThroughItsExponent(Entity power)
///
internal static bool IsTheWholeQuestion(Entity expr) => ReferenceEquals(expr, descentRoot);
+ ///
+ /// A logarithm of a power to a constant real exponent, log(f^c), as c log(f), or as
+ /// c log(-f) + log((-1)^c) where f is negative near the point.
+ ///
+ ///
+ /// For f positive and c real, f^c is positive and ln(f^c) is c ln(f). For f negative, f^c is
+ /// (-f)^c (-1)^c on the principal branch, a positive number times one of modulus 1, so
+ /// ln(f^c) is c ln(-f) + ln((-1)^c), which is c ln(f) only for c in (-1, 1]. In that range the
+ /// first form holds wherever f is real, whatever its sign, so a two-sided limit whose sides
+ /// differ in sign can still be asked through it. Nothing read ln(f^c) through ln(f):
+ /// log(x, arcsin(x)^tan(1/2)) at 0, which is tan(1/2) from each side, was left unevaluated
+ /// after three seconds from the right and four two-sided, where log(x, arcsin(x)) was 1 at
+ /// once. Found by limitcheck at DEPTH=3, SEED=65; no issue was filed.
+ ///
+ private static Entity LogarithmOfAPower(Entity node, Variable x, Entity dest, ApproachFrom side)
+ {
+ if (node is not Logf(var @base, Powf(var power, var exponent))
+ || exponent.ContainsNode(x) || exponent.Evaled is not Real { IsFinite: true } c
+ || !power.ContainsNode(x))
+ return node;
+ if (c > -1 && c <= 1 && IsRealOnEachSide(power, x, dest, side))
+ return exponent * new Logf(@base, power);
+ return SignOnEachSide(power, x, dest, side) switch
+ {
+ 1 => exponent * new Logf(@base, power),
+ -1 => exponent * new Logf(@base, -power) + new Logf(@base, MathS.Pow(-1, exponent)),
+ _ => node
+ };
+ }
+
///
/// A logarithm to a base other than e as a quotient of natural logarithms.
///
@@ -432,6 +462,7 @@ internal static T WithinABudget(int limits, System.Func compute)
return MathS.NaN;
expr = expr.Replace(ExpandLogarithm);
+ expr = expr.Replace(node => LogarithmOfAPower(node, x, dest, side));
// In front of both paths, not only the two-sided one. Each of these is guarded on
// a two-sided limit, and a two-sided limit that exists is also the limit from
diff --git a/Sources/AngouriMath/Functions/Continuous/Limits/Transformations.cs b/Sources/AngouriMath/Functions/Continuous/Limits/Transformations.cs
index e34b0b0b7..3e66d40ac 100644
--- a/Sources/AngouriMath/Functions/Continuous/Limits/Transformations.cs
+++ b/Sources/AngouriMath/Functions/Continuous/Limits/Transformations.cs
@@ -1180,6 +1180,40 @@ internal static Entity AtALargeDecimal(Entity expr, Variable x)
=> MathS.Settings.DowncastingEnabled.As(false,
() => expr.Substitute(x, Real.Create(PeterO.Numbers.EDecimal.FromString("1E6"))).Evaled);
+ ///
+ /// The sign keeps near the destination on each side approached, where it
+ /// is real there and the sides agree, or .
+ ///
+ internal static int? SignOnEachSide(Entity expr, Variable x, Entity dest, ApproachFrom side)
+ {
+ int? sign = null;
+ foreach (var oneSide in Sides(dest, side))
+ {
+ if (!IsRealNear(expr, x, dest, oneSide)
+ || SignNear(expr, x, dest, oneSide) is not { } here || sign is { } earlier && earlier != here)
+ return null;
+ sign = here;
+ }
+ return sign;
+ }
+
+ /// Whether is real near the destination on each side approached.
+ internal static bool IsRealOnEachSide(Entity expr, Variable x, Entity dest, ApproachFrom side)
+ => Sides(dest, side).All(oneSide => IsRealNear(expr, x, dest, oneSide));
+
+ // Where the real region is not known, as arcsin's is not, the form can still say it is real there.
+ private static bool IsRealNear(Entity expr, Variable x, Entity dest, ApproachFrom oneSide)
+ => Functions.TreeAnalyzer.IsRealValued(expr, x)
+ || Functions.TreeAnalyzer.WhereRealValued(expr, x) is { } whereReal && HoldsNear(whereReal, x, dest, oneSide) is true
+ || IsRealOnBothSides(expr, x, dest);
+
+ // The sides a limit approaches from: both at a finite point asked two-sidedly, and one otherwise,
+ // since an infinity is approached from one side whichever is asked.
+ private static ApproachFrom[] Sides(Entity dest, ApproachFrom side)
+ => side is ApproachFrom.BothSides && dest.IsFinite
+ ? new[] { ApproachFrom.Left, ApproachFrom.Right }
+ : new[] { side is ApproachFrom.BothSides ? ApproachFrom.Left : side };
+
///
/// The sign an expression keeps throughout a punctured one-sided neighbourhood of the
/// destination, or where it cannot be read off.
diff --git a/Sources/Tests/UnitTests/Calculus/ALogarithmOfAPowerTest.cs b/Sources/Tests/UnitTests/Calculus/ALogarithmOfAPowerTest.cs
new file mode 100644
index 000000000..0bce0e636
--- /dev/null
+++ b/Sources/Tests/UnitTests/Calculus/ALogarithmOfAPowerTest.cs
@@ -0,0 +1,43 @@
+//
+// 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 AngouriMath.Core;
+using Xunit;
+
+namespace AngouriMath.Tests.Calculus
+{
+ ///
+ /// A limit read log(f^c), for a constant real c, as nothing but a logarithm of a power, never as
+ /// c log(f). log(x, arcsin(x)^tan(1/2)) at 0, which is tan(1/2) from each side, was left
+ /// unevaluated after three seconds from the right and four two-sided, where log(x, arcsin(x))
+ /// was 1 at once. It is c log(f) where f is positive near the point, and for c in (-1, 1] wherever
+ /// f is real; where f is negative, it is c log(-f) + log((-1)^c). Found by limitcheck at DEPTH=3,
+ /// SEED=65; no issue was filed.
+ ///
+ [Trait("Area", "Calculus")]
+ public sealed class ALogarithmOfAPowerTest
+ {
+ [Theory]
+ // arcsin(x) is negative on the left of 0, and tan(1/2) is in (-1, 1].
+ [InlineData("log(x, arcsin(x)^tan(1/2))", ApproachFrom.Right, "tan(1/2)")]
+ [InlineData("log(x, arcsin(x)^tan(1/2))", ApproachFrom.Left, "tan(1/2)")]
+ [InlineData("log(x, arcsin(x)^tan(1/2))", ApproachFrom.BothSides, "tan(1/2)")]
+ [InlineData("ln(sin(x)^(1/3)) / ln(x)", ApproachFrom.BothSides, "1/3")]
+ // Positive on the right, so any exponent; on the left, ln(f^pi) is pi ln(-f) + ln((-1)^pi).
+ [InlineData("ln(arcsin(x)^pi) / ln(x)", ApproachFrom.Right, "pi")]
+ [InlineData("ln(arcsin(x)^pi) / ln(x)", ApproachFrom.Left, "pi")]
+ [InlineData("ln(arcsin(x)^pi) / ln(x)", ApproachFrom.BothSides, "pi")]
+ public void IsTheExponentTimesTheLimit(string input, ApproachFrom side, string expected)
+ {
+ var limit = MathS.FromString(input).Limit("x", 0, side);
+ // Simplifying a limit left unevaluated simplifies what is under it and asks again, which
+ // answers some of these, so that it was answered is asserted first.
+ Assert.DoesNotContain(limit.Nodes, node => node is Entity.Limitf);
+ Assert.Equal(Entity.Number.Integer.Zero, (limit - MathS.FromString(expected)).Simplify());
+ }
+ }
+}