# Logs, complex numbers and arctan

Posted 10 years ago
6370 Views
|
5 Replies
|
2 Total Likes
|
 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?
5 Replies
Sort By:
Posted 10 years ago
 FullSimplify does the job. Thanks, Bill.
Posted 10 years ago
 In:= ComplexExpand[I (Log[a - I b] - Log[a + I b])]Out= -Arg[a - I b] + Arg[a + I b]In:= Arg[6 - I Exp[2 Pi]]Out= -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 10 years ago
 As I showed in my previous reply, the replacement you want is not always true. In:= {I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}/.{a->RandomReal[{-5,5}],b->RandomReal[{-5,5}]}  Out= {1.75155 + 0. I, 1.75155}  In:= {I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}/.{a->RandomReal[{-5,5}],b->RandomReal[{-5,5}]}  Out= {4.74474 + 0. I, -1.53844}  In:= {Arg[a + I b], ArcTan[b/a]} /. {a -> RandomReal[{-5, 5}], b -> RandomReal[{-5, 5}]}Out= {0.252736, 0.252736}In:= {Arg[a + I b], ArcTan[b/a]} /. {a -> RandomReal[{-5, 5}], b -> RandomReal[{-5, 5}]}Out= {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:= FullSimplify[{I(Log[a-I b]-Log[a+I b]), 2 ArcTan[b/a]}, a>0]Out= {2 ArcTan[b/a], 2 ArcTan[b/a]}And sometimes even that doesn't seem to be enough.In:= FullSimplify[{Arg[a + I b], ArcTan[b/a]}, a > 0 && b > 0]Out= {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 10 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 thatAssuming[{a, b} \ Reals, Arg[a + I b]]evaluates toArcTan[b/a] instead of simply repeatinga + I bOr, 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 10 years ago
 In:= FullSimplify[{I(Log[a-I b]-Log[a+I b]),2 ArcTan[b/a]}/.a-> -1/.b-> -1]Out= {-3*Pi/2, Pi/2}but if that is what you really wantIn:= I(Log[a-I b]-Log[a+I b])/.I(Log[a-I b]-Log[a+I b])->2 ArcTan[b/a]Out= 2*ArcTan[b/a]