Skip to content

Commit 8a310f7

Browse files
An odd power of the secant over a whole power of a + i a tan is integrated in the sum (#1813)
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent b3ac1e8 commit 8a310f7

3 files changed

Lines changed: 36 additions & 9 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,23 @@ quotient of two such linears the sum is `(b - d t^2)^2 + (c t^2 - a)^2`. Rubi's
365365
| `"(c + d*tan(x))^(3/2)/(a + b*tan(x))^3".ToEntity().Integrate("x")` | `integral(...)` | the same |
366366
| `"1/((a + b*tan(x))^(3/2)*(c + d*tan(x))^(3/2))".ToEntity().Integrate("x")` | `integral(...)`; past a minute on the unreleased master | in the root of the quotient of the two, in a second |
367367

368+
### An odd power of the secant over a whole power of `a + i a tan` is integrated in the sum
369+
370+
**Answers where there were none.** `sec(x)^5/(a + i a tan(x))^2` was declined: the rule that integrates
371+
a power of the secant beside a power of `a + i a tan` in `u = a + i a tan(z)` left whole powers on both
372+
to the rules for the sine and the cosine, which answer `cos(x)^5/(a + i a tan(x))^3` and
373+
`sec(x)^3/(a + i a tan(x))^4` and not `sec(x)^5/(a + i a tan(x))^2`. It takes an odd power `s` of the
374+
secant over the sum's `n`-th where `s + 2 n = 1`, which in `u` is a whole power of `2 a - u` over the root of `u`. And it checks the antiderivative it finds in `u` on the
375+
path, `u = a + i a t` for a real `t`, where it checked the answer in `x`: the expression in `x` carries a
376+
factor constant on intervals and was large enough that the sampled evaluations could not decide, so
377+
right answers were declined after seconds
378+
([#718](https://github.com/asc-community/AngouriMath/issues/718)).
379+
380+
| Input | Was (2.5.0) | Now |
381+
|---|---|---|
382+
| `"sec(x)^5/(a + i*a*tan(x))^2".ToEntity().Integrate("x")` | `integral(...)` | 2,431 characters |
383+
| `"sec(x)^7/(a + i*a*tan(x))^3".ToEntity().Integrate("x")` | `integral(...)` | 3,774 characters |
384+
368385
### A power of the secant beside a power of `a + i a tan` is integrated in the sum, whatever the powers
369386

370387
**Answers where there were none.** `sec(x)^3 sqrt(a + i a tan(x))` was declined, with the rest of

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27079,10 +27079,14 @@ static Entity SumOfThePowers(Entity first, Entity second)
2707927079
|| !TreeAnalyzer.TryGetPolyLinear(argument, x, out var slope, out _) || TreeAnalyzer.IsZero(slope))
2708027080
return null;
2708127081
secantPower = secantPower is Number ? secantPower : secantPower.InnerSimplified;
27082-
// Whole powers on both are a rational function of the sine and the cosine, which the
27083-
// rules for those answer in a fraction of a second, where in u they ran past five:
27084-
// `cos(x)^5/(a + i a tan(x))^3`.
27085-
if (sumPower is Number.Integer && secantPower is Number.Integer)
27082+
// Whole powers on both are left to the rules for the sine and the cosine, which answer
27083+
// `cos(x)^5/(a + i a tan(x))^3` and `sec(x)^3/(a + i a tan(x))^4` in a fraction of a second
27084+
// where in u they ran past five -- but for an odd power s of the secant over the sum's n-th
27085+
// with s + 2 n = 1. Then u^n (sec(z)^2)^((s - 2)/2) is a whole power of 2 A - u over the root
27086+
// of u, which is answered in a second, and `sec(x)^5/(a + i a tan(x))^2` was declined by
27087+
// every route but this.
27088+
if (sumPower is Number.Integer { EInteger: var whole } && secantPower is Number.Integer { EInteger: var secant }
27089+
&& !(secant + whole * 2).Equals(EInteger.One))
2708627090
return null;
2708727091
Entity constantTerm = Number.Integer.Zero;
2708827092
foreach (var term in Sumf.LinearChildren(sum))
@@ -27102,14 +27106,19 @@ static Entity SumOfThePowers(Entity first, Entity second)
2710227106
// The antiderivative in u was found for a real u, and its conditions say so -- a radicand
2710327107
// at least zero -- where u = A + i A tan(z) is not real: kept, they hold nowhere on the
2710427108
// path and the answer has no value at all. The formula is an antiderivative wherever it is
27105-
// analytic, so the conditions go, each piecewise taken arm by arm, and an answer is kept
27106-
// only where its derivative is the integrand at the sampled points.
27109+
// analytic, so the conditions go, each piecewise taken arm by arm, and a formula is kept
27110+
// only where its derivative in u is the integrand in u on the path, u = A + i A t for a
27111+
// real t, at the sampled points: checked in x, through the factor constant on intervals,
27112+
// the expression was large enough that the evaluations could not decide, and right
27113+
// answers were declined after seconds.
27114+
var onThePath = Variable.CreateUnique(inU + a, "t_path");
27115+
var path = a + MathS.i * a * onThePath;
27116+
var integrandOnThePath = inU.Substitute(u, path);
2710727117
foreach (var arm in new[] { 0, -1 })
2710827118
{
2710927119
var formula = WithoutConditions(inUAnswer, arm);
27110-
var answer = expr * formula.Substitute(u, sum) / differentiatesBackTo;
27111-
if (Functions.PartialFractions.DerivativeHoldsAtSampledPoints(answer, expr, x))
27112-
return answer;
27120+
if (Functions.PartialFractions.HoldsAtSampledPoints(formula.Differentiate(u).Substitute(u, path), integrandOnThePath, onThePath))
27121+
return expr * formula.Substitute(u, sum) / differentiatesBackTo;
2711327122
if (!inUAnswer.Nodes.Any(node => node is Piecewise))
2711427123
break;
2711527124
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public sealed class SecantBesideAnImaginaryTangentSumIntegralTest
2727
[InlineData("(k*cos(x))^(3/2)*sqrt(a + i*a*tan(x))")]
2828
[InlineData("cos(x)^9*(a + i*a*tan(x))^(7/2)")]
2929
[InlineData("(m*sec(x))^(2/3)*(a + i*a*tan(x))^(5/3)")]
30+
[InlineData("sec(x)^5/(a + i*a*tan(x))^2")]
3031
public void InTheSum(string integrand)
3132
{
3233
var integral = integrand.ToEntity().Integrate("x");

0 commit comments

Comments
 (0)