Find the real cube root of `-27`

.

For comparison, also calculate `(-27)^(1/3)`

.

The result is the complex cube root of `-27`

.

Create a vector of roots to calculate, `N`

.

Use `nthroot`

to calculate several real
roots of `-8`

.

Y =
-1.5157 -2.0000 -0.1250

The result is a vector of the same size as `N`

.

Create a matrix of bases, `X`

, and a
matrix of nth roots, `N`

.

X =
-2 -2 -2
4 -3 -5
N =
1.0000 -1.0000 3.0000
0.5000 5.0000 3.0000

Each element in `X`

corresponds to an element
in `N`

.

Calculate the real nth roots of the elements in `X`

.

Y =
-2.0000 -0.5000 -1.2599
16.0000 -1.2457 -1.7100

Except for the signs (which are treated separately), the result
is comparable to `abs(X).^(1./N)`

. By contrast, you
can calculate the complex roots using `X.^(1./N)`

.