5
$\begingroup$

Can Mathematica evaluate Arg[1+ I a] when a is a positive real in order to get ArcTan[a]?

For example (this is much simpler than the code I'm working with):

ComplexExpand[Im[1/Sqrt[1 + I a]]]

outputs

-(Sin[1/2 Arg[1 + I a]]/(1 + a^2)^(1/4)).

This is a calculation in the middle of my code, and I'm too lazy to replace Arg[1+ i a] for ArcTan[a] manually every time the code is run. Moreover, in the following lines of that code I would like to have only real variables in order to use the function Simplify instead of ComplexExpand, otherwise I get

ComplexExpand[ArcTan[a/b]]
-(1/2) Arg[1 - (I a)/b] + 1/2 Arg[1 + (I a)/b].

Note that

Simplify[-(Sin[1/2 Arg[1 + I a]]/(1 + a^2)^(1/4)), a ∈ Reals]

doesn't do anything.

$\endgroup$
  • 1
    $\begingroup$ Does this simple replacement do what you want? If not, why? Arg[1 + I a] /. Arg[1 + I*x_] :> ArcTan[x] $\endgroup$ – Mr.Wizard Feb 27 '15 at 8:10
  • $\begingroup$ Yes! It does, as well as Arg[1 + I a] /. Arg -> arg, where 'arg' is given below. Thanks! $\endgroup$ – Rol Feb 27 '15 at 9:49
2
$\begingroup$

It seems that a direct replacement (using ReplaceAll and RuleDelayed) may be adequate:

Arg[1 + I a] /. Arg[1 + I*x_] :> ArcTan[x]
ArcTan[a]
$\endgroup$
1
$\begingroup$

Someone else posted a working answer yesterday, which is gone today; maybe it was deleted by the author for some reason. The solution was to define a function

arg[num_] := ArcTan[ComplexExpand[Im[num]]/ComplexExpand[Re[num]]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.