Quaternion type: Difference between revisions

m
Use proper subscripts in problem description
m (Use proper subscripts in problem description)
Line 4:
A complex number has a real and complex part written sometimes as <code>a + bi</code>, where a and b stand for real numbers and i stands for the square root of minus 1. An example of a complex number might be <code>-3 + 2i</code>, where the real part, a is -3.0 and the complex part, b is +2.0.
 
A quaternion has one real part and ''three'' imaginary parts, i, j, and k. A quaternion might be written as <code>a + bi + cj + dk</code>. In this numbering system, <code>ii = jj = kk = ijk = -1</code>. The order of multiplication is important, as, in general, for two quaternions q1q<sub>1</sub> and q2q<sub>2</sub>; <code>q1q2q<sub>1</sub>q<sub>2</sub> != q2q1q<sub>2</sub>q<sub>1</sub></code>. An example of a quaternion might be <code>1 +2i +3j +4k</code>
 
There is a list form of notation where just the numbers are shown and the imaginary multipliers i, j, and k are assumed by position. So the example above would be written as (1, 2, 3, 4)
 
<br>'''Task Description'''<br>
Given the three quaternions and their components:
q = (1, 2, 3, 4) = (a, b, c, d )
q1q<sub>1</sub> = (2, 3, 4, 5) = (a1a<sub>1</sub>, b1b<sub>1</sub>, c1c<sub>1</sub>, d1d<sub>1</sub>)
q2q<sub>2</sub> = (3, 4, 5, 6) = (a2a<sub>2</sub>, b2b<sub>2</sub>, c2c<sub>2</sub>, d2d<sub>2</sub>)
And a wholly real number <code>r = 7</code>.
 
Line 20:
# The conjugate of a quaternion:<br><code>=( a, -b, -c, -d)</code>
# Addition of a real number r and a quaternion q:<br><code>r + q = q + r = (a+r, b, c, d)</code>
# Addition of two quaternions:<br><code>q1q<sub>1</sub> + q2q<sub>2</sub> = (a1a<sub>1</sub>+a2a<sub>2</sub>, b1b<sub>1</sub>+b2b<sub>2</sub>, c1c<sub>1</sub>+c2c<sub>2</sub>, d1d<sub>1</sub>+d2d<sub>2</sub>)</code>
# Multiplication of a real number and a quaternion:<br><code>qr = rq = (ar, br, cr, dr)</code>
# Multiplication of two quaternions q1q<sub>1</sub> and q2q<sub>2</sub> is given by:<br><code>( a1a2a<sub>1</sub>a<sub>2</sub>b1b2b<sub>1</sub>b<sub>2</sub>c1c2c<sub>1</sub>c<sub>2</sub>d1d2d<sub>1</sub>d<sub>2</sub>,</code><br><code>&nbsp; a1b2a<sub>1</sub>b<sub>2</sub> + b1a2b<sub>1</sub>a<sub>2</sub> + c1d2c<sub>1</sub>d<sub>2</sub>d1c2d<sub>1</sub>c<sub>2</sub>,</code><br><code>&nbsp; a1c2a<sub>1</sub>c<sub>2</sub>b1d2b<sub>1</sub>d<sub>2</sub> + c1a2c<sub>1</sub>a<sub>2</sub> + d1b2d<sub>1</sub>b<sub>2</sub>,</code><br><code>&nbsp; a1d2a<sub>1</sub>d<sub>2</sub> + b1c2b<sub>1</sub>c<sub>2</sub>c1b2c<sub>1</sub>b<sub>2</sub> + d1a2d<sub>1</sub>a<sub>2</sub> )</code>
# Show that, for the two quaternions q1q<sub>1</sub> and q2q<sub>2</sub>:<br><code>q1q2q<sub>1</sub>q<sub>2</sub> != q2q1q<sub>2</sub>q<sub>1</sub></code>
If your language has built-in support for quaternions then use it.
 
Anonymous user