diff --git a/BREAKING-CHANGES.md b/BREAKING-CHANGES.md index 490257fd1..d9da34a20 100644 --- a/BREAKING-CHANGES.md +++ b/BREAKING-CHANGES.md @@ -521,6 +521,21 @@ read them as nonzero. They are now decided over one bar, expanded, and at pinned | `"e^(3*acoth(a*x))/(c-a*c*x)^3".Integrate("x")`, and over `(c - a c x)^4` | left unevaluated | an antiderivative in `sqrt((a x + 1)/(a x - 1))` | | `"e^(2*acoth(a*x))*sqrt(c-a*c*x)/x".Integrate("x")`, and over `x^2` | left unevaluated | an antiderivative in `sqrt(c - a c x)`, by cases on the sign of `c` | +### `e^(n i arctan(a x))` to a power that is not whole is integrated + +**Answers where there were none.** `e^(n i arctan(L))` is written algebraically, as +`(1 + i L)^n (1 + L^2)^(-n/2)`, and for an `n` that is not whole those are two radicals of different +orders that nothing reads: `x^2 e^(3/2 i arctan(a x))` was left unevaluated. For such an `n` it is +written `((1 + i L)/(1 - i L))^(n/2)`, the same on the principal branch for a real `L`, one power of a +quotient of linears, which the substitution for that reads. Rubi's 5.3.6 +([#718](https://github.com/asc-community/AngouriMath/issues/718)). + +| Input | Was (2.5.0) | Now | +|---|---|---| +| `"e^(3/2*i*arctan(a*x))*x^2".ToEntity().Integrate("x")` | `integral(...)` | an antiderivative in `((1 + i a x)/(1 - i a x))^(1/4)` | +| `"x^3/e^(3/2*i*arctan(a*x))".ToEntity().Integrate("x")` | `integral(...)` | the same | +| `"e^(1/3*i*arctan(x))*x".ToEntity().Integrate("x")` | `integral(...)` | an antiderivative in `((1 + i x)/(1 - i x))^(1/6)` | + ### `NaN` again, from an exponent that was read as written rather than as a number **A wrong answer, and a second one of the same kind.** `(a^2 + 2abx^2 + b^2x^4)^3/x^7` came back as diff --git a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs index fcc8620a3..63de38a86 100644 --- a/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs +++ b/Sources/AngouriMath/Functions/Continuous/Integration/IndefiniteIntegralSolver.cs @@ -7356,10 +7356,18 @@ node is Powf(var @base, Number.Rational power) && power is not Number.Integer && return node; rewrote = true; // The tangent's as two powers, `(1 + i L)^n (1 + L^2)^(-n/2)`, which the - // radical rules read where a power of the quotient is one node to them. + // radical rules read where a power of the quotient is one node to them; for an + // n that is not whole, as the power of the quotient, + // `((1 + i L)/(1 - i L))^(n/2)`, the same on the principal branch for a real L -- + // the quotient is `e^(2 i arctan(L))` and `2 arctan(L)` is its principal + // argument -- and one power of a quotient of linears, which the substitution + // for it reads, where `(1 + i a x)^(3/2) (1 + a^2 x^2)^(-3/4)` is two radicals + // of different orders that nothing reads. if (inverse is Arctanf) { var halfPower = Number.Rational.Create(n.ERational.Negate().Divide(2)); + if (n is not Number.Integer) + return MathS.Pow((1 + MathS.i * argument) / (1 - MathS.i * argument), Number.Rational.Create(n.ERational.Divide(2))); return (n == Number.Integer.One ? 1 + MathS.i * argument : MathS.Pow(1 + MathS.i * argument, n)) * MathS.Pow(1 + MathS.Sqr(argument), halfPower); } Entity unit = inverse is Arcsinf diff --git a/Sources/Tests/UnitTests/Calculus/InverseTrigonometricSubstitutionTest.cs b/Sources/Tests/UnitTests/Calculus/InverseTrigonometricSubstitutionTest.cs index 6b990befe..811e69f61 100644 --- a/Sources/Tests/UnitTests/Calculus/InverseTrigonometricSubstitutionTest.cs +++ b/Sources/Tests/UnitTests/Calculus/InverseTrigonometricSubstitutionTest.cs @@ -216,5 +216,20 @@ public void ALinearArgumentAndAMultipleOfTheQuadratic(string integrand, double[] [InlineData("x/e^(2*i*arctan(1 + 2*x))", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] public void AnExponentialOfTheInverseIsAlgebraic(string integrand, double[] points) => DifferentiatesBack(integrand, points); + + /// + /// To a power that is not whole, e^(n i arctan(L)) is one power of a quotient of + /// linears, ((1 + i L)/(1 - i L))^(n/2) for a real L, which the substitution + /// for such a power reads, where (1 + i L)^n (1 + L^2)^(-n/2) is two radicals of + /// different orders: Rubi's 5.3.6. + /// + [Theory] + [InlineData("e^(3/2*i*arctan(2*x))*x^2", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] + [InlineData("e^(3/2*i*arctan(2*x))/x^4", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] + [InlineData("x^3/e^(3/2*i*arctan(2*x))", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] + [InlineData("e^(1/3*i*arctan(x))*x", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] + [InlineData("e^(3/2*i*arctan(1 + 2*x))*x^2", new[] { -1.6, -0.4, 0.3, 1.1, 2.4 })] + public void ToAPowerThatIsNotWhole(string integrand, double[] points) + => DifferentiatesBack(integrand, points); } }