expected output from log of negative number

Sergei Steshenko sergstesh at yahoo.com
Fri Jun 13 17:36:43 CDT 2008



Applications From Scratch: http://appsfromscratch.berlios.de/


--- On Fri, 6/13/08, E. Joshua Rigler <relgire at gmail.com> wrote:

> From: E. Joshua Rigler <relgire at gmail.com>
> Subject: expected output from log of negative number
> To: help-octave at octave.org
> Date: Friday, June 13, 2008, 11:40 AM
> If I type log10(-1), I get a complex number back whose real
> part is the 
> log of the absolute value of the argument, and whose
> imaginary part is 
> always equal to 1.36438.  What's more, I get similar
> behavior with a 
> natural log, but the imaginary part is always equal to Pi.
> 
> I've managed to confirm that this behavior is
> compatible with ML, so I 
> imagine it's not a bug, but can someone explain to me
> the logic here?
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www.cae.wisc.edu/mailman/listinfo/help-octave

Your verification method (comparing with another application) is wrong
in this case.

You should have verified the result according to log10 mathematical 
definition.

The definition is:

y is log10(x) if power(10, y) == x.

And you'll need to take into account definition of exponential function
of complex argument

There is a nice article on all that:

http://en.wikipedia.org/wiki/Exponential_function
.

Here is a number of hints for you:

"
octave:10> log10(-1)
ans =  0.00000 + 1.36438i
octave:11> power(10, log10(-1))
ans = -1.0000e+00 + 1.2246e-16i
octave:12> power(sin(abs(imag(log10(-1)))), 2) + power(cos(abs(imag(log10(-1)))), 2)
ans =  1.0000
octave:13> 

".


Regards,
  Sergei,



      


More information about the Help-octave mailing list