[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expected output from log of negative number
From: |
Sergei Steshenko |
Subject: |
Re: expected output from log of negative number |
Date: |
Fri, 13 Jun 2008 15:36:43 -0700 (PDT) |
Applications From Scratch: http://appsfromscratch.berlios.de/
--- On Fri, 6/13/08, E. Joshua Rigler <address@hidden> wrote:
> From: E. Joshua Rigler <address@hidden>
> Subject: expected output from log of negative number
> To: address@hidden
> 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
> address@hidden
> 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,