Quaternions: Convert to a 2 x 2 matrix form
06-25-2015, 02:55 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,383 Joined: Dec 2013
Quaternions: Convert to a 2 x 2 matrix form
Code:
QTM(A,B,C,D) BEGIN RETURN [[A+B*i, C+D*i], [-C+D*i, A-B*i]]; END;

For more details, please visit my blog at: http://edspi31415.blogspot.com/2015/06/h...nions.html
04-25-2016, 05:57 PM
Post: #2
 salvomic Senior Member Posts: 1,394 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 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
 « Next Oldest | Next Newest »

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