normal logarithm imaginary number problem
3 次查看(过去 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
0 个评论
采纳的回答
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
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Exponents and Logarithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!