From ff030f17639f1f1f328e35005a1bd7a17de6952b Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Fri, 23 Oct 2026 22:20:10 +0000 Subject: [PATCH] Read a power of a power of a linear beside an exponential of a linear ((d + e x)^n)^m F^(c (a + b x)) is a gamma function of order n m + 1, with ((d + e x)^n)^m standing as written where (d + e x)^(n m) would: the two differ off the right half-line, but their logarithmic derivatives are both n m e/(d + e x), and that is all the answer asks of the power. The rule read only a power of the linear itself, so the integral was left unsolved. Part of https://github.com/asc-community/AngouriMath/issues/2075. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --- .../Continuous/Integration/IntegralPatterns.cs | 11 ++++++++--- .../APowerBesideAnExponentialOfAPowerIntegralTest.cs | 10 ++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Sources/AngouriMath/Functions/Continuous/Integration/IntegralPatterns.cs b/Sources/AngouriMath/Functions/Continuous/Integration/IntegralPatterns.cs index 1329b1995..0127fae31 100644 --- a/Sources/AngouriMath/Functions/Continuous/Integration/IntegralPatterns.cs +++ b/Sources/AngouriMath/Functions/Continuous/Integration/IntegralPatterns.cs @@ -543,10 +543,15 @@ private static bool TakeMomentFactor(Entity factor, bool inverted, Entity.Variab return sum; } - // A power of a linear with an offset, beside an exponential of a linear. + // A power of a linear with an offset, beside an exponential of a linear -- or a power of a power of one, + // ((c + d x)^n)^m, which stands as written where (c + d x)^(n m) would: its logarithmic derivative is + // n m d/(c + d x) on every branch, and that is all the answer asks of it. if (factorsInX != 1 || !degree.Equals(Entity.Number.Integer.One) - || single is not Entity.Powf(var linear, var exponentOfLinear) || exponentOfLinear.ContainsNode(x) - || !TreeAnalyzer.TryGetPolyLinear(linear, x, out var slope, out var offset) + || single is not Entity.Powf(var linear, var exponentOfLinear) || exponentOfLinear.ContainsNode(x)) + return null; + while (linear is Entity.Powf(var innerLinear, var innerExponent) && !innerExponent.ContainsNode(x)) + (linear, exponentOfLinear) = (innerLinear, (innerExponent * exponentOfLinear).InnerSimplified); + if (!TreeAnalyzer.TryGetPolyLinear(linear, x, out var slope, out var offset) || !TreeAnalyzer.TryGetPolyLinear(term, x, out var rate, out _)) return null; var exponentOfPower = singleBelow ? (-exponentOfLinear).InnerSimplified : exponentOfLinear; diff --git a/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs b/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs index 1a7e0b76a..26869d95a 100644 --- a/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs +++ b/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs @@ -205,6 +205,16 @@ public void APositiveRateIsTakenOutOfThePower() [InlineData("x^2*e^(b*(1 + 4*x + 6*x^2 + 4*x^3 + x^4))")] public void AnExponentThatIsAPowerOfAShiftedLinearWrittenExpanded(string integrand) => DifferentiatesBack(integrand); + /// + /// A power of a power of a linear, ((d + f x)^n)^m, which is not (d + f x)^(n m) off the right half-line + /// but has its logarithmic derivative, and stands as written in the answer where that power would. Rubi's 2.1. + /// + [Theory] + [InlineData("c^(a + b*x)*((d + f*x)^n)^m")] + [InlineData("e^(b*x)/((d + f*x)^n)^m")] + [InlineData("e^(-x)*((x + d)^2)^m")] + public void APowerOfAPowerOfALinear(string integrand) => DifferentiatesBack(integrand); + /// /// A power that is not whole of an inverse sine or cosine, which the substitution that undoes it writes as a power of /// u beside a polynomial in the sine and cosine of u, Euler's formula's exponentials of i u, each a gamma