normal logarithm imaginary number problem

5 次查看(过去 30 天)
Hello,
i have a problem. If i want to calculate the normal logarithm with an exponent.
(log(0.5))^(1/1.55)
or
(-0.6931)^(1/1.55)
matlab results:
-0.3477 + 0.7087i
but I want an other result. If I write the equation on this way:
-0.6931^(1/1.55)
matlab results
-0.7894
Why is there a difference? The normal logarithm of 0.5 is -0.6931 and with an exponent of (1/1.55) my calculator show 0.7894 (not -0,7894 or -0.3477 + 0.7087i).
I need this (x=0.5)
(log(x))^(1/1.55)= 0.7894

采纳的回答

Stephen23
Stephen23 2015-2-17
编辑:Stephen23 2015-2-17
"Why is there a difference": because the order of operations is different. In particular, the ^ has a higher priority over the -, so the calculations are actually different. With the brackets these are all equivalent:
(log(0.5))^(1/1.55)
= (-0.6931)^(1/1.55)
= (-0.6931)^0.6452
= -0.3477 + 0.7087i
Whereas according to standard order of operations rules, without the brackets the following are equivalent:
-0.6931^(1/1.55)
= -(0.6931^(1/1.55))
= -(0.6931^0.6452)
= -(0.7894)
= -0.7894
This is correct and documented behavior.
If you want to get 0.7894, then you can simply take the absolute value:
>> abs(log(0.5))^(1/1.55)
ans = 0.7894
And if you need to keep the sign as well:
>> x = 0.5;
>> sign(log(x)) * abs(log(x))^(1/1.55)
ans = -0.7894

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Exponents and Logarithms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by