Skip to content

Commit 459a531

Browse files
The scaling rule does not simplify an integrand with the imaginary unit in it (#1718)
* The scaling rule does not simplify an integrand with the imaginary unit in it The rule that scales the variable by the integrand's one symbol simplified the scaled integrand three times to separate the whole power of the scale it is homogeneous of. With the imaginary unit beside the symbol that search ran past any budget: ((1 + i a x)/(1 - i a x))^(-5/4)/x^2, which is declined, took more than two minutes to be. Inner simplification separates what a whole power of the scale does, and where the parts do not separate so the rule declines; it is declined in 3 s. Part of #718. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura * The scaling rule's change in BREAKING-CHANGES.md Measured on the corpus, the integrands the scaling rule held up are answered by the rules after it now: sec(c + d x)^3/(a + i a tan(c + d x)), five powers of x beside e^(k i arctan(a + b x)), 1/(a + b csc(c + d x)^2)^4 among them, and 2.5.0 declined eight of nine. Part of #718. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 3a3d016 commit 459a531

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,24 @@ interval between the poles of the tangent, as the substitution's are
465465
| `"(A + B*tan(x))/(a + i*a*tan(x))^2".ToEntity().Integrate("x")` | `integral(...)` | the same |
466466
| `"1/(a + i*a*tan(c + d*x))^3".ToEntity().Integrate("x")` | `integral(...)` | the same in `tan(c + d x)` |
467467

468+
### An integrand with the imaginary unit in it is not simplified by the rule that scales the variable
469+
470+
**Answers where there were none.** The rule that scales the variable by the integrand's one symbol
471+
simplified the scaled integrand three times, to separate the whole power of the scale it is
472+
homogeneous of. With the imaginary unit beside the symbol that search ran past any budget: on the
473+
unreleased master `((1 + i a x)/(1 - i a x))^(-5/4)/x^2` took more than two minutes to be declined,
474+
and the rules after this one never had their turn on integrands that it held up. Such an integrand is
475+
inner-simplified now, and declined in seconds where the parts do not separate
476+
([#718](https://github.com/asc-community/AngouriMath/issues/718)).
477+
478+
| Input | Was (2.5.0) | Now |
479+
|---|---|---|
480+
| `"sec(c + d*x)^3/(a + i*a*tan(c + d*x))".ToEntity().Integrate("x")` | `integral(...)` | logarithms of `tan((c + d x)/2) ± 1` and a quotient |
481+
| `"tan(c + d*x)^(8/3)/(a + i*a*tan(c + d*x))".ToEntity().Integrate("x")` | `integral(...)` | an antiderivative in `tan(c + d x)^(1/3)` |
482+
| `"1/(a + b*csc(c + d*x)^2)^4".ToEntity().Integrate("x")` | `integral(...)` | an antiderivative, by the signs of `a` and `b` |
483+
| `"x^4*e^(2*i*atan(a + b*x))".ToEntity().Integrate("x")` | `integral(...)` | a polynomial, logarithms and arctangents of `a + b x` |
484+
| `"sec(c + d*x)^2/(a + i*a*tan(c + d*x))".ToEntity().Integrate("x")` | `ln(i a d tan(c + d x) + a d)/(i a d)` | `ln(i tan(c + d x) + 1)/(i a d)`, the same up to a constant |
485+
468486
### `NaN` was returned as the antiderivative of something that has one
469487

470488
**A wrong answer, not a missing one.** `1/(a*x^2)` came back as `NaN + C`, and `NaN` is this

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18538,7 +18538,13 @@ bool IsAConstantTimesAPowerOfOneMinusUSquared(Entity polynomial, out Entity cons
1853818538

1853918539
// dx = c dt.
1854018540
var t = Variable.CreateUnique(expr, "u_scale");
18541-
var scaled = (expr.Substitute(x, scale * t) * scale).Simplify();
18541+
// With the imaginary unit in the integrand the simplifier's search beside the symbol
18542+
// does not end within any budget, and inner simplification separates what a whole
18543+
// power of the scale does: `((1 + i a x)/(1 - i a x))^(-5/4)/x^2` under its radical's
18544+
// substitution was minutes here before it was declined. Where the parts do not
18545+
// separate so, the check below declines it.
18546+
Entity Simplified(Entity e) => HoldsTheImaginaryUnit(expr) ? Functions.PartialFractions.Bare(e.InnerSimplified) : e.Simplify();
18547+
var scaled = Simplified(expr.Substitute(x, scale * t) * scale);
1854218548
if (scaled.ContainsNode(x))
1854318549
return null;
1854418550

@@ -18547,11 +18553,11 @@ bool IsAConstantTimesAPowerOfOneMinusUSquared(Entity polynomial, out Entity cons
1854718553
// The integrand with the scale set to one is the candidate h(t), and what is left
1854818554
// over when the scaled integrand is divided by it is the candidate factor. Read off
1854918555
// rather than searched for: if the two do separate, the quotient *is* the factor.
18550-
var withoutScale = scaled.Substitute(scale, Number.Integer.One).Simplify();
18556+
var withoutScale = Simplified(scaled.Substitute(scale, Number.Integer.One));
1855118557
if (withoutScale.ContainsNode(scale) || withoutScale == Number.Integer.Zero)
1855218558
return null;
1855318559

18554-
var factor = (scaled / withoutScale).Simplify();
18560+
var factor = Simplified(scaled / withoutScale);
1855518561
// Collapsing the quotient attaches the condition that the denominator it cleared is
1855618562
// non-zero. That denominator is the integrand's own, so the condition says where the
1855718563
// integrand is defined and nothing about this rewrite; it is dropped for the same

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,20 @@ private static void DifferentiatesBack(string integrand)
7979
[InlineData("(A + B*tan(x))/(a + i*a*tan(x))^2")]
8080
[InlineData("1/(a + i*a*tan(c + d*x))^3")]
8181
public void APowerOfAPlusIATangent(string integrand) => DifferentiatesBack(integrand);
82+
83+
/// <summary>
84+
/// A power of a quotient of linears with the imaginary unit in it, beside a power of x the
85+
/// substitution for it does not take down to something answered: declined, and within a
86+
/// minute. The scaling of the variable simplified it with the symbol beside the imaginary
87+
/// unit, and that ran past two minutes before the decline.
88+
/// </summary>
89+
[Theory]
90+
[InlineData("((1 + i*a*x)/(1 - i*a*x))^(-5/4)/x^2")]
91+
[InlineData("((1 + i*a*x)/(1 - i*a*x))^(-5/4)/x^3")]
92+
public void AnImaginaryMobiusPowerIsDeclinedWithinAMinute(string integrand)
93+
{
94+
var integrating = System.Threading.Tasks.Task.Run(() => integrand.ToEntity().Integrate("x"));
95+
Assert.True(integrating.Wait(TimeSpan.FromSeconds(60)), $"{integrand} was not settled within a minute");
96+
}
8297
}
8398
}

0 commit comments

Comments
 (0)