How to get only real output from (-3)^(1/3)
4 次查看(过去 30 天)
显示 更早的评论
(-3)^(1/3)
I need the ans: -1.44224957.
0 个评论
回答(2 个)
Steven Lord
2021-8-22
You can use the nthroot function.
y = nthroot(-3, 3)
2 个评论
Walter Roberson
2021-8-22
... I went looking for that, as I thought I remembered it existing. It is not mentioned in the documentation for power() or realroot() .
Walter Roberson
2021-8-22
format long g
syms x
solve(x^3==-3 & imag(x) == 0)
double(ans)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!