"trying hope" <withhope2007@hotmail.com> wrote in message <gk18ut$k3$1@fred.mathworks.com>...
> Hi, I'm new to matlab. I try to calculate (4)^(1/3). I got an imaginary answer. Could anyone told me how to express (4)^(1/3) in matlab to get a correct answer?Thanks a lot.

The function f(z) = z^(1/3) on the complex plane has the property that what mathematicians call its "analytic continuation" has three branches. It cannot be defined as a continuous function over the whole plane unless it is allowed to have three possible values at each point z (except at z=0.) If you start at, say, z = 8 with f(8) = 8^(1/3) = 2, and proceed in a counterclockwise circular path around the origin, never allowing any discontinuous jumps along the way, when you return back to the point z = 8, then f(z) will of necessity have a different value there, namely 1+sqrt(3)*i. If you go around once more, it will have changed to 1sqrt(3)*i. Finally after three trips around it will return to the original real value 2. That is the significance of the three branches. You will note that the cube of each of these three possible values gives the value 8 as it should.
In their power operation '^' which is designed to handle complex values, Mathworks cannot know which branch a user wishes to be on and therefore can give values for only one of the branches, namely what is known as the "principal" branch, as is frequently done in mathematics. This branch gives real values for z along the positive real axis and is continuous everywhere except along the negative real axis where it has a discontinuous jump across that axis. It is along this negative real axis that you got your unexpected answer. This is called a "branch cut". If you had moved z a tiny ways below the real axis the value would have taken a discontinuous jump.
If you read the description of the matlab 'nthroot' function, you will notice that it applies only to real numbers and therefore does not face the problem of multiple branches. It will presumably give you an error message if you pass it a complex argument.
End of minilecture on analytic function theory.
Roger Stafford
