# Can't Simplify an expression with lot of Arg($N$) with $N$ is a real number

I'm struggling to simplify this expression.

Assuming[
t > 0 && Element[N1, PositiveIntegers] &&
Element[N2, PositiveIntegers],
ComplexExpand[
Abs[-((E^(-I N2 t) (N2 - N1 N2))/(N1 N2)) - (
2 E^(1/2 I (-Sqrt[N1] - N2 + Sqrt[
N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(-N1 +
2 Sqrt[N1] N2 - 4 N1 N2 - N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) + (
2 E^(1/2 I (-Sqrt[N1] - N2 - Sqrt[
N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(
N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2])]^2]]


where N1 and N2 are natural numbers, and t is positive real. After I ComplexExpand, I obtain a very long expression: where (if i show all) I see lots of Arg(...), so Arguments of real numbers (which is 0, but Mathematica seems to not know).

If the expression was shorter, I could get rid of all with FullSimplify, but if I do it, Mathematica keeps evaluating for ages without giving me a result.

QUESTION: How to tell Mathematica to set all this Arg(...) to 0, so I can FullSimplify faster?

NOTE: I'm 100% sure that all numbers in Arg() are REAL.

You raised an important problem (I also face with it quite often.). The following

 Assuming[t > 0 && Element[N1, PositiveIntegers] &&  Element[N2, PositiveIntegers],
ComplexExpand[ Abs[-((E^(-I N2 t) (N2 - N1 N2))/(N1 N2)) - (
2 E^(1/2 I (-Sqrt[N1] - N2 + Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(-N1 +  2 Sqrt[N1] N2 - 4 N1 N2 - N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) + (
2 E^(1/2 I (-Sqrt[N1] - N2 - Sqrt[  N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(
N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2])]^2]]/.{Arg[N1] -> 0, Arg[N1 - 2 Sqrt[N1]*N2 + 4 N1*N2 + N2^2] -> 0}


works well, cancelling all Args and shortening the output from 8 MB to 0.7 MB. I'd like to notice that Arg[-1]!=0 as well as other negative numbers.

• Thank you! You solved my problem Dec 5, 2022 at 13:54
• Or since the OP knows that all arguments are zero, just {Arg[_] -> 0} Dec 5, 2022 at 14:37
• The argument of the OP " Arguments of real numbers (which is 0, but Mathematica seems to not know" is not correct. I'd like to notice that Arg[-1]!=0 as well as of other negative numbers one more time. We have to ground it by Resolve[ForAll[{N1, N2}, {N1, N2} \[Element] PositiveIntegers, N1 - 2 Sqrt[N1]*N2 + 4 N1*N2 + N2^2 >= 0]] which results in True. This verification is valid for real {N1,N2}>1 too. Dec 5, 2022 at 18:01

With

stuff= -((E^(-I N2 t) (N2 - N1 N2))/(N1 N2)) - (2 E^(1/
2 I (-Sqrt[N1] - N2 +
Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(-N1 +
2 Sqrt[N1] N2 - 4 N1 N2 - N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 +
N2^2]) + (2 E^(1/
2 I (-Sqrt[N1] - N2 -
Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]) t) N2)/(N1 -
2 Sqrt[N1] N2 + 4 N1 N2 + N2^2 +
Sqrt[N1] Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2] -
N2 Sqrt[N1 - 2 Sqrt[N1] N2 + 4 N1 N2 + N2^2]);


The following takes about 7 seconds

Simplify[TrigToExp[Abs[ComplexExpand[stuff]]^2],
t > 0 && N1 \[Element] PositiveIntegers && N2 \[Element] PositiveIntegers]


And returns a comparitivly compact: (*Abs[-2*(1 + E^(I*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2]*t) - 2*E^((I/2)*(Sqrt[N1] - N2 + Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2])*t))*Sqrt[N1]*
N2 - 4*E^((I/2)*(Sqrt[N1] - N2 + Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2])*t)*N1^(3/2)*N2 +
(1 + E^(I*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2]*t) - 2*E^((I/2)*(Sqrt[N1] - N2 + Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2])*t))*N2^2 +
2*E^((I/2)*(Sqrt[N1] - N2 + Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2])*t)*N1^2*(1 + 4*N2) -
(-1 + E^(I*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2]*t))*N2*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2] +
(-1 + E^(I*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2]*t))*Sqrt[N1*(N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2)] +
N1*(1 + 4*N2 + E^(I*Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2]*t)*(1 + 4*N2) +
2*E^((I/2)*(Sqrt[N1] - N2 + Sqrt[N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2])*t)*(-1 - 4*N2 + N2^2))]^2/(4*N1^2*(N1 - 2*Sqrt[N1]*N2 + 4*N1*N2 + N2^2)^2)*)