diff --git a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs
index f1a2c2134..6f3873990 100644
--- a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs
+++ b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs
@@ -5142,6 +5142,26 @@ static bool IsTwice(Entity argument, Entity.Variable x)
return reduced.Denominator.Equals(EInteger.One) && reduced.Numerator.IsEven ? rebuilt : null;
}
+ ///
+ /// Every whole power of a product written as the product of the powers, (a P)^5
+ /// as a^5 P^5, which is exact for a whole power and is the spelling the rational
+ /// reader needs: (4u^2 + 12u^4 + 12u^6 + 4u^8)/(a (1 - u^2))^5 was declined after
+ /// five seconds and is answered in 27 ms as .../(a^4 (1 - u^2)^5). Four rounds,
+ /// since a distributed factor may itself be such a power.
+ ///
+ private static Entity WithWholePowersOfProductsDistributed(Entity integrand)
+ {
+ for (var round = 0; round < 4; round++)
+ {
+ var distributed = integrand.Replace(node =>
+ node is Powf(Mulf(var l, var r), Number.Integer power) ? MathS.Pow(l, power) * MathS.Pow(r, power) : node);
+ if (distributed == integrand)
+ break;
+ integrand = distributed;
+ }
+ return integrand;
+ }
+
///
/// An integrand holding a fractional power of something linear in the variable,
/// turned into a rational function by u^q = a*x + b.
@@ -5308,6 +5328,15 @@ node is Powf(var radical, Number.Rational e) && e is not Number.Integer
var integrand = Functions.SingleQuotient.Combine((rewritten * dx).Simplify());
if (integrand is Providedf(var inner, _))
integrand = inner;
+ // The quotient of linears leaves `(a (1 - u^2))^5` below the bar, which the rational
+ // reader does not read and whose distributed spelling it answers at once: Rubi's
+ // `x^3 sqrt((a x + 1)/(a x - 1))` took nine seconds through the split terms, and
+ // takes half of one as a single quotient over `a^5 (1 - u^2)^5`. Only where the
+ // integrand in u is rational: with a root of u still in it -- a second base, as in
+ // Timofeev's 314 -- the distributed spelling sent the radical rules down a path
+ // that answered with a sign function, where the undistributed one is answered exactly.
+ if (!integrand.Nodes.Any(node => node is Powf(var radicand, Number.Rational fractional) && fractional is not Number.Integer && radicand.ContainsNode(u)))
+ integrand = WithWholePowersOfProductsDistributed(integrand);
// For an even q the principal root is not negative wherever it is real, and a root
// holding a power of u gives that power up: `1/sqrt(t + t^(3/2))` under `u = sqrt(t)`
// is `2u/sqrt(u^2 + u^3)`, a root of a cubic, and is `2/sqrt(1 + u)`. Where the
@@ -9890,14 +9919,7 @@ node is Powf(Powf(var @base, var inner), var outer)
// simplifier writes `4a^2 u^2` as `(a u)^2 4`, and no rational reader sees the `u^2`
// inside -- Timofeev's `1/(a^2 + b^2 cosh(x)^2)` was declined in that spelling and
// is answered in the other.
- for (var round = 0; round < 4; round++)
- {
- var distributed = integrand.Replace(node =>
- node is Powf(Mulf(var l, var r), Number.Integer power) ? MathS.Pow(l, power) * MathS.Pow(r, power) : node);
- if (distributed == integrand)
- break;
- integrand = distributed;
- }
+ integrand = WithWholePowersOfProductsDistributed(integrand);
// u is an exponential, so it is positive, and a root holding a power of it gives
// that power up: `sqrt(1 + tanh(4x))` is a root of `2u/(1 + u)` here and nothing
// rationalises that; as `sqrt(2) sqrt(u)/sqrt(1 + u)` it is one substitution more.
diff --git a/Sources/Tests/UnitTests/Calculus/ExponentialOfALogarithmIntegralTest.cs b/Sources/Tests/UnitTests/Calculus/ExponentialOfALogarithmIntegralTest.cs
index 8b08bd904..0adf3706e 100644
--- a/Sources/Tests/UnitTests/Calculus/ExponentialOfALogarithmIntegralTest.cs
+++ b/Sources/Tests/UnitTests/Calculus/ExponentialOfALogarithmIntegralTest.cs
@@ -55,6 +55,21 @@ private static void DifferentiatesBack(string integrand)
[InlineData("(3 - 3/(4*x^2))^3/e^(2*acoth(2*x))")]
public void AnExponentialOfAnInverseHyperbolicCotangent(string integrand) => DifferentiatesBack(integrand);
+ ///
+ /// The quotient of linears under the root leaves (a (1 - u^2))^5 below the bar in
+ /// u, which the rational reader does not read as a^5 (1 - u^2)^5 until it
+ /// is written so: x^3 sqrt((a x + 1)/(a x - 1)) took nine seconds through the
+ /// split terms and takes half of one as a single quotient; e^acoth(a x) x^3
+ /// eighteen seconds and a tenth. Pinned as solved, not as timed -- a wall clock in a
+ /// test measures the runner.
+ ///
+ [Theory]
+ [InlineData("x^3*sqrt((2*x+1)/(2*x-1))")]
+ [InlineData("e^acoth(2*x)*x^3")]
+ [InlineData("1/(e^(3*acoth(2*x))*x^4)")]
+ [InlineData("e^acoth(2*x)*sqrt(3-3/(2*x))/x^4")]
+ public void APowerOfAProductBelowTheBarIsReadDistributed(string integrand) => DifferentiatesBack(integrand);
+
/// The fold is the identity it is: e^(k ln q) with any multiplier, nested or not.
[Theory]
[InlineData("e^(3*ln(x + 1))")]