Function Repository Resource:

PowerAffineExpand

Source Notebook

Compute branch-correct expansions of power for univariate polynomials and rational functions with real coefficients

Contributed by: Jayanta Phadikar

ResourceFunction["PowerAffineExpand"][p, n, x]

expands p^n for the real-valued rational function p in x as a sum of powers of affine factors.

Details

ResourceFunction["PowerAffineExpand"] gives results that are always correct under the assumption that the argument x is real-valued.
The argument p need not have a denominator, that is, it can be a univariate polynomial.
An affine factor is a degree-one polynomial of the form ax+b with a!=0. In this function, we use the normalized affine form 1+αx.
An affine power expansion is a representation of power of a polynomial or rational function that replaces the original expression by a constant times a product of powers of normalized affine factors, together with a piecewise integer multiple of 2π ⅈ so that the result coincides exactly with the principal branch value of the original expression on the real line.
The coefficients must be real-valued and numeric. Inputs with complex or symbolic coefficients are left unevaluated.
The correctness of the expansion using PowerAffineExpand is guaranteed for real x only, where branch jumps occur only when real affine factors become negative. For complex x, the current implementation may miss 2π ⅈ adjustments when non-real affine factors map x onto the negative real axis; in such cases the result can differ from Power[expr, n] by integer multiples of 2π ⅈ.
ResourceFunction["PowerAffineExpand"][Power[p,n],x] is equivalent to PowerAffineExpand[p, n, x]. This convenience form exists for pipeline symmetry with PowerExpand and ResourceFunction["LogAffineExpand"].

Examples

Basic Examples (3) 

Expand a simple quadratic polynomial:

In[1]:=
ResourceFunction["PowerAffineExpand"][(1 - x^2), 1/2, x]
Out[1]=

Expand a simple rational function:

In[2]:=
ResourceFunction["PowerAffineExpand"][((1 - x)/(1 + x)), 1/3, x]
Out[2]=

Use the equivalent two arguments form:

In[3]:=
ResourceFunction["PowerAffineExpand"][((1 - x)/(1 + x))^(1/3), x]
Out[3]=

Scope (5) 

Complex-conjugate factorization of a real quadratic:

In[4]:=
res = ResourceFunction["PowerAffineExpand"][(x^2 + x + 1), 3/4, x]
Out[4]=

Verify that the expansion correctly represents the original function in the real line:

In[5]:=
Chop@N@Table[(x^2 + x + 1)^(3/4) - res, {x, -100, 100}]
Out[5]=

Branch-corrected expansion near a real root:

In[6]:=
ResourceFunction["PowerAffineExpand"][((x - 2)^2), 1/3, x]
Out[6]=

On the principal branch, when x>2 the factor 1-x/2 is negative real. PowerAffineExpand automatically inserts a compensating piecewise constant term -2π ⅈ/3 so the result is exactly equal to the original input on the principal branch. A similar branch correction for a simple rational function:

In[7]:=
ResourceFunction["PowerAffineExpand"][(1/x), 1/3, x]
Out[7]=

For a rational input, the expansion keeps the numerator's affine factors in the numerator and the denominator's as inverse powers, with necessary piecewise branch/sign corrections:

In[8]:=
res = ResourceFunction["PowerAffineExpand"][((x^2 - 1)/(x^2)), 1/2, x]
Out[8]=

Verify that the result is correct:

In[9]:=
Plot[Chop[((x^2 - 1)/(x^2))^(1/2) - res], {x, -100, 100}]
Out[9]=

Root objects may appear in the result:

In[10]:=
ResourceFunction["PowerAffineExpand"][(x^3 - 3 x + 10), 1/2, x]
Out[10]=

Use ToRadicals to express using radicals:

In[11]:=
ResourceFunction["PowerAffineExpand"][(x^3 - 3 x + 10), 1/2, x] // ToRadicals
Out[11]=

Root objects in the expansion of a rational function:

In[12]:=
ResourceFunction["PowerAffineExpand"][((x^6 - 3 x + 10)/(x - 2)), 1/2,
  x]
Out[12]=

Properties and Relations (3) 

PowerExpand applies identities like Power(a b, n)=Power(a, n)*Power(b, n) under generic assumptions and without managing branches, so it may stop at non-affine factors and either omit necessary 2π ⅈ corrections or emit complex corrections:

In[13]:=
PowerExpand[(x (x^2 - 1))^(1/2)]
Out[13]=
In[14]:=
PowerExpand[(x (x^2 - 1))^(1/2), Assumptions -> Element[x, Reals]]
Out[14]=

PowerAffineExpand always expands into affine factors and simplified 2π ⅈ corrections:

In[15]:=
ResourceFunction["PowerAffineExpand"][(x (x^2 - 1)), 1/2, x]
Out[15]=

Similarly for rational expressions:

In[16]:=
PowerExpand[((x^2 - 1)/(x^4 + x^3 - 10))^(1/2)]
Out[16]=
In[17]:=
PowerExpand[((x^2 - 1)/(x^4 + x^3 - 10))^(1/2), Assumptions -> True]
Out[17]=
In[18]:=
ResourceFunction["PowerAffineExpand"][((x^2 - 1)/(x^4 + x^3 - 10)), 1/2, x]
Out[18]=

Possible Issues (2) 

For PowerAffineExpand to work all constants appearing in the expression should be real and numeric. It won't work for symbolic or complex parameters:

In[19]:=
ResourceFunction["PowerAffineExpand"][(k x^2 - 1), 1/2, x]
Out[19]=
In[20]:=
ResourceFunction["PowerAffineExpand"][(I x^2 - 1), 1/2, x]
Out[20]=

PowerAffineExpand gives an expansion which is guaranteed to be correct for real x only, and may not be valid for complex x:

In[21]:=
(1 + 2 x + 2 x^2)^(1/2) /. x -> -1 + I // N
Out[21]=
In[22]:=
ResourceFunction["PowerAffineExpand"][(1 + 2 x + 2 x^2), 1/2, x] /. x -> -1 + I // N
Out[22]=

Neat Examples (4) 

Expansion of a high degree polynomial:

In[23]:=
ResourceFunction["PowerAffineExpand"][(x^8 - 8 x^3 + 2 x^2 + 5 x - 1),
  1/2, x]
Out[23]=

Build a polynomial with six factors. PowerAffineExpand reduces its power to an expression with one affine power per factor, inserting a piecewise 2π ⅈ term for principal-branch correctness:

In[24]:=
ResourceFunction[
 "PowerAffineExpand"][(Times @@ Table[1 - x/k, {k, 1, 6}]), 1/2, x]
Out[24]=

For real quadratics with negative discriminant, the bases of the two affine-power terms are complex conjugates. Their imaginary parts cancel for real x, so the result is purely real with no branch correction needed:

In[25]:=
ResourceFunction["PowerAffineExpand"][(x^2 + 2 x + 2), 1/3, x]
Out[25]=

On rationals like (x^2-1)/(x-1)=1+x, the expansion cancels the common factor and reduces to (up to the usual constant/branch bookkeeping):

In[26]:=
ResourceFunction["PowerAffineExpand"][((x^2 - 1)/(x - 1)), 1/2, x]
Out[26]=

Publisher

Jayanta Kumar Phadikar

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 10 October 2025

Related Resources

License Information