Skip to content

Commit b3e736e

Browse files
A root over a number times 1 + i tan(z) is integrated as it is over a + i a tan(z) (#1801)
Under the tangent, 1 + i u beside 1 + u^2 shares the root u = i with it, and the root was taken out first only where a symbol stood below the bar; with numbers alone the split over the rationals and i was left to answer it, which it does for a polynomial above the bar and not for a root. sqrt(c + d tan(x))/(1 + i tan(x)) was declined where sqrt(c + d tan(x))/(a + i a tan(x)) is answered. The root is taken out beside anything above the bar that is not a polynomial now. Part of #1788. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent e29b612 commit b3e736e

3 files changed

Lines changed: 39 additions & 5 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,21 @@ and the two together are a polynomial in `e^(i z)` and its reciprocal, multiplie
651651
| `"sqrt(tan(c + d*x))*(A + B*tan(c + d*x))/(a + i*a*tan(c + d*x))".ToEntity().Integrate("x")` | `integral(...)` | arctangents and logarithms of `sqrt(tan(c + d x))` |
652652
| `"(a + i*a*tan(c + d*x))^2*(A + B*tan(c + d*x))/(q - i*q*tan(c + d*x))^4".ToEntity().Integrate("x")` | `integral(...)` | a sum of multiples of `e^(k i (c + d x))` |
653653

654+
### A root over a number times `1 + i tan(z)` is integrated as it is over `a + i a tan(z)`
655+
656+
**Answers where there were none.** `sqrt(c + d tan(x))/(1 + i tan(x))` was declined, where
657+
`sqrt(c + d tan(x))/(a + i a tan(x))` is answered. Under the tangent `1 + i u` beside `1 + u^2` shares
658+
the root `u = i` with it, and the root was taken out first, as `i (u - i)^2 (u + i)`, only where a symbol
659+
stood below the bar: with numbers alone the split over the rationals and `i` was left to answer it,
660+
which it does for a polynomial above the bar and not for a root. The root is taken out beside anything
661+
above the bar that is not a polynomial now
662+
([#1788](https://github.com/asc-community/AngouriMath/issues/1788)).
663+
664+
| Input | Was (2.5.0) | Now |
665+
|---|---|---|
666+
| `"sqrt(c + d*tan(x))/(1 + i*tan(x))".ToEntity().Integrate("x")` | `integral(...)` | arctangents and logarithms of `sqrt(c + d tan(x))` |
667+
| `"(c + d*tan(x))^(3/2)/(1 + i*tan(x))".ToEntity().Integrate("x")` | `integral(...)` | the same, with a multiple of the root |
668+
654669
### A polynomial over a power of one linear with a symbol in it is written in powers of the linear
655670

656671
**Answers where there were none.** `t^9/(a + b t)^8` is a polynomial and eight powers of `1/(a + b t)`,

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ is var (multiple, leftover)
786786
// `1/((a + i a tan(x)) (c + d tan(x)))`. The quadratic is written over the linears of
787787
// its roots and the shared one taken as one power, coprime and squarefree for the
788788
// splits below.
789-
if (OverAComplexRootSharedWithAQuadratic(denominator, x) is { } overTheSharedRoot
789+
if (OverAComplexRootSharedWithAQuadratic(numerator, denominator, x) is { } overTheSharedRoot
790790
&& (SolveByPartialFractions(numerator / overTheSharedRoot, x, integrateByParts)
791791
?? Integration.ComputeIndefiniteIntegral(numerator / overTheSharedRoot, x, integrateByParts)) is { } overTheComplexRoot)
792792
return overTheComplexRoot;
@@ -14375,11 +14375,16 @@ private static bool IsASumOfMonomials(Entity expr, Entity.Variable x)
1437514375
/// where no quadratic shares such a root. <c>(1 + i x)(1 + x^2)</c> is
1437614376
/// <c>i (x - i)^2 (x + i)</c>.
1437714377
/// </summary>
14378-
private static Entity? OverAComplexRootSharedWithAQuadratic(Entity denominator, Entity.Variable x)
14378+
private static Entity? OverAComplexRootSharedWithAQuadratic(Entity numerator, Entity denominator, Entity.Variable x)
1437914379
{
14380-
// With numbers only, the split over the rationals and the imaginary unit answers it as
14381-
// it is written.
14382-
if (!denominator.Vars.Any(symbol => symbol != x))
14380+
// With numbers only below the bar and a polynomial above it, the split over the
14381+
// rationals and the imaginary unit answers it as it is written. Not with a root above
14382+
// it: `sqrt(c + d u)/((1 + i u)(1 + u^2))`, which the tangent substitution makes of
14383+
// `sqrt(c + d tan(x))/(1 + i tan(x))`, is a question for the substitution in the root,
14384+
// and in its variable the shared root is a quadratic beside a quartic, which nothing
14385+
// reads; with `a + i a u` for `1 + i u` it was answered, and with the number declined.
14386+
// https://github.com/asc-community/AngouriMath/issues/1788
14387+
if (!denominator.Vars.Any(symbol => symbol != x) && TreeAnalyzer.TryGetPolynomial(numerator, x, out _))
1438314388
return null;
1438414389
var written = new List<(Entity Base, EInteger Power)>();
1438514390
Entity constant = Number.Integer.One;

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,19 @@ public void AnImaginaryMobiusPowerIsSettled(string integrand)
118118
return;
119119
DifferentiatesBack(integrand);
120120
}
121+
122+
/// <summary>
123+
/// A root above the bar and numbers below it: under the tangent <c>1 + i u</c> beside
124+
/// <c>1 + u^2</c> shares the root <c>u = i</c> with it, and that was taken out only where a
125+
/// symbol stood below the bar, so <c>a + i a tan(x)</c> was answered and
126+
/// <c>1 + i tan(x)</c> declined.
127+
/// https://github.com/asc-community/AngouriMath/issues/1788
128+
/// </summary>
129+
[Theory]
130+
[InlineData("sqrt(c + d*tan(x))/(1 + i*tan(x))")]
131+
[InlineData("sqrt(c + d*tan(x))/(2 + 2*i*tan(x))")]
132+
[InlineData("sqrt(c + d*tan(x))/(1 - i*tan(x))")]
133+
[InlineData("(c + d*tan(x))^(3/2)/(1 + i*tan(x))")]
134+
public void ARootOverANumberTimesAnImaginaryTangentSum(string integrand) => DifferentiatesBack(integrand);
121135
}
122136
}

0 commit comments

Comments
 (0)