# Issue when simplifying an expression containing Arg

Recently I got a shocking discovery while working on "skyrmions". I am using Mathematica to help me in calculations. The calculation involves only derivatives, but different evaluations give different results, which are totally astonishing.

Here is the work.

1. define a "skyrmion" with the "CP1 field" Z[x,y]:

Z = {λ/Sqrt[(x^2 + y^2)^n + λ^2], (x + I y)^n/Sqrt[(x^2 + y^2)^n + λ^2]};

2. compute the magnetization by the formula $\boldsymbol{m} = Z^{\dagger}.\boldsymbol{\sigma}_i.Z$

m0 = (Conjugate[Z].PauliMatrix[#].Z) & /@ {1, 2, 3} // ComplexExpand;
m = Simplify[m0, Assumptions -> x ∈ Reals && y ∈ Reals && λ ∈ Reals && n ∈ Integers]


which gives $\left\{\frac{2 \lambda \left(x^2+y^2\right)^{n/2} \cos (n \arg (x+i y))}{\lambda ^2+\left(x^2+y^2\right)^n},\frac{2 \lambda \left(x^2+y^2\right)^{n/2} \sin (n \arg (x+i y))}{\lambda ^2+\left(x^2+y^2\right)^n},\frac{\lambda ^2-\left(x^2+y^2\right)^n}{\lambda ^2+\left(x^2+y^2\right)^n}\right\}$

3. Calculate $(\partial_x \boldsymbol{m})^2 + (\partial_y \boldsymbol{m})^2$

Simplify[Sum[D[m[[ii]], x]^2 + D[m[[ii]], y]^2, {ii, 1, 3}] // ComplexExpand,
Assumptions ->
x ∈ Reals && y ∈ Reals && λ ∈ Reals && n ∈ Integers]


which gives $\frac{4 \lambda ^2 n^2 \left(x^2+y^2\right)^{n-1}}{\left(\lambda ^2+\left(x^2+y^2\right)^n\right)^2}$ on my computer (Mathematica 11 on both Linux and Windows).

This is bizarre because I know the correct answer should be TWICE the result.

So I tried to simplify the expression of m manually and replaced the code in step 2 by

m = {(2 (x^2 + y^2)^(n/2) λ Cos[n ArcTan[x, y]])/((x^2 + y^2)^n + λ^2),
(2 (x^2 + y^2)^(n/2) λ Sin[
n ArcTan[x, y]])/((x^2 + y^2)^n + λ^2),
(-(x^2 + y^2)^n + λ^2)/((x^2 + y^2)^n + λ^2)};


where I've replaced Arg[x+ Iy] by ArcTan[x, y], which should be equivalent.

However, after this, reevaluating step 3 gives $\frac{8 \lambda ^2 n^2 \left(x^2+y^2\right)^{n-1}}{\left(\lambda ^2+\left(x^2+y^2\right)^n\right)^2}$

It is a critical moment for me because, if I am not to resolve this issue, I will give up using Mathematica, which I really don't want to.

Can anyone help me? Where is the problem? Anyone has similar problems before?

• I think I should ask "how to prevent Simplify[] from giving wrong results based on nonsense intermediate results such as Arg'[] (the derivative of Arg[])" Jul 7 '17 at 10:25

I think this is because Mathematica doesn't have rules for differentiation of Arg objects:

D[Arg[x+I y], x]


Derivative[Arg][x + I y]

Use ArcTan instead of Arg:

D[ArcTan[x, y], x]


-(y/(x^2 + y^2))

• Yes! That is why I replaced the Arg[] in the result and used ArcTan. But what's chilling is, with the meaningless Arg'[] (derivative of Arg which is not defined) as intermediate result in step3, there is still an output. If I didn't know the correct answer, I may have believed that the naive Simplify[...] gives the answer! My worry is, how to prevent this from invalidating bigger calculations, which are in my next steps ... Jul 5 '17 at 20:02