Skip to content

Commit d9b4319

Browse files
Take a power of a multiple of the shifted linear below the bar in its rule (#2098)
The rule that writes a polynomial beside a function of one shifted linear a + b x in u = a + b x read the factors of a product only, and (h + j x)^2 (a + b ln(c (e + f x)))^p/(d e + d f x) was declined. Below the bar it now takes constants and whole powers of a multiple of the linear, which in u are powers of u: that integrand is a polynomial in u over d u beside the logarithm's power, and each term is answered. Part of #2075. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 9cec2d5 commit d9b4319

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18222,8 +18222,9 @@ static EInteger Choose(int whole, int chosen)
1822218222
return null;
1822318223
// The function first, by its shape, before any factor is read as a polynomial: that expands it, and asked of
1822418224
// every product an algebraic integrand is, it was five per cent of the corpus's time.
18225+
var (numerator, denominator) = expr is Divf(var above, var below) ? (above, below) : (expr, (Entity)Number.Integer.One);
1822518226
Entity? transcendental = null;
18226-
foreach (var factor in Mulf.LinearChildren(expr))
18227+
foreach (var factor in Mulf.LinearChildren(numerator))
1822718228
if (factor.ContainsNode(x) && IsATranscendentalPowerOfSomethingInX(factor, x))
1822818229
{
1822918230
if (transcendental is not null)
@@ -18233,7 +18234,7 @@ static EInteger Choose(int whole, int chosen)
1823318234
if (transcendental is null)
1823418235
return null;
1823518236
Entity? polynomial = null;
18236-
foreach (var factor in Mulf.LinearChildren(expr))
18237+
foreach (var factor in Mulf.LinearChildren(numerator))
1823718238
{
1823818239
if (!factor.ContainsNode(x) || ReferenceEquals(factor, transcendental))
1823918240
continue;
@@ -18247,6 +18248,18 @@ static EInteger Choose(int whole, int chosen)
1824718248
|| !TreeAnalyzer.TryGetPolyLinear(linear, x, out var slope, out var offset)
1824818249
|| slope.ContainsNode(x) || offset.ContainsNode(x) || TreeAnalyzer.IsZero(slope) || VanishesIdentically(offset))
1824918250
return null;
18251+
// Below the bar, constants and whole powers of a multiple of the linear, which in u are powers of u:
18252+
// (h + j x)^2 (a + b ln(c (e + f x)))^p/(d e + d f x) is a polynomial in u over d u.
18253+
foreach (var factor in Mulf.LinearChildren(denominator))
18254+
{
18255+
if (!factor.ContainsNode(x))
18256+
continue;
18257+
var linearBelow = factor is Powf(var powered, Number.Integer { EInteger.Sign: > 0 }) ? powered : factor;
18258+
if (!TreeAnalyzer.TryGetPolyLinear(linearBelow, x, out var belowSlope, out var belowOffset)
18259+
|| belowSlope.ContainsNode(x) || belowOffset.ContainsNode(x)
18260+
|| !VanishesIdentically(belowSlope * offset - belowOffset * slope))
18261+
return null;
18262+
}
1825018263
// x = (u - a)/b, so that the function is of u, and dx = du/b: the whole integrand, its constants with it.
1825118264
var u = Variable.CreateUnique(expr, "u_linear");
1825218265
if (transcendental.Replace(node => node == linear ? u : node).ContainsNode(x))

‎Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ public void APositiveRateIsTakenOutOfThePower()
126126

127127
/// <summary>
128128
/// A polynomial beside a symbolic power of a logarithm of one shifted linear, or an exponential of a power of one,
129-
/// written in <c>u = a + b x</c>, where each term is a gamma function. The constant in front comes along. And beside
130-
/// a sine or a cosine of a power of one, which in u is Euler's formula's exponentials of a power of u. Rubi's 3.3,
131-
/// 3.4, 2.3 and 4.1.12.
129+
/// written in <c>u = a + b x</c>, where each term is a gamma function. The constant in front comes along, and a power
130+
/// of a multiple of the linear below the bar, which in u is a power of u. And beside a sine or a cosine of a power of
131+
/// one, which in u is Euler's formula's exponentials of a power of u. Rubi's 3.3, 3.4, 2.3 and 4.1.12.
132132
/// </summary>
133133
[Theory]
134134
[InlineData("2*x*(a + b*ln(c*(d + f*x)))^n")]
@@ -139,6 +139,8 @@ public void APositiveRateIsTakenOutOfThePower()
139139
[InlineData("x*sin(a + b*(c + d*x)^n)")]
140140
[InlineData("x^2*cos(a + b/(c + d*x)^3)")]
141141
[InlineData("x*(a + b*sin(c + d*(f + x)^n))^2")]
142+
[InlineData("(a + b*x)^2*(f + ln(c + d*x))^n/(a*c + a*d*x)")]
143+
[InlineData("x*(f + ln(c*(c + d*x)))^n/(c + d*x)^2")]
142144
public void APolynomialBesideAFunctionOfAShiftedLinear(string integrand) => DifferentiatesBack(integrand);
143145

144146
/// <summary>

0 commit comments

Comments
 (0)