Basic Examples (2)
Expand a simple quadratic polynomial:
Expand a simple rational function:
Scope (5)
Complex-conjugate factorization of a real quadratic:
Verify that the expansion correctly represents the original function in the real line:
Branch-corrected expansion near a real root:
On the principal branch, when x>2 the factor 1-x/2 is negative real, each Arg contributes π. ArgAffineExpand automatically inserts a compensating piecewise constant term 2π so the result is exactly equal to the original input on the principal branch. A similar branch correction for a simple rational function:
Expansion for a rational input - zeros minus poles, with sign and branch corrections:
Verify that the result is correct:
Root objects may appear in the result:
Use ToRadicals to express using radicals (may not work always):
Root objects in the expansion of a rational function:
Properties and Relations (3)
PowerExpand applies identities like Arg(ab)=Arg(a)+Arg(b) 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:
ArgAffineExpand always expands into affine factors and simplified 2π corrections:
Similarly for rational expressions:
Possible Issues (2)
For ArgAffineExpand to work, all constants appearing in the expression should be real and numeric. It won't work for symbolic or complex parameters:
ArgAffineExpand gives an expansion which is guaranteed to be correct for real x only. It may not be valid for complex x:
Neat Examples (5)
Expansion of a high degree polynomial:
Build a polynomial as six factors:
ArgAffineExpand reduces its Arg to a constant plus one affine Arg per factor, inserting a piecewise 2π term for principal-branch correctness:
For a polynomial with repeated roots, the multiplicities reflect in the coefficients of the affine-Arg factors:
For real quadratics with negative discriminant, the two affine-Arg terms are complex conjugates. Their imaginary parts cancel for real x, so the result is purely real with no branch correction needed:
On rationals like (x^2-1)/(x-1)=1+x, the expansion cancels the common factor and reduces to Arg[1+x] (up to the usual constant/branch bookkeeping):