# Arg function very slow

In this thread Argument of complex number with a variable I asked the question how to get the phase of a complex expression with one single real and positive variable.

In principle this is solved but if I want to get the phase of a more complicated expression what takes forever and I have to abort the evaluation. For example:

T=-E^((0. - 1.33333*10^-10 I) omega) (1/3 E^((0. + 1.2*10^-10 I) omega) (4/3 E^((0. + 6.66667*10^-12 I) omega) - 1/3 E^((0. - 1.33333*10^-11 I) omega)) + 2/3 E^((0. + 6.*10^-11 I) omega) (2/3 E^((0. - 6.66667*10^-12 I) omega) -2/3 E^((0. + 1.33333*10^-11 I) omega))) + 2 E^((0. + 6.66667*10^-11 I) omega) (2/
3 E^((0. - 6.*10^-11 I) omega) (4/
3 E^((0. + 6.66667*10^-12 I) omega) -
1/3 E^((0. - 1.33333*10^-11 I) omega)) +
1/3 E^((0. - 1.2*10^-10 I) omega) (2/
3 E^((0. - 6.66667*10^-12 I) omega) -
2/3 E^((0. + 1.33333*10^-11 I) omega))) - ((2 E^((0. -
6.66667*10^-11 I) omega) (1/
3 E^((0. + 1.2*10^-10 I) omega) (4/
3 E^((0. + 6.66667*10^-12 I) omega) -
1/3 E^((0. - 1.33333*10^-11 I) omega)) +
2/3 E^((0. + 6.*10^-11 I) omega) (2/
3 E^((0. - 6.66667*10^-12 I) omega) -
2/3 E^((0. + 1.33333*10^-11 I) omega))) -
E^((0. + 1.33333*10^-10 I) omega) (2/
3 E^((0. - 6.*10^-11 I) omega) (4/
3 E^((0. + 6.66667*10^-12 I) omega) -
1/3 E^((0. - 1.33333*10^-11 I) omega)) +
1/3 E^((0. - 1.2*10^-10 I) omega) (2/
3 E^((0. - 6.66667*10^-12 I) omega) -
2/3 E^((0. + 1.33333*10^-11 I) omega)))) (-E^((0. -
1.33333*10^-10 I) omega) (1/
3 E^((0. + 1.2*10^-10 I) omega) (2/
3 E^((0. + 6.66667*10^-12 I) omega) -
2/3 E^((0. - 1.33333*10^-11 I) omega)) +
2/3 E^((0. + 6.*10^-11 I) omega) (4/
3 E^((0. - 6.66667*10^-12 I) omega) -
1/3 E^((0. + 1.33333*10^-11 I) omega))) +
2 E^((0. + 6.66667*10^-11 I) omega) (2/
3 E^((0. - 6.*10^-11 I) omega) (2/
3 E^((0. + 6.66667*10^-12 I) omega) -
2/3 E^((0. - 1.33333*10^-11 I) omega)) +
1/3 E^((0. - 1.2*10^-10 I) omega) (4/
3 E^((0. - 6.66667*10^-12 I) omega) -
1/3 E^((0. + 1.33333*10^-11 I) omega)))))/(2 E^((0. -
6.66667*10^-11 I) omega) (1/
3 E^((0. + 1.2*10^-10 I) omega) (2/
3 E^((0. + 6.66667*10^-12 I) omega) -
2/3 E^((0. - 1.33333*10^-11 I) omega)) +
2/3 E^((0. + 6.*10^-11 I) omega) (4/
3 E^((0. - 6.66667*10^-12 I) omega) -
1/3 E^((0. + 1.33333*10^-11 I) omega))) -
E^((0. + 1.33333*10^-10 I) omega) (2/
3 E^((0. - 6.*10^-11 I) omega) (2/
3 E^((0. + 6.66667*10^-12 I) omega) -
2/3 E^((0. - 1.33333*10^-11 I) omega)) +
1/3 E^((0. - 1.2*10^-10 I) omega) (4/
3 E^((0. - 6.66667*10^-12 I) omega) -
1/3 E^((0. + 1.33333*10^-11 I) omega))))


and doing something like

ArgT = FullSimplify[ComplexExpand[Arg[T], TargetFunctions -> {Re, Im}],omega \[Element] Reals && omega > 0];


will take more than 3 minutes on my machine. Can you recommencement me a quicker way? Basically this should be very straight forward and I don't know why this should take so much time? In the future my terms will be even larger so I need a solution.

Furthermore after the step which I described above I want to plot the derivative

D[ArgT, omega]


and this is only possible if I have an analytic expression...

• You should simplify your expression as much as you can. Try FullSimplify[T] // ExpToTrig // Chop // ComplexExpand[Arg[#], TargetFunctions -> {Re, Im}] & // Chop // Simplify. I have noted that your result has very small numbers, and is almost constant. I do not know if this what you are expecting. Oh, the operation is fast in my machine (i3, macOS 10.13.1, MMA 11.2). Commented Dec 1, 2017 at 18:58
• I mean it depends on how large omega is... You mean without the simplifications the computation is fast? Commented Dec 1, 2017 at 19:26
• I mean (and I am assuming) that omega must be quite large. And, yes, it is fast after a first simplification, as you can see in the order of the functions applied... Commented Dec 1, 2017 at 19:28

For the sake of an answer to an old question:

(1) FullSimplify works extra hard, and sometimes extra long. With elementary functions, Simplify usually works hard enough and is faster.

(2) One should look at T // Together: It's a lot simpler already.

argT = Simplify[
ComplexExpand[Arg@Together@T, TargetFunctions -> {Re, Im}],
omega \[Element] Reals && omega > 0] /.
z_Complex /; Im[z] == 0 :> Re[z]; // AbsoluteTiming
(*  {0.295009, Null}  *)

(* probably not necessary, but fast: *)
argT = TrigReduce /@ argT // Simplify