Message Boards Message Boards

A complex number, Replace, Simplifiy, Refine ....

Posted 9 years ago

Hello Dear Friends,

I have a problem in Mathematica and I need your help please. As you know, If the complex number z=x+I y is located at the first quarter of the plane, I mean when (x>0 & y>0) then, the argument of thiscomplex number is : Arg[x+I y]= ArcTan[y/x]. In similar way, If (x>0 & y<0) then: Arg[x+I y]=\pi-ArcTan[y/x].

My question is:For instant, How can I enforce MATHEMATICA to replace Arg[x+I y] by ArcTan[y/x] when (x>0& y>0).

I am looking forward to receive your comments.

Best wishes

         Ahmad Alali
POSTED BY: Ahmad Alali
5 Replies

By default $x,y\in \mathbb{C}$ in Mathematica; therefore one has to shelter with

In[22]:= Last[ToPolarCoordinates[ReIm[x + I y]] /. {Im[x] -> 0, Im[y] -> 0, Re[x] -> x, Re[y] -> y}]
Out[22]= ArcTan[x, y]

if you do not fear the ugliness just type

In[24]:= Last[ToPolarCoordinates[ReIm[Re[x] + I Re[y]]]]
Out[24]= ArcTan[Re[x], Re[y]]

because still

In[27]:= Arg[Re[x] + I Re[y]]
Out[27]= Arg[Re[x] + I Re[y]]
POSTED BY: Udo Krause

For Mathematica Arg[x+I y] and ArcTan[x,y] are not exacly the same, apparently: Arg[0]==0, while ArcTan[0,0]==Indeterminate.

POSTED BY: Gianluca Gorni
Posted 9 years ago

Yes. That is a good point, Gianluca. It perhaps explains the whole issue. Since both x and y could be zero, any symbolic return for Arg, even in Reals, would have to include a conditional.

POSTED BY: David Keith
Posted 9 years ago

Interesting . . .

In[1]:= (* this is expected *)
Arg[2 + 3 I]

Out[1]= ArcTan[3/2]

In[2]:= (* Mathematica allows for x or y to be complex, so it returns \
unevaluated *)
Arg[x + y I]

Out[2]= Arg[x + I y]

In[3]:= (* but I thought this would return ArcTan[x,y], but it does \
not *)
Refine[Arg[x + y I], {x, y} \[Element] Reals]

Out[3]= Arg[x + I y]
POSTED BY: David Keith

For numerical z it does already:

Arg[2 + 3 I]

In what kind of formulas you need the replacement?

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract