Quite right (what Cliff says). The root produced by the interpreter is per the branch cut and is the "principal root". An additional property preserved by giving the principal root is (x %: y) = ^ x%~^.y , and in general (x ^ y) = ^ y*^.x
3 %: _8 1j1.73205 ^ 3 %~ ^. _8 1j1.73205 Historically, _8^%3 in APL gives _2 as the answer. But is this in violation of the 2001 ISO Standard on Extended APL. I consider the _2 answer as an "Easter egg" tour de force by the original implementers (principally Larry Breed): For x^y where x is negative, assume y is positive. (For negative y, replace x by %x and y by -y.) The system computes a rational approximation of y of integers m and n with 1=gcd(m,n) . If n is even, signal domain error; if n is odd, x^y is the real number (x^m)^%n . ----- Original Message ----- From: Cliff Reiter <[email protected]> Date: Wednesday, June 24, 2009 5:28 Subject: Re: [Jprogramming] Which branch of the root? To: Programming forum <[email protected]> > NB. all roots > p. 8 0 0 1 > +-+-----------------------+ > |1|1j1.73205 1j_1.73205 _2| > +-+-----------------------+ > > NB. Branch cut along neg real axis is standard I think > NB. discontinuous near neg real axis > 3 %: _8+j.1e_12 > 1j1.73205 > 3 %: _8-j.1e_12 > 1j_1.73205 > > NB. Continuous on positive real > 3 %: 8+j.1e_12 > 2j8.33333e_14 > 3 %: 8-j.1e_12 > 2j_8.33333e_14 > > NB. probably better (no different) to think about exponential > _8^1r3 > 1j1.73205 > > Ed Keith wrote: > > I type "3 %: _8" into J and was surprised when I got > "1j1.73205". I realize this is technically correct, but when I > type "3 %: 8" I get "2", not "_1j1.73205". > > > > How does J decide which branch of the root to give? Is there > away to influence its decision? Is there a way to generate all roots? > > > > -EdK ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
