Multiplication by concept of Quaternions
For those of you folks who do not know about Quaternions:
Sir William Rowan Hamilton introduced in the 19th century thenotionofquaternions. Theseareoftheformx0+x1i+x2j+x3k,wherex0,x1,x2,x3 are numbers and i, j,k are symbols. For two numbers a,b (both not equal to zero), the multiplication rules of i, j and k can be described by a multiplication table. (which you can find here : http://www.google.ca/imgres?imgurl=http://delta.cs.cinvestav.mx/~mcintosh/comun/algebra/img368.gif&imgrefurl=http://delta.cs.cinvestav.mx/~mcintosh/comun/algebra/node42.html&h=106&w=153&tbnid=gThFVQIIRSCCRM:&docid=asnctpriJRgIhM&ei=gatMVpGeDYqler3rv4AJ&tbm=isch&ved=0CCAQMygAMABqFQoTCNHi0Z-2mskCFYqSHgodvfUPkA)
Take note that since there is o commutativity here, the order of multiplication matters.
My function consumes two numbers a, b and two elements q1 and q2 in the quaternions. This function shall produce the result of the multiplication i.e. q1·q2.