I was wondering about the rational for the choice of the cube root returned for a negative number. I expected the real root to be returned, e.g., (_8)^(%3) --> _2  but J gives 1j1.73205. This is the case in other languages as well, so no doubt there is a mathematical justification for this. In order to evaluate the solution of a cubic equation by Cardono's formula, I had to define the cube root as:

cbrt=: {{ (*y)*(|y)^%3 }}

I just wonder why the default is for ^%3 to return a complex result.

Thanks,

Patrick

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to