Skip to content

Commit 221d3c5

Browse files
A power of a monomial in a symbolic power of x is integrated as the power of x it is (#1789)
(c x^n)^b is written c^b x^(n b), and the exponent n b was left as the inner simplification leaves it: (c x^n)^(2/n) came out as c^(2/n) x^(n (2/n)), which no rule reads as x^2, and 1/(a + b (c x^n)^(2/n)) was declined where 1/(a + b c^(2/n) x^2) is answered. The exponent is simplified now. 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 404a98a commit 221d3c5

3 files changed

Lines changed: 69 additions & 1 deletion

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,19 @@ polynomial exponent in `u` now, and the question asked in `u`. Rubi's 2.3
479479
| `"F^(a + b/(c + d*x))/(c + d*x)".ToEntity().Integrate("x")` | `integral(...)` | an exponential integral |
480480
| `"F^(a + b/(c + d*x)^3)*(c + d*x)^2".ToEntity().Integrate("x")` | `integral(...)` | an exponential integral of the cube, and the exponential |
481481

482+
### A power of a monomial in a symbolic power of `x` is integrated as the power of `x` it is
483+
484+
**Answers where there were none.** `(c x^n)^b` is written `c^b x^(n b)`, and the exponent `n b` was
485+
left as the inner simplification leaves it: `(c x^n)^(2/n)` came out as `c^(2/n) x^(n (2/n))`, which
486+
no rule reads as `x^2`, and `1/(a + b (c x^n)^(2/n))` was declined where `1/(a + b c^(2/n) x^2)` is
487+
answered. The exponent is simplified now. Rubi's 1.1.3.2
488+
([#718](https://github.com/asc-community/AngouriMath/issues/718)).
489+
490+
| Input | Was (2.5.0) | Now |
491+
|---|---|---|
492+
| `"1/(a + b*(c*x^n)^(2/n))".ToEntity().Integrate("x")` | `integral(...)` | an arctangent or a logarithm in `b c^(2/n) x`, by the sign of `a b c^(2/n)` |
493+
| `"1/(1 + 4*(x^(2*n))^(1/n))".ToEntity().Integrate("x")` | `integral(...)` | `arctan(2 x)/2` |
494+
482495
### A function of a quotient of two linears is integrated over the quotient's denominator
483496

484497
**Answers where there were none.** `sin((a + b x)/(c + d x))` and its powers were declined, and so

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25772,7 +25772,11 @@ Entity Rewritten(Entity side, Number.Integer sign)
2577225772
assumed = assumed == Entity.Boolean.True ? positive : assumed & positive;
2577325773
}
2577425774
changed = true;
25775-
var distributed = split ? MathS.Pow(x, (degree! * exponent).InnerSimplified) : MathS.Pow(rest, exponent);
25775+
// The exponent of x as it simplifies: `(c x^n)^(2/n)` is `c^(2/n) x^(n (2/n))`, and that
25776+
// power of x is `x^2` only once `n (2/n)` is folded, which the inner simplification
25777+
// leaves standing -- `1/(a + b (c x^n)^(2/n))` was declined where `1/(a + b c^(2/n) x^2)`
25778+
// is answered. Exponents are small.
25779+
var distributed = split ? MathS.Pow(x, SimplifiedExponent((degree! * exponent).InnerSimplified)) : MathS.Pow(rest, exponent);
2577625780
return constant == Number.Integer.One ? distributed : MathS.Pow(constant, exponent) * distributed;
2577725781
});
2577825782
if (!changed)
@@ -25788,6 +25792,9 @@ Entity Rewritten(Entity side, Number.Integer sign)
2578825792
if (Integration.ComputeAsTheSameQuestion(rewritten, x, integrateByParts) is not { } answer)
2578925793
return null;
2579025794
return assumed == Entity.Boolean.True ? answer : answer.Provided(assumed);
25795+
25796+
static Entity SimplifiedExponent(Entity exponent)
25797+
=> exponent is Number || exponent.Complexity > 40 ? exponent : Functions.PartialFractions.Bare(exponent.Simplify());
2579125798
}
2579225799

2579325800
/// <summary>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// Copyright (c) 2019-2026 Angouri.
3+
// AngouriMath is licensed under MIT.
4+
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
5+
// Website: https://am.angouri.org.
6+
//
7+
8+
using System;
9+
using AngouriMath.Extensions;
10+
using Xunit;
11+
12+
namespace AngouriMath.Tests.Calculus
13+
{
14+
/// <summary>
15+
/// A power of a monomial in a symbolic power of x, distributed with its exponent of x
16+
/// simplified: <c>(c x^n)^(2/n)</c> is <c>c^(2/n) x^2</c>. Rubi's 1.1.3.2.
17+
/// <a href="https://github.com/asc-community/AngouriMath/issues/718">#718</a>
18+
/// </summary>
19+
/// <remarks>
20+
/// Checked by differentiating back with <c>a = 1.3</c>, <c>b = 0.7</c>, <c>c = 0.4</c> and
21+
/// <c>n = 1.7</c>, at positive x, where a symbolic power of it is real.
22+
/// </remarks>
23+
[Trait("Area", "Calculus")]
24+
public sealed class DistributedPowerOfAMonomialIntegralTest
25+
{
26+
[Theory]
27+
[InlineData("1/(a + b*(c*x^n)^(2/n))")]
28+
[InlineData("1/(x^2*(a + b*(c*x^n)^(1/n)))")]
29+
[InlineData("1/(a + b*(c*x^n)^(3/n))")]
30+
[InlineData("1/(1 + 4*(x^(2*n))^(1/n))")]
31+
public void IsIntegrated(string integrand)
32+
{
33+
var integral = integrand.ToEntity().Integrate("x");
34+
Assert.DoesNotContain("integral(", integral.Stringize());
35+
Entity Pinned(Entity e) => e.Substitute("a", 1.3).Substitute("b", 0.7).Substitute("c", 0.4).Substitute("n", 1.7);
36+
var derivative = Pinned(integral.Substitute("C", 0)).Differentiate("x");
37+
var original = Pinned(integrand.ToEntity());
38+
foreach (var at in new[] { 0.3, 0.8, 1.4, 2.1 })
39+
{
40+
var want = original.Substitute("x", at).EvalNumerical();
41+
var got = derivative.Substitute("x", at).EvalNumerical();
42+
Assert.True(Math.Abs((double)(got - want).RealPart) + Math.Abs((double)(got - want).ImaginaryPart)
43+
< 1e-9 * Math.Max(1, Math.Abs((double)want.RealPart) + Math.Abs((double)want.ImaginaryPart)),
44+
$"d/dx of the antiderivative of {integrand} is {got} at x = {at}, where the integrand is {want}");
45+
}
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)