help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie] unexpected behaviour for x^x


From: fbarbuto
Subject: Re: [newbie] unexpected behaviour for x^x
Date: Fri, 12 Dec 2014 05:08:18 -0800 (PST)

Your question, and some answers you've got, baffled me in many ways.

Mathematically speaking, -0.001^-0.001 (or -0.001^(-0.001) thereof)  should
not be compared to 0.001^0.001, because while the latter is a real number,
the former operation yields a /complex/ number.  That is easy to see if you
apply logs to both expressions, because since y = x^c (suppose "x" and "c"
as real numbers), log10(y) = c*log10(x) and thence "y" is also y =
10**(c*log10(x)).  Thus,

log10(0.001^0.001) = 0.001*log10(0.001) = 0.001*(-3) = -0.003  ===> Real
number

whereas

log10(-0.001^-0.001) = -0.001*log(-0.001) ===> Complex number, as the log of
a negative number does not exist in the realm of the Reals.

Therefore your comparison makes no much sense at all.

>From Octave's standpoint I got some surprising results.  Whereas
-0.001^(-0.001) does indeed yield -1.0069, the same does not happen when you
create a variable x = -0.001 and perform x^x, as someone cleverly suggested:

>> -0.001^-0.001
ans = -1.00693166885180

>> x = -0.001
x = -0.00100000000000000
>> x^x
ans =  1.00692669984727590 - 0.00316336393000065i

Which is the result I would have expected to see (a complex number). 
Because:





--
View this message in context: 
http://octave.1599824.n4.nabble.com/newbie-unexpected-behaviour-for-x-x-tp4667762p4667769.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]