You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a294a9c
Browse filesBrowse the repository at this point in the historyBrowse files
Integrate an arctangent over a power of d (1 +- i c x) under the tangent
Under x = tan(u)/c, 1 + i tan(u) is e^(i u)/cos(u), so x^m (a + b atan(c x))^p/(d (1 +- i c x))^k
is (a + b u)^p (tan(u)/c)^m d^(-k) e^(-+i k u) cos(u)^(k - 2)/c, a polynomial in u times
exponentials and trigonometric functions. Rubi's 5.3.4 (a + b atan(c x))^2/(d + i c d x)^2 and seven
like it ran out of time.
Part of #718
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
var (numerator, denominator) = Functions.SingleQuotient.Of(expr);
29384
+
Arctanf? arctangent = null;
29385
+
Entity? rate = null;
29386
+
foreach (var node in numerator.Nodes)
29387
+
if (node is Arctanf found && found.ContainsNode(x))
29388
+
{
29389
+
if (arctangent is not null && arctangent != found)
29390
+
return null;
29391
+
if (!TreeAnalyzer.TryGetPolyLinear(found.Argument, x, out var slope, out var offset) || !Functions.PartialFractions.IsZeroAsAValue(offset))
29392
+
return null;
29393
+
(arctangent, rate) = (found, slope);
29394
+
}
29395
+
if (arctangent is null || rate is null)
29396
+
return null;
29397
+
// Below the bar one power of a linear d (1 + s i c x), s = +-1, and nothing else with x.
29398
+
Entity? linear = null;
29399
+
var k = 0;
29400
+
Entity constant = Number.Integer.One;
29401
+
foreach (var factor in Mulf.LinearChildren(denominator))
29402
+
{
29403
+
if (!factor.ContainsNode(x)) { constant *= factor; continue; }
29404
+
var (b, e) = factor is Powf(var pb, Number.Integer { EInteger: var pe }) && pe.Sign > 0 && pe.CanFitInInt32() ? (pb, pe.ToInt32Unchecked()) : (factor, 1);
29405
+
if (linear is not null)
29406
+
return null;
29407
+
(linear, k) = (b, e);
29408
+
}
29409
+
if (linear is null || !TreeAnalyzer.TryGetPolyLinear(linear, x, out var lSlope, out var lOffset) || Functions.PartialFractions.IsZeroAsAValue(lOffset))
29410
+
return null;
29411
+
// The ratio of slope to constant is +-i c.
29412
+
var ratio = (lSlope / (lOffset * MathS.i * rate)).InnerSimplified;
29413
+
int sign;
29414
+
if (Functions.PartialFractions.IsZeroAsAValue((ratio - 1).InnerSimplified)) sign = 1;
29415
+
else if (Functions.PartialFractions.IsZeroAsAValue((ratio + 1).InnerSimplified)) sign = -1;
29416
+
else return null;
29417
+
var u = Variable.CreateUnique(expr, "u_atan");
29418
+
// Above the bar: a power of x and the function of the arctangent.
29419
+
var above = numerator.Substitute(arctangent, u);
29420
+
if (above.Substitute(x, Number.Integer.Zero).ContainsNode(x))
29421
+
return null;
29422
+
var inU = above.Substitute(x, MathS.Tan(u) / rate)
0 commit comments