diff --git a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs index 058e0c506..fc7e23228 100644 --- a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs +++ b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs @@ -12882,9 +12882,15 @@ private static bool TheInverseIsBelowTheBar(Entity expr, Entity inverse, Entity. // leaves `x^2 arccsc(x)/sqrt(x^2 - 1)` and stalls, where under `x = csc(u)` it is // `-u^2 csc(u)^4 cot(u)`, two steps of parts against a power of the cosecant. // Or of a function of it alone -- `(a + b arcsin(c x))^2` -- which is a power of - // u after the substitution. + // u after the substitution. Or, of an inverse sine or cosine, a power that is not whole, + // which parts cannot lower: `x^2 arcsin(a x)^n` under the sine is + // `u^n sin(u)^2 cos(u)/a^3`, Euler's formula's exponentials of `i u` beside a power of u, + // each a gamma function. Not of the others: `1/((c + a^2 c x^2) sqrt(arctan(a x)))` is + // a derivative of the inverse's root, answered in 0.7 s elsewhere and in 5 s under the + // tangent. var powerOfTheInverse = expr.Nodes.Any(node => - node is Powf(var @base, Number.Integer power) && power.EInteger.CompareTo(EInteger.One) > 0 + node is Powf(var @base, var power) + && (power is Number.Integer whole ? whole.EInteger.CompareTo(EInteger.One) > 0 : inverse is Arcsinf or Arccosf && !power.ContainsNode(x)) && @base.ContainsNode(inverse) && !@base.Substitute(inverse, u).ContainsNode(x)); // Or, asked for the sine and cosine integrals, the inverse function below the bar, or // a function of it alone there: `x^m/(a + b arcsin(c x))^n` is a polynomial in the diff --git a/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs b/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs index ddc8d77bc..1a7e0b76a 100644 --- a/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs +++ b/Sources/Tests/UnitTests/Calculus/APowerBesideAnExponentialOfAPowerIntegralTest.cs @@ -205,6 +205,19 @@ 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 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 + /// function. Parts cannot lower such a power, and the substitution was taken only for a whole one. Rubi's 5.1.2, + /// 5.2.2 and 5.1.5. + /// + [Theory] + [InlineData("asin(a*x)^n")] + [InlineData("x*acos(a*x)^n")] + [InlineData("x^2*(d + f*asin(a*x))^n")] + [InlineData("(c + a*asin(d - a*x))^n")] + public void ASymbolicPowerOfAnInverseSineOrCosine(string integrand) => DifferentiatesBack(integrand); + /// /// Not where the integral is elementary, an exponential integral or an error function: those keep the form /// they had.