Functions | |
if (isscalar(x)) x * | |
endif | if (isscalar(m)) m * |
if (any(idx(:))) y(idx) | |
endif | if (all(imag(y)==0)) y |
endif endfunction | !assert (nthroot(-1,[3,-3]),[-1,-1], eps) |
!assert (nthroot([-1, 1],[3.1,-3]),[-1, 1].^(1./[3.1,-3])) | |
!assert (nthroot([-1+1i,-1-1i], 3),[-1+1i,-1-1i].^(1/3)) | |
Variables | |
function | y |
endif | idx = (mod (m, 2) == 1 & imag (x) == 0 & x < 0) |
!assert | ( | nthroot([-1+1i,-1-1i], 3) | , | |
[-1+1i,-1-1i] .^ | 1/3 | |||
) |
!assert | ( | nthroot([-1, 1],[3.1,-3]) | , | |
[-1, 1] .^ | 1./[3.1,-3] | |||
) |
endif endfunction !assert | ( | nthroot(-1,[3,-3]) | , | |
eps | ||||
) |
if | ( | any(idx(:)) | ) |
endif if | ( | isscalar(m) | ) |
if | ( | isscalar(x) | ) |
endif idx = (mod (m, 2) == 1 & imag (x) == 0 & x < 0) |