In the history of APL, _8^%3 (for example) once gave _2 as a result. When complex numbers were introduced, the definition of x^y was changed to the more general *y*^.x, and _8^%3 no longer gave the _2 result but produced the principal cube root of _8:
^ (%3) * ^. _8 1j1.73205 ^. _8 2.07944j3.14159 This very example is described in section 10.3 of *APL Since 1978 <https://doi.org/10.1145/3386319>*. On Wed, Feb 3, 2021 at 8:20 PM J. Patrick Harrington <j...@umd.edu> wrote: > 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm