Skip to content

Commit 1f22ce5

Browse files
Integrate a polynomial beside a sine of a power of a shifted linear in that linear (#2095)
The rule that writes a polynomial beside a function of one shifted linear a + b x in u = a + b x took an exponential of a power of it and a power of a logarithm of it. It now takes a sine or a cosine of a sum that is not linear, in whatever holds it: x sin(a + b (c + d x)^n) and x (a + b sin(c + d (f + g x)^n))^2. In u these are powers of u beside the sine of a power of u, which Euler's formula writes as exponentials of that power, each a gamma function. Part of #2075. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent b04f46c commit 1f22ce5

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18385,7 +18385,8 @@ private static (Entity Logarithm, Entity Degree, Entity Offset, Entity Slope)? T
1838518385

1838618386
/// <summary>
1838718387
/// Whether <paramref name="factor"/> is a power that is not whole of something holding a logarithm of something in
18388-
/// <paramref name="x"/>, or an exponential of something in <paramref name="x"/> that is not linear in it.
18388+
/// <paramref name="x"/>, an exponential of something in <paramref name="x"/> that is not linear in it, or holds a
18389+
/// sine or a cosine of one.
1838918390
/// </summary>
1839018391
private static bool IsATranscendentalPowerOfSomethingInX(Entity factor, Entity.Variable x) => factor switch
1839118392
{
@@ -18394,8 +18395,13 @@ private static (Entity Logarithm, Entity Degree, Entity Offset, Entity Slope)? T
1839418395
=> exponent.Nodes.Any(node => node is Sumf or Minusf && node.ContainsNode(x))
1839518396
&& !TreeAnalyzer.TryGetPolyLinear(exponent, x, out _, out _),
1839618397
Powf(var @base, var exponent) when !exponent.ContainsNode(x) && exponent is not Number.Integer
18397-
=> @base.Nodes.Any(node => node is Logf(_, var antilogarithm) && antilogarithm.ContainsNode(x)),
18398-
_ => false
18398+
&& @base.Nodes.Any(node => node is Logf(_, var antilogarithm) && antilogarithm.ContainsNode(x)) => true,
18399+
// A sine or a cosine of a sum in x that is not linear, in whatever holds it: x sin(a + b (c + d x)^3), and
18400+
// x (a + b sin(c + d (f + g x)^n))^2, which in u are powers of u beside the sine of a power of u, Euler's
18401+
// formula's exponentials. Rubi's 4.1.12.
18402+
_ => factor.Nodes.Any(node => node is Sinf or Cosf && node.DirectChildren.First() is var argument && argument.ContainsNode(x)
18403+
&& argument.Nodes.Any(inner => inner is Sumf or Minusf && inner.ContainsNode(x))
18404+
&& !TreeAnalyzer.TryGetPolyLinear(argument, x, out _, out _))
1839918405
};
1840018406

1840118407
/// <summary>

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,19 @@ public void APositiveRateIsTakenOutOfThePower()
126126

127127
/// <summary>
128128
/// A polynomial beside a symbolic power of a logarithm of one shifted linear, or an exponential of a power of one,
129-
/// written in <c>u = a + b x</c>, where each term is a gamma function. The constant in front comes along. Rubi's 3.3,
130-
/// 3.4 and 2.3.
129+
/// written in <c>u = a + b x</c>, where each term is a gamma function. The constant in front comes along. And beside
130+
/// a sine or a cosine of a power of one, which in u is Euler's formula's exponentials of a power of u. Rubi's 3.3,
131+
/// 3.4, 2.3 and 4.1.12.
131132
/// </summary>
132133
[Theory]
133134
[InlineData("2*x*(a + b*ln(c*(d + f*x)))^n")]
134135
[InlineData("x*(a + b*ln(c*(d + f*sqrt(x))))^n")]
135136
[InlineData("x^2*f^(c*(a + b*x)^3)")]
136137
[InlineData("(a + b*x)^2*e^(-c*(d + f*x)^3)")]
138+
[InlineData("(a + f*x)*sin(b + c*(d + f*x)^3)")]
139+
[InlineData("x*sin(a + b*(c + d*x)^n)")]
140+
[InlineData("x^2*cos(a + b/(c + d*x)^3)")]
141+
[InlineData("x*(a + b*sin(c + d*(f + x)^n))^2")]
137142
public void APolynomialBesideAFunctionOfAShiftedLinear(string integrand) => DifferentiatesBack(integrand);
138143

139144
/// <summary>

0 commit comments

Comments
 (0)