# Question:Quaternions in Mobius

## Question:Quaternions in Mobius

Have to create digital questions in Mobius on quaternions. Aim is to teach students of robot engineering about rotations besides the matrix rotations. Made some code, it works but very simplistic. I could not load a quarternion-toolbox.

Any suggestions?

# quaternion product
# define two vecotrs p and q:
\$p0=range(3,3,1);
\$px=range(1,1,1);
\$py=range(-2,-2,1);
\$pz=range(1,1,1);
\$q0=range(2,2,1);
\$qx=range(-1,-1,1);
\$qy=range(2,2,1);
\$qz=range(3,3,1);
\$p=maple("Vector([\$px,\$py,\$pz])");
\$q=maple("Vector([\$qx,\$qy,\$qz])");
\$displayp=maple("printf(MathML:-ExportPresentation(\$p))");
\$displayq=maple("printf(MathML:-ExportPresentation(\$q))");
# p.q=p0.q0-(p.q)+p0.q+q0.p+p*q
# scalar part
\$dot=maple("LinearAlgebra[DotProduct](\$p,\$q,conjugate=false)");
\$scalar_part=\$p0*\$q0-\$dot;
# vector part
\$cross=maple("LinearAlgebra[CrossProduct](\$p,\$q)");
\$p0q=maple("LinearAlgebra[MatrixMatrixMultiply](\$p0,\$q)");
\$q0p=maple("LinearAlgebra[MatrixMatrixMultiply](\$q0,\$p)");
\$displayvector_part=maple("printf(MathML:-ExportPresentation(\$vector_part))");
# unit vectors
\$i=maple("Vector([1,0,0])");
\$j=maple("Vector([0,1,0])");
\$k=maple("Vector([0,0,1])");