MATLAB Answers

How to get only real output from (-3)^(1/3)

2 views (last 30 days)
Apurbo Roy Chowdhury
Apurbo Roy Chowdhury on 22 Aug 2021
(-3)^(1/3)
ans = 0.7211 + 1.2490i
I need the ans: -1.44224957.

Answers (2)

Steven Lord
Steven Lord on 22 Aug 2021
You can use the nthroot function.
y = nthroot(-3, 3)
y = -1.4422
  2 Comments

Sign in to comment.


Walter Roberson
Walter Roberson on 22 Aug 2021
format long g
syms x
solve(x^3==-3 & imag(x) == 0)
ans = 
double(ans)
ans =
-1.44224957030741
  3 Comments

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!