Re: Quaternion problem-> visualization

*To*: mathgroup at smc.vnet.net*Subject*: [mg67471] Re: Quaternion problem-> visualization*From*: Roger Bagula <rlbagula at sbcglobal.net>*Date*: Tue, 27 Jun 2006 03:14:42 -0400 (EDT)*References*: <e7ap5q$952$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Staffan Langin wrote: >Hello, > >I'm a total Mathematica newbee so please bear with me :-). I'm trying to let >Mathematica analytically evaluate a second order derivative for me. The >function has several parameters with some of them being of >"Quaternion-type". I want to instruct Mathematica that the commutative rule >doesn't apply when evaluation the function. Is that possible? Thanks in >advance. > >Staffan Langin > > > Apparently ther is a reason a Clifford Torus has the name Clifford attached! If you take the two complex plane circles: z1=Cos[t]+I*Sin[t] z2=Cos[p]+I*Sin[p] and form : q=z1+J*z2 You get: Quaternion[Cos[t],Sin[t],Cos[p],Sin[p]] The visualization in 3d is: Clear[x1, y1, z1] w = Sqrt[2] - Sin[p] x1 = 2*Cos[t]/w y1 = 2*Sin[t]/w z1 = 2*Cos[p]/w g1 = ParametricPlot3D[{x1, y1, z1}, {p, 0.001, 2*Pi - 0.001}, {t, 0, 2*Pi}, PlotPoints -> {40, 40}, Axes -> False, Boxed -> False, PlotRange -> All] Show[g1, ViewPoint -> {-3.370, -0.295, -0.076}] Show[g1, ViewPoint -> {0.002, 0.045, 3.383}] Show[g1, ViewPoint -> {0.209, 3.361, 0.329}] The really good thing is that the double derivative in two variables comes out as the negative of the original quaternion ( it's a special case): << Algebra`Quaternions` i = {{0, 1}, {-1, 0}}; j = {{0, I}, {I, 0}}; k = {{I, 0}, {0, -I}}; e = IdentityMatrix[2]; q[t_, x_, y_, z_] := e*t + x*i + j*y + k*z; (* Clifford torus quaternion*) qc = q[Cos[t], Sin[t], Cos[p], Sin[p]] qcs = q[Cos[t], -Sin[t], -Cos[p], -Sin[p]] FullSimplify[ExpandAll[qc.qcs]] dqt = D[qc, {p, 2}] dqp = D[qc, {t, 2}] q2_out = Quaternion[Re[dqt[[1, 1]]], Re[dqt[[1, 2]]], Re[dqt[[1, 2]]], Im[dqt[[1, 1]]]] + Quaternion[Re[dqp[[1, 1]]], Re[dqp[[ 1, 2]]], Re[dqp[[1, 2]]], Im[dqp[[1, 1]]]] (* if the angles are all real*) -dqt - dqp == qc True