That said, qnf_mt_ seems to only deal with the monadic case. But I think this is how you would define a verb which raises a quaternion to a quaternion power:
qnexp=: ^qnf_mt_@(qnmul_mt_ ^.qnf_mt_)"1~ (The "1 because quaternions are represented here as a pair of complex numbers, with the real part of the quaternion being the real part of the first of the two complex numbers.) So, simple test: 2 0 qnexp 3 0 8 0 Or, by analogy to 2j1^2 3j4 we could do: 2 1 qnexp 2 0 3 4 2j1 0 qnexp 2 0 3j4 0 .... I don't know of a body of worked examples for more elaborate cases, though... (Intuitively, if a complex number represents a time and a single dimension, a quaternion would represent a time and three dimensions. Need to verify the correctness of the dimensions and approach, of course. Mostly, I am familiar with unit length quaternions being used to represent a rotation in three dimensions -- quaternion multiplication composes these kinds of rotations, just like multiplying unit length complex numbers composes those rotations.) Thanks, -- Raul On Wed, Oct 31, 2018 at 3:04 PM Raul Miller <[email protected]> wrote: > > Typing error on my part. :/ > > (I left out the _mt_ when I was trying that, for some reason.) > > Thanks, > > -- > Raul > On Tue, Oct 30, 2018 at 6:15 PM Brian Schott <[email protected]> wrote: > > > > Raul, > > > > I wish I understood quaternions, but since I don't, I can't help much. > > > > I see the following definition for qnf in quatern.ijs. So in what sense is > > it NOT implemented, as you say? > > > > qnf=: 1 : 'qn1_mt_ (u@(j. qn1_mt_) ((9 o. [) qn1_mt_ (* 11&o.)~) (% > > qn1_mt_)@]) qnmod_mt_@qnmarkijk_mt_ qn1_mt_ ]' > > > > On Tue, Oct 30, 2018 at 5:27 PM Raul Miller <[email protected]> wrote: > > > > > Currently, > > > > > > require'math/mt' > > > 1 qn1_mt_ 0 0 > > > 1 0 > > > 1 qni_mt_ 0 0 > > > 0j1 0 > > > 1 qnj_mt_ 0 0 > > > 0 1 > > > 1 qnk_mt_ 0 0 > > > 0 1 > > > > > > To fix, maybe we should change the definition of qnk to: > > > > > > qnk=: 11&o.@{: : ((j.~qnj) 1} ]) > > > > > > Also, sadly, the qnf mentioned at the bottom of the file does not seem > > > to be implemented, though playing with taylor series suggests this > > > might not be impossible to implement: > > > > > > +/((qnmul_mt_&1 0)^:(i.100) 1 0)%!i.100 > > > 2.71828 0 > > > +/((qnmul_mt_&0j1 0)^:(i.100) 1 0)%!i.100 > > > 0.540302j0.841471 0 > > > +/((qnmul_mt_&0 1)^:(i.100) 1 0)%!i.100 > > > 0.540302 0.841471 > > > +/((qnmul_mt_&0 0j1)^:(i.100) 1 0)%!i.100 > > > 0.540302 0j0.841471 > > > > > > Thanks, > > > > > > -- > > > Raul > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > > > > -- > > (B=) <-----my sig > > Brian Schott > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
