2 Answers
2

The question asks for a "cleanest way." Arguably, any solution that reduces the calculation to various cases is not very clean, and is probably inefficient too. These considerations suggest a simple, direct approach:

log0[x_] := -Log[1/x]

Checking a few cases (or a plot) easily confirms that log0 does what is intended with negative real numbers; e.g.,

log0[-3.2]

1.16315 - 3.14159 I

Moreover, it does not change the behavior for any other complex numbers, as a contour plot of its imaginary part demonstrates:

I never did this before (i.e. modify system function), but I just tried it, and it seems to work. But I just wanted to first say, that Log[z] as it works in Mathematica is the correct way. i.e. Log[z]=Log[Abs[z]]+k where k=0 when z>0 and k=I*Pi when z<0 so what you are asking to do is not the correct math way. But this is what I tried to change the definition

"What you are asking to do is not the correct math way." They're just taking a slightly different branch cut from the usual one; it's hardly incorrect. There can be more than one right way in mathematics! :)
–
RahulDec 26 '12 at 11:46

@NasserM.Abbasi Negative and Positive were introduced in version 1, when such conventions were probably not codified. At this point, it is probably left that way for backwards compatibility.
–
rm -rf♦Dec 26 '12 at 20:34

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.