normal logarithm imaginary number problem
조회 수: 2 (최근 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!