Get this Quaternion Package from Maple's Application Center. Make sure you get the March 2007 version not the March 2005 version.

Overview on Hamilton Quaternions

A Hamilton Quaternion is a hypercomplex number with one real part (the scalar) and three imaginary parts (the vector).

This is an extension of the concept of numbers. We have found that a real number is a one-part number that can be represented on a number line and a complex number is a two-part number that can be represented on a plane. Extending that logic, we have also found that we can produce more numbers by adding more parts.

Quaternion --> a + b*i + c*j + d*k, where the coefficients a, b, c, d are elements of the reals

The hypercomplex number-quaternion-is a non-commutative division ring. This is what we call a four-dimensional number. Here is an example of a quaternion: 5 + 2i + 3j + 4k. The first term is called the scalar term; it is simply a real number. The other terms consisting of, i, j, k. are called the imaginary terms. As a group, they are called the vector of the quaternion. Vector algebra uses the same name vector as the quaternion number, but with a different meaning. Although vector algebra is an offspring of quaternions, vectors are not numbers. Starting with complex numbers, we lost the permanence of trichotomy. The permanencies we lose with quaternion numbers are the trichotomy property and the commutative property under multiplication. In addition, the imaginary units are anti-commutative under multiplication. Anti-commutative means the sign of the imaginary unit changes when we transpose the two operands under multiplication, e.g., i*j = -(j*i). The imaginary elements, i, j, and k, give cyclic permutations with each other (see Behaviors of Quaternions).

If we set the coefficients of the imaginary elements j and k to zero, the quaternion number becomes an ordinary complex number. We can deduce all of the other algebraic numbers and/or the transcendental numbers from the quaternions simply by setting all the coefficients of the imaginary elements to zero.

Behaviors of Quaternions

> with(Quaternions);

Warning, u, i, j, & k are protected for quaternion package

Warning, these protected names have been redefined and unprotected: `*`, `+`, `-`, `^`, eval, print, unprotect

> q := Qrand(-10,10); # Typical quaternion

> i*i; j*j; k*k;

> i*j;

> j*k;

> j*i;

> i*j*k;

> q1 := Qrand(-10,10); q2 := Qrand(-20,20);

> q1*q2; # quaternion are usually not commutative

> q2*q1; #see the different

> q1 + q2; q2 + q1;

> q1; Qconjugate(q1);

> q * Qinverse(q);

> Qinverse(q) * q;

> i^0; j^0; k^0;

> i^1; j^1; k^1;

> i^2; j^2; k^2;

> i^3; j^3; k^3;

> Qround(%); Qround(%); Qround(%%);

> i^4;

> i*j*k; k*j*i;

> q := Qdefine(1,2,3,4);

> q^0;

> q^1;

> q^2;

> q^3;

> q^4;

> q := Qdefine(1,2,3,4);

> QtoMatrix(q);

> QtoMatrices(q);

> Qscalar(q);

> Qvector(q);

> QisPure(q);

> QisPure(Qvector(q));

> QisScalar(5);

> QisScalar(i);

> QisScalar(i);

> type(I,complex);

> type(I,quaternion);

> type(5,quaternion);

> type(q,quaternion);

> type([1,2,3],quaternion);

> type(1,2,3,quaternion);

> Qunit(q);

> % * %;

> q;

> Qconjugate(q);

> QisCommutable(5,5);

> QisCommutable(q,q);

> QisCommutable(i,i);

> q1 := Qrand(-100,100); q2 := Qrand(-100,100);

> QisCommutable(q1,q2);

> q1*q2;

> q2*q1;

> q;

> Qnorm(q);

> Qnormalize(q);

> %^2;

> QconvertToFrac(%);

> Qunit(q);

> QisEqual(5,5);

> QisEqual(4,5);

> QisEqual(q,q);

> QisEqual(q1,q2);

> Qunit(q)*Qunit(q);

> Qabs(-5);

> Qabs(i);

> Qabs(j);

> q := Qconjugate(Qdefine(4,-3,1,-2));

