Quaternions: Convert to a 2 x 2 matrix form
04-25-2016, 05:57 PM
Post: #2
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
RE: Quaternions: Convert to a 2 x 2 matrix form
hi Eddie,
after your blog, a modified version with some extensions inside...

Salvo

Code:
 // Quaternion by Eddie W. Shore EXPORT QTM(A,B,C,D) BEGIN RETURN [[A+B*i, C+D*i], [-C+D*i, A-B*i]]; END; // Norm EXPORT QTM_norm(A,B,C,D) BEGIN RETURN sqrt(A^2+B^2+C^2+D^2); END; // Unit Quaternion matrix EXPORT QTM_Unit(A,B,C,D) BEGIN LOCAL mat, n; mat:= QTM(A,B,C,D); n:= QTM_norm(A,B,C,D); RETURN mat/n; END; // Conjugate of Q. matrix EXPORT QTM_conj(A,B,C,D) BEGIN RETURN (QTM(A,B,C,D))^(-1) * QTM_norm(A,B,C,D)^2; END;

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
 « Next Oldest | Next Newest »

 Messages In This Thread Quaternions: Convert to a 2 x 2 matrix form - Eddie W. Shore - 06-25-2015, 02:55 AM RE: Quaternions: Convert to a 2 x 2 matrix form - salvomic - 04-25-2016 05:57 PM

User(s) browsing this thread: 1 Guest(s)