Skip to content

Commit 77899a6

Browse files
A symbolic power of a + i a tan is gathered with the secant's in the sum (#1818)
In u = a + i a tan(z), u^n beside (u/a)^r is one power of u/a up to a factor constant on the path; written apart, a symbolic n left them unread. Part of #718. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent c21de3e commit 77899a6

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,22 @@ answered without one now ([#718](https://github.com/asc-community/AngouriMath/is
439439

440440
| Input | Was (2.5.0) | Now |
441441
|---|---|---|
442-
| `"sec(x)^3*sqrt(a + i*a*tan(x))".ToEntity().Integrate("x")` | `integral(...)` | powers of `sqrt(a - i a tan(x))` times a factor constant wherever it is continuous, 495 characters |
443-
| `"sec(x)^5/(a + i*a*tan(x))^(3/2)".ToEntity().Integrate("x")` | `integral(...)` | the same, 399 characters |
444-
| `"cos(x)^9*(a + i*a*tan(x))^(7/2)".ToEntity().Integrate("x")` | `integral(...)`; on the unreleased master, an answer provided `1 + i tan(x) >= 0` | 1,067 characters, unconditional |
442+
| `"sec(x)^3*sqrt(a + i*a*tan(x))".ToEntity().Integrate("x")` | `integral(...)` | powers of `sqrt(a - i a tan(x))` times a factor constant wherever it is continuous, 285 characters |
443+
| `"sec(x)^5/(a + i*a*tan(x))^(3/2)".ToEntity().Integrate("x")` | `integral(...)` | the same, 225 characters |
444+
| `"cos(x)^9*(a + i*a*tan(x))^(7/2)".ToEntity().Integrate("x")` | `integral(...)`; on the unreleased master, an answer provided `1 + i tan(x) >= 0` | 768 characters, unconditional |
445+
446+
### A symbolic power of `a + i a tan` is gathered with the secant's in the sum
447+
448+
**Answers where there were none.** `(k sec(x))^(4 - 2 n) (a + i a tan(x))^n` was declined. In
449+
`u = a + i a tan(z)` it is `u^n (u/a)^(1 - n) ((2 a - u)/a)^(1 - n)`, whose first two factors are one
450+
power of `u/a`, and written apart no rule read them. They are gathered now, `u^n` being `a^n (u/a)^n` up
451+
to a factor constant on the path; the answers to the rest of Rubi's 4.3.1.2 integrated in `u` come out
452+
shorter by a third or more ([#718](https://github.com/asc-community/AngouriMath/issues/718)).
453+
454+
| Input | Was (2.5.0) | Now |
455+
|---|---|---|
456+
| `"(k*sec(x))^(4 - 2*n)*(a + i*a*tan(x))^n".ToEntity().Integrate("x")` | `integral(...)` | 466 characters |
457+
| `"(k*sec(x))^(2*n)*(a + i*a*tan(x))^(3 - n)".ToEntity().Integrate("x")` | `integral(...)` | 675 characters |
445458

446459
### A quotient in `x^2` over a power of a linear in `x^2` and a biquadratic is split in `x^2`
447460

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27124,8 +27124,13 @@ static Entity SumOfThePowers(Entity first, Entity second)
2712427124
}
2712527125
var u = Variable.CreateUnique(expr, "u_tan");
2712627126
var half = ((secantPower - 2) / 2).InnerSimplified;
27127-
Entity squared = MathS.Pow(u / a, half) * MathS.Pow((2 * a - u) / a, half);
27128-
var inU = MathS.Pow(u, sumPower) * squared;
27127+
// u^n is A^n (u/A)^n up to a factor constant along the path, which the quotient below
27128+
// takes care of, and gathered with the secant's (u/A)^r one power: with a symbol for the
27129+
// powers, `u^(2 - n) (u/A)^(n - 1)` is (u/A)^1, and written apart it was read by no rule.
27130+
var gathered = (sumPower + half).InnerSimplified;
27131+
if (gathered is not Number && gathered.Complexity <= 40)
27132+
gathered = gathered.Simplify();
27133+
var inU = MathS.Pow(u / a, gathered) * MathS.Pow((2 * a - u) / a, half);
2712927134
if (Integration.ComputeAsAQuestionOfItsOwn(inU, u, integrateByParts) is not { } inUAnswer
2713027135
|| inUAnswer.Nodes.Any(node => node == MathS.NaN))
2713127136
return null;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ public sealed class SecantBesideAnImaginaryTangentSumIntegralTest
3131
[InlineData("sec(x)^7/(a + i*a*tan(x))^4")]
3232
[InlineData("sec(x)^9/(a + i*a*tan(x))^8")]
3333
[InlineData("(k*sec(x))^3/(a - i*a*tan(x))^2")]
34+
[InlineData("(m*sec(x))^(4 - 2*n)*(a + i*a*tan(x))^n")]
35+
[InlineData("(m*sec(x))^(2*n)*(a + i*a*tan(x))^(3 - n)")]
3436
public void InTheSum(string integrand)
3537
{
3638
var integral = integrand.ToEntity().Integrate("x");
3739
var text = integral.Stringize();
3840
Assert.DoesNotContain("integral(", text);
3941
Assert.True(text.Length < 5000, $"{text.Length} characters of answer for {integrand}");
40-
Entity Pinned(Entity e) => e.Substitute("a", 1.3).Substitute("k", 0.7).Substitute("m", 1.1);
42+
Entity Pinned(Entity e) => e.Substitute("a", 1.3).Substitute("k", 0.7).Substitute("m", 1.1).Substitute("n", 2.3);
4143
var derivative = Pinned(integral.Substitute("C", 0)).Differentiate("x");
4244
var original = Pinned(integrand.ToEntity());
4345
var compared = 0;

0 commit comments

Comments
 (0)