> qx := Qsignum(q);

> qy := Qdefine(2*sqrt(2/15),sqrt(3/10),-sqrt(1/30),sqrt(2/15));

> QisEqual(qx,qy);

> Qabs(q);

> q := Qrand(-4,5);

> Qicoeff(q);

> Qjcoeff(q);

> Qkcoeff(q);

> Qscalar(q);

> Qvector(q);

> i*j*k;

> j*k*i;

> k*i*j;

> j*i*k;

> sin(I+1);

> evalf(%);

> Qsin(i+1);

> evalf(%);

> Qsin(j+1);

> evalf(%);

> exp(0);

> exp(1);

> exp(I);

> evalf(%);

> Qexp(i);

> evalf(%);

> Qexp(i+j+k);

> evalf(%);

> q;

> QunitVector(q)^2;

> exp(-1);

> Qexp(-1);

> exp(-I);

> evalf(%);

> Qexp(-i);

> evalf(%);

> argument( exp(I * 2*Pi/3) );

> evalf(%);

> Qangle( Qexp(i * 2*Pi/3) );

> argument(I);

> Qargument(i);

> argument(1+I);

> Qargument(1+k);

> Qargument(1+j+k);

> q := Qunit(Qrand(-100,100));

> n := 4;

> theta := Pi/3;

> w := QunitVector(q);

> evalf(Qexp(w*n*theta)); # note the next three commands are approximately equal

> (Qcos(theta) + w*Qsin(theta))^n;

> evalf(Qcos(n*theta) + w*Qsin(n*theta));

Quaternion Procedures in Maple 9.5

The following names are defined in the quaternion package:

__type/quaternion__

__*__

__+__

__-__

__^__

__Qabs__

__Qadd__

__Qamplitude__

__Qangle__

__Qarccos__

__Qarccosh__

__Qarccot__

__Qarccoth__

__Qarccsc__

__Qarccsch__

__Qarcsec__

__Qarcsech__

__Qarcsin__

__Qarcsinh__

__Qarctan__

__Qarctanh__

Qargument

__Qaxial__

__Qceil__

__Qcolatitude__

__Qconjugate__

QconvertToFrac

__Qcos__

__Qcosh__

__Qcot__

__Qcoth__

__Qcsc__

__Qcsch__

__Qdefine__

__QdivLeft__

__QdivRight__

__Qdot__

__Qeval__

__Qexp__

__Qfloor__

__Qfrac__

__Qicoeff__

__Qinverse__

__QisCommutable__

__QisEqual__

__QisPure__

__QisScalar__

__Qjcoeff__

__Qkcoeff__

__Qlength__

__Qln__

__Qlongitude__

__Qmagnitude__

__Qmodulus__

__QmuPart__

__Qmult__

__Qnorm__

__Qnormalize__

QphiPart

__QpolarPart__

__QpolarToRect__

__Qpower__

QpsiPart

__Qrand__

__QrectToPolar__

__Qround__

Qscalar

__Qsec__

__Qsech__

__Qsignum__

Qsin

__Qsinh__

__Qsqrt__

__Qsubtract__

__Qtan__

__Qtanh__

__QthetaPart__

__QtoMatrices__

QtoMatrix

__Qtrunc__

__Qunit__

__QunitVector__

Qvector

History

Sir William Rowan Hamilton was born in Dublin, Ireland either on August 3rd or on August 4th, 1805. He was born at midnight, so there is some confusion about his birthday. Hamilton was considered a prodigy. For some years, he lived in Trim with his uncle, Reverend James Hamilton. By the age of five, it is claimed that Hamilton knew Latin, Greek, and Hebrew, which he learned from his uncle. Hamilton was exposed to mathematics at age twelve by Zerah Colburn (American). Colburn was able to impress Hamilton by performing amazing mental arithmetic operations.

By age 13, Hamilton studied the algebra of the mathematician Alexis Claude Clairaut (Paris, France; 1713 - 1765). Clairaut's Th\351orie de la Figure de la Terra (1743), a treatise dealing with the shape of rotating solid bodies, might have been the driving force for Hamilton's direction toward quaternions. At age 17, Hamilton discovered an error in Laplace's M\351chanique C\351leste, which brought Hamilton a lot of recognition. At age 18, Hamilton became a student at Trinity College, Dublin. He earned an award called Optime in Classics--awarded once every twenty years.

Hamilton married Helen Maria Bayly in Ireland and together they had two sons and a daughter. On his publication of Theory of System of Rays (1832), he predicted conical refraction via the characteristic function on Fresnel's wave surface. Hamilton received great fame after Humphrey Lloyd, his physics professor, confirmed experimentally this theoretical prediction. In 1835, Hamilton received his knighthood.

The Royal Irish Academy provided an audience for Hamilton's paper on complex numbers as algebraic couples (ordered pairs of real numbers). His paper was considered very difficult to understand (this was a curse that plagued all of Hamilton's publications). However, his focus was expanding the algebra of the complex numbers to triplets. He could add and subtract triplets, but could not multiply them. For years his obsession even caught the attention of his children who would ask him every morning, "Well, Papa can you multiply triplets?" On Monday, October 16, 1843, while Hamilton and his wife were walking along the Royal Canal on his way to a council meeting with the Royal Irish Academy, the idea of the quaternions sparked in his mind. He carved the idea in the stone of Brougham Bridge: i^2 = j^2 = k^2 = ijk = -1.

Hamilton felt that his discovery of the quaternions in the 19th century was just as important as the fluxions (the calculus) were in the 17th century. The rest of his life was devoted to elucidating the algebra of the quaternions. However, being plagued with alcoholism and cursed with the inability to communicate his ideas clearly may have been the reasons quaternions were not taken seriously. The mathematician, William Thomson (Ireland; 1824 - 1907) wrote:

Quaternions came from Hamilton after his really good work had been

done, and though beautifully ingenious, have been an unmixed evil

to those who have touched them in any way.

Applications

Rotating objects are probably quaternion numbers' most practical application. We have an alternate way of rotating objects with another non-commutative algebra, called matrix algebra. However, matrix algebra, coupled with trigonometric functions, has a defect. Sometimes we get what one calls a singular matrix. Mechanical devices, such as gyroscopes, tracking, robot arms, etc., cannot afford to have a singular matrix in the software. A singular matrix can cause gimbal (or robot) lock. Gimbal lock is when the mechanical device simply locks up (stop working) because one degree of freedom, among the three axes, is lost.. This could be very hazardous for an air force fighter navigation system! In addition, it could be very costly for an automobile factory that uses robotic arms. Rotations, via quaternion numbers, do not exhibit the problem of gimbal lock. Quaternion numbers also will require fewer programming steps than matrix rotation. Fewer programming step equates to faster, efficient, and cost-effective software.

Rotation is also used in computer animation. As computers are becoming faster, consumers need incentives to purchase the more expensive computers. Video games offer strong incentives for those who take their leisure seriously. Interactive video games need effective method of rotating virtual objects. For example, both video games of Tomb Raider I, II, & III all take advantage of quaternions.

Matrix algebra utilizes angles called Euler angles. Euler angles are the rotation angles of the Euclidean (rectangle) coordinate system. Euler angles specify the rotation of the X, Y, and Z rotation axes. The Euler angle is the culprit of the singularities in matrix algebra. In addition, Euler angles produce a jerky and unnatural type of movement. With quaternions, the rotations are smooth and natural. This is why Microsoft's programming development software offers software engineers quaternion tools. Remember quaternions are four dimensions; this is the reason quaternions are more effective and efficient then matrices. Euler angles only work with three dimensions of height, length, and width. However, quaternions have the super ability to produce a rotation on any, of the infinite, axes of a sphere. For a rotation of two axes, one would need several operations, with matrices, and only one operation, with quaternions.

Quaternions are also utilized in MRI (Magnetic Resonance Images) and CAT (Computed Axial Tomography), also known as CT (Computed Tomography). MRI technology utilizes magnetic energy and radio waves in order to produce cross-sectional slice images of the human body. CAT technology utilizes the x-ray principal. As x-rays pass through the body they are attenuated at different levels; this produces a profile of different slices. MRI and CAT scans perform rigid transformations that are represented by quaternions. Each quaternion is iterated as an interpolated change that is computed for position and orientation. In addition, the interpolated rotation is a small-angle approximation of a rotation quaternion that is linear in three parameters.

References

Maxfield, John E., and Maxfield, Margaret W. Abstract Algebra and Solution by Radicals. New York: Dover, 1971.

Meserve, Bruce E. Fundamental Concepts Of Algebra. New York: Dover, 1981.

Parker, Sybil P. Dictionary of Mathematics. New York: McGraw, 1997.

Rucker, Rudy. The Fourth Dimension: A Guided Tour of the Higher Universes. Boston: Houghton, 1984.

Russell, Bertrand. Introduction to Mathematical Philosophy. New York: Dover, 1933.

Sanchez, Julio, and Maria Canton. DirectX 3D Graphics Programming Bible. Foster City, CA: IDG Books Worldwide, 2000.

Shapiro, Max S. Mathematics Encyclopedia. Garden City: Doubleday, 1977.

Smith, D. E. History of Mathematics. 2 vols. New York: Dover, 1958.

Sweetser, Doug. Doing Physics with Quaternions. n.p., n.d. Online. Internet. 12 December 2000.

Available http://world.std.com/~sweetester/quarternions/qindex.html.

Taylor, Edwin F., and John Archibald Wheeler. Spacetime Physics: Introduction to Special Relativity. 2nd ed. New York: W. H. Freeman, 1996.

Wright, Richard S., Jr., and Sweet, Michael. OpenGL Super Bible. 2nd ed. Indianapolis: Waite Group, 2000.

Wunsch, David A. Complex Variables with Applications. 2nd ed. Massachusetts: Addison-Wesley, 1994.

Credits

School:.........................Purdue University Calumet

Department:.................Mathematics, Computer Science, and Statistics

Course:........................CS 206 - Computer Algebra and Programming

Professor:.....................Roger Kraft, PhD

Student:........................Michael Carter (Laureice@wideopenwest.com)

Project:........................Quaterion Package

Platform:......................Windows 2000/XP

Computer Algebra:........Maple 8 updated to Maple 9.5, 10, 11 copyrights reserved except for Maplesoft.

Date:............................Friday, August 15, 2003 updated March, 2007

Purpose:.......................To receive credit for Maple programming in CS 206.

Email:...........................Laureice@wideopenwest.com

Profile

I received my first bachelor of science in biology (minor in chemistry) from Lewis University. I received my second B.S. from Purdue University Calumet. I am now pursuing a M.S. in Software Engineering at Purdue University West Lafayette Years ago, I received a certificate in computer programming from the College of Automation in Chicago and a post-bachelor degree in information systems with the programming option at Purdue. I am very happy about several projects throughout my quests. To name a few, I designed an assembler language computer emulator as two applications, one in C and the other in C#. Here, I coded both the assembler and the emulator. Next, I designed an animated mechanical man in Java3D (using quaternions); this course had only one student in it; guess who\342\200\224me. Finally, in two of my courses, I had to design a linear programming package and a grammar analyzer package, both of which were written in C#. I was exposed to quaternions, octonions, and sedenions while studying at the University of \307\272alborg in Denmark a few years back. Later, quaternions became my project while enrolled in a Maple programming course in the spring of 2003. It was originally written for Maple 8. Two years later my professor gave me my code back, and I decided to update it to Maple 9.5. My favorite languages are Microsoft Macro Assembler, C#, Java, and Python.

This post was generated using the MaplePrimes File Manager

View 4230_QuaternionsOverview.mw on MapleNet or Download 4230_QuaternionsOverview.mw

View file details