Message Boards Message Boards

0
|
6978 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Logs, complex numbers and arctan

Posted 11 years ago
I can't seem to find a way for Mathematica to simplify

 i (Log[a-ib] - Log[a + ib])

to

 2 ArcTan[b/a]

Is there a way to force this?
POSTED BY: mike
5 Replies
Posted 11 years ago
As I showed in my previous reply, the replacement you want is not always true.
 In[1]:= {I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}/.{a->RandomReal[{-5,5}],b->RandomReal[{-5,5}]}
 
 Out[1]= {1.75155 + 0. I, 1.75155}
 
 In[2]:= {I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}/.{a->RandomReal[{-5,5}],b->RandomReal[{-5,5}]}
 
 Out[2]= {4.74474 + 0. I, -1.53844}
 
 In[3]:= {Arg[a + I b], ArcTan[b/a]} /. {a -> RandomReal[{-5, 5}], b -> RandomReal[{-5, 5}]}

Out[3]= {0.252736, 0.252736}

In[4]:= {Arg[a + I b], ArcTan[b/a]} /. {a -> RandomReal[{-5, 5}], b -> RandomReal[{-5, 5}]}

Out[4]= {2.37972, -0.761869}
It is common to think that some pairs of expressions are the same, just as long as you ignore all the special cases where they are not. Mathematica is not going to "simplify" something to be something else if those two are not equal for all values of the variables.

Now if you want to add more and more restrictions to your variables it is sometimes possible to get the result that you want.
In[5]:= FullSimplify[{I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}, a>0]

Out[5]= {2 ArcTan[b/a], 2 ArcTan[b/a]}
And sometimes even that doesn't seem to be enough.
In[6]:= FullSimplify[{Arg[a + I b], ArcTan[b/a]}, a > 0 && b > 0]

Out[6]= {Arg[a + I b], ArcTan[b/a]}
Perhaps I just haven't thought of all the restrictions for your two to be equal, but sometimes it seems that nothing is sufficient.

Mathematica often uses LeafCount to estimate the complexity of a result and transformations often try to minimize that count. If you want a result in a certain form and the count is greater than another form then you are typically facing a very difficult challenge to beat Mathematica senseless and make it give you the form you want. You can redefine how LeafCount is calculated and this can sometimes enable you to get a result in the form that you desire. But usually it is a challenge to figure out how to change LeafCount.
POSTED BY: Bill Simpson
In[9]:= ComplexExpand[I (Log[a - I b] - Log[a + I b])]
Out[9]= -Arg[a - I b] + Arg[a + I b]

In[27]:= Arg[6 - I Exp[2 Pi]]
Out[27]= -ArcTan[E^(2 \[Pi])/6]
does the trick. ComplexExpand[] presumes a and b to be real, which is normally the case if one writes a + I b.
POSTED BY: Udo Krause
Posted 11 years ago
In[1]:= FullSimplify[{I(Log[a-I b]-Log[a+I b]),2 ArcTan[b/a]}/.a-> -1/.b-> -1]

Out[1]= {-3*Pi/2, Pi/2}
but if that is what you really want
In[2]:= I(Log[a-I b]-Log[a+I b])/.I(Log[a-I b]-Log[a+I b])->2 ArcTan[b/a]

Out[2]= 2*ArcTan[b/a]
POSTED BY: Bill Simpson
Posted 11 years ago
Ok, I see how to use replace all. But that requires me to know the equivalence. I would also like to see a symbolic manipulation in Mathematica that will tell me that 

 i (Log[a-ib] - Log[a + ib])

simplifies to

 2 ArcTan[b/a]

without my having to know that!

As another example, how do I make Mathematica tell me that

Assuming[{a, b} \ Reals, Arg[a + I b]]

evaluates to

ArcTan[b/a]

instead of simply repeating

a + I b

Or, to put it even more simply, how can I ask Mathematica to always represent a complex number in the form r e^(I theta)  (and perfrom algebraic manipulations on that form) rather than a + I b
POSTED BY: mike
Posted 11 years ago
FullSimplify does the job. Thanks, Bill.
POSTED BY: mike
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