Fret: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>PC-XT
m Undid revision 566331434 by 65.64.173.65 (talk) test edit?
en>Drmies
→‎Variations: not sure if this is the right place, but it's a happening thing
Line 1: Line 1:
{{structure|date=April 2013}}
The best hemorrhoid treatment is prevention. The problem is most individuals do not think about preventing hemorrhoids until they find themselves afflicted with them.<br><br>If you have been seeing blood on the toilet paper, you're possibly in the late stages of the condition plus need a surprisingly efficient [http://hemorrhoidtreatmentfix.com/prolapsed-hemorrhoid-treatment prolapsed hemorrhoid treatment].<br><br>If the itch is driving we crazy, try extract of Echinacea on a cotton wool ball. Apply it straight to the area. This will bring you relief from this certainly irritating symptom and ease the pain too. Echinacea can be purchased at the regional wellness food store.<br><br>If you find going to the toilet for a bowel movement extremely difficult think about a stool softener. These can work well plus minimize the need for straining. These is purchased conveniently over the counter and is very powerful. If you would like something a little more all-natural we may need to think about eating prunes or drinking prune juice.<br><br>There are many factors which lead with all the bleeding of the hemorrhoid. One of them is the being constipated. With this, it is actually significant that you must change a diet. If you use to consume those processed plus fatty foods, then it is time to change those foods and begin eating foods that are rich inside fibers. There are many foods that are rich in fibers like fruits, vegetable and entire wheat bread. This may assist you remedy the constipation plus at the same time do away with your hemorrhoid. But if you find this treatment ineffective then we have to start searching for another treatment. You may ask the doctor regarding it plus ask for a greater remedy.<br><br>Step 5 - Consume Sufficient Fiber. Your mother will possibly have told we this when a kid and today you'll understand it's correct. Not consuming an adequate amount of fiber may the fact is result constipation and harder stools. A excellent fiber diet can assist to avert flare ups plus keep the stools soft. Fresh fruits, veggies, beans plus peanut butter are all splendid sources of fiber to help keep we usual.<br><br>Depending on the severerity of the symptom, some advertised their hemorrhoids were cure in 48 hours. I have tried it plus they are quite safe plus has no side effect as they use all-natural ingredience.
[[unit vector|Unit]] [[quaternion]]s, also known as [[versor]]s, provide a convenient [[mathematics|mathematical]] notation for representing [[Orientation (geometry)|orientation]]s and [[rotation]]s of objects in three dimensions. Compared to [[Euler angles]] they are simpler to [[function composition|compose]] and avoid the problem of [[gimbal lock]]. Compared to [[Rotation matrix|rotation matrices]] they are more [[numerically stable]] and may be more efficient. Quaternions have found their way into applications in [[computer graphics]], [[computer vision]], [[robotics]], [[navigation]], [[molecular dynamics]], [[flight dynamics]],<ref>Amnon Katz (1996) ''Computational Rigid Vehicle Dynamics'', [[Krieger Publishing Co.]] ISBN 978-1575240169</ref> and [[orbital mechanics]] of [[satellite]]s.<ref>J. B. Kuipers (1999) ''Quaternions and rotation Sequences: a Primer with Applications to Orbits, Aerospace, and Virtual Reality'', [[Princeton University Press]] ISBN 978-0-691-10298-6</ref>
 
When used to represent rotation, unit quaternions are also called '''rotation quaternions'''. When used to represent an [[Orientation (geometry)|orientation]] (rotation relative to a reference position), they are called '''orientation quaternions''' or '''attitude quaternions'''.
{{TOC limit|3}}
 
== Using quaternion rotations ==
 
According to [[Euler's rotation theorem]], any rotation or sequence of rotations of a rigid body or Coordinate system about a fixed point is equivalent to a single rotation by a given angle {{mvar|&theta;}} about a fixed axis (called ''Euler axis'') that runs through the fixed point. The Euler axis is typically represented by a [[unit vector]]&nbsp;{{mvec|''u''}}. Therefore, any rotation in three dimensions can be represented as a combination of a vector&nbsp;{{mvec|''u''}} and a scalar {{mvar|&theta;}}. Quaternions give a simple way to encode this [[axis–angle representation]] in four numbers, and to apply the corresponding rotation to a [[Position (vector)|position vector]] representing a [[Point (geometry)|point]] relative to the [[Origin (mathematics)|origin]] in [[real coordinate space|'''R'''<sup>3</sup>]].
 
A [[Euclidean vector]] such as {{math|(2, 3, 4)}} or {{math|(''a<sub>x</sub>'', ''a<sub>y</sub>'', ''a<sub>z</sub>'')}} can be rewritten as {{math|2 '''i''' + 3 '''j''' + 4 '''k'''}} or {{math|''a<sub>x</sub>'' '''i''' + ''a<sub>y</sub>'' '''j''' + ''a<sub>z</sub>'' '''k'''}}, where {{math|'''i'''}}, {{math|'''j'''}}, {{math|'''k'''}} are unit vectors representing the three [[Cartesian coordinate system|Cartesian axes]]. A rotation through an angle of {{mvar|&theta;}} around the axis defined by a unit vector
: <math>\vec{u} = (u_x, u_y, u_z) = u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}</math>
is represented by a quaternion using an extension of [[Euler's formula]]:
 
: <math> \mathbf{q} = e^{\tfrac{1}{2}{\theta(u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k})}} = \cos \tfrac{1}{2}\theta + (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) \sin \tfrac{1}{2}\theta</math>
 
The rotation is clockwise if our line of sight points in the same direction as {{mvec|''u''}}.  
 
It can be shown that this rotation can be applied to an ordinary vector <math>\mathbf{p} = (p_x, p_y, p_z) = p_x\mathbf{i} + p_y\mathbf{j} + p_z\mathbf{k}</math> in 3-dimensional space, considered as a quaternion with a real coordinate equal to zero, by evaluating the [[#The conjugation operation|conjugation]] of&nbsp;{{math|'''p'''}} by&nbsp;{{math|'''q'''}}:
: <math>\mathbf{p'} = \mathbf{q} \mathbf{p} \mathbf{q}^{-1}</math>
using the [[Hamilton product]], where {{math|1='''p'''′ = (''p<sub>x</sub>''′, ''p<sub>y</sub>''′, ''p<sub>z</sub>''′)}} is the new position vector of the point after the rotation.
 
In this instance, {{math|'''q'''}} is a [[unit quaternion]] and
: <math> \mathbf{q}^{-1} = e^{-\tfrac{1}{2}{\theta(u_xi + u_yj + u_zk)}} = \cos \tfrac{1}{2}\theta - (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) \sin \tfrac{1}{2}\theta .</math>
 
It follows that conjugation by the product of two quaternions is the composition of conjugations by these quaternions. If {{math|'''p'''}} and {{math|'''q'''}} are unit quaternions, then rotation (conjugation) by&nbsp;{{math|'''pq'''}} is
:<math>\mathbf{p q} \vec{v} (\mathbf{p q})^{-1} = \mathbf{p q} \vec{v} \mathbf{q}^{-1} \mathbf{p}^{-1} = \mathbf{p} (\mathbf{q} \vec{v} \mathbf{q}^{-1}) \mathbf{p}^{-1}</math>,
which is the same as rotating (conjugating) by&nbsp;{{math|'''q'''}} and then by&nbsp;{{math|'''p'''}}. The scalar component of the result is necessarily zero.
 
The quaternion inverse of a rotation is the opposite rotation, since <math>\mathbf{q}^{-1} (\mathbf{q} \vec{v} \mathbf{q}^{-1}) \mathbf{q} = \vec{v}</math>. The square of a quaternion rotation is a rotation by twice the angle around the same axis. More generally {{math|'''q'''<sup>''n''</sup>}} is a rotation by&nbsp;{{mvar|n}} times the angle around the same axis as {{math|'''q'''}}. This can be extended to arbitrary real {{mvar|n}}, allowing for smooth interpolation between spatial orientations; see [[Slerp]].
 
Two rotation quaternions can be combined into one equivalent quaternion by the relation:
 
: <math>\mathbf{q}' = \mathbf{q}_2 \mathbf{q}_1 </math>
 
in which {{math|'''q''′'''''}} corresponds to the rotation {{math|'''q'''<sub>1</sub>}} followed by the rotation {{math|'''q'''<sub>2</sub>}}. (Note that quaternion multiplication is not [[commutative]].) Thus, an arbitrary number of rotations can be composed together and then applied as a single rotation.
 
=== Example ===
 
==== The conjugation operation ====
 
[[File:Diagonal rotation.png|250px|thumb|right|A rotation of 120° around the first diagonal permutes {{math|'''i'''}}, {{math|'''j'''}}, and {{math|'''k'''}} cyclically.]]
 
''Conjugating'' {{math|'''p'''}} ''by'' {{math|'''q'''}} refers to the operation {{math|'''p''' ↦ '''q p q'''<sup>−1</sup>}}.
 
Consider the rotation {{mvar|f}} around the axis <math>\vec{v} = \mathbf{i} + \mathbf{j} + \mathbf{k}</math>, with a rotation angle of 120°, or {{sfrac|2π|3}}&nbsp;[[radian]]s. <!-- clever! -->
 
:<math>\alpha = \frac{2 \pi}{3}</math>
 
[[File:Versor action on Hurwitz quaternions.svg|thumb|right|{{math|'''p''' ↦ '''q p'''}} for {{math|1='''q''' = {{sfrac|1 + ''i'' + ''j'' + ''k''|2}}}} on the unit [[3-sphere]]. Note this one-sided (namely, [[left and right (algebra)|left]]) multiplication yields a 60° rotation of quaternions]]
The length of {{mvec|''v''}} is {{sqrt|3}}, the half angle is {{sfrac|π|3}} (60°) with [[cosine]] {{sfrac|1|2}}, ({{math|1=cos 60° = 0.5}}) and [[sine]] {{sfrac|{{sqrt|3}}|2}}, ({{math|1=sin 60° ≈ 0.866}}).  We are therefore dealing with a conjugation by the unit quaternion
 
:<math>\begin{array}{lll}
u
&=& \cos\frac{\alpha}{2} + \sin\frac{\alpha}{2}\cdot \frac{1}{\| \vec{v} \| }\vec{v}\\
&=& \cos \frac{\pi}{3} + \sin \frac{\pi}{3}\cdot \frac{1}{\sqrt{3}}\vec{v}\\
&=& \frac{1}{2} + \frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{3}}\vec{v}\\
&=& \frac{1}{2} + \frac{\sqrt{3}}{2}\cdot \frac{\mathbf{i}+\mathbf{j}+\mathbf{k}}{\sqrt{3}}\\
&=& \frac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2}
\end{array}</math>
 
If {{mvar|f}} is the rotation function,
:<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = u (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) u^{-1}</math>
 
It can be proved that the inverse of a unit quaternion is obtained simply by [[additive inverse|changing the sign]] of its imaginary components. As a consequence,
:<math>u^{-1} = \frac{1- \mathbf{i} - \mathbf{j} - \mathbf{k}}{2}</math>
and
:<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = \frac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2}(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) \frac{1 - \mathbf{i} - \mathbf{j} - \mathbf{k}}{2}</math>
 
This can be simplified, using the ordinary rules for quaternion arithmetic, to
:<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = c\mathbf{i} + a\mathbf{j} + b\mathbf{k}</math>
 
As expected, the rotation corresponds to keeping a [[cube]] held fixed at one point, and rotating it 120° about the long diagonal through the fixed point (observe how the three axes are [[cyclic permutation|permuted cyclically]]).
 
==== Quaternion arithmetic in practice ====
 
Let's show how we reached the previous result. Let's develop the expression of {{mvar|f}} (in two stages), and apply the rules
 
:<math>\begin{alignat}{2}
\mathbf{ij} & = \mathbf{k}, & \mathbf{ji} & = \mathbf{-k}, \\
\mathbf{jk} & = \mathbf{i}, & \mathbf{kj} & = \mathbf{-i}, \\
\mathbf{ki} & = \mathbf{j}, & \mathbf{ik} & = \mathbf{-j}, \\
\mathbf{i}^{2} & = \mathbf{j}^{2}& = \mathbf{k}^{2} & = -1
\end{alignat}</math>
 
It gives us:
 
<math>\begin{array}{lll}
f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k})
&=& \frac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2} (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) \frac{1 - \mathbf{i} - \mathbf{j} - \mathbf{k}}{2} \\
&=& \frac{1}{4} ( (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) +(- a + b\mathbf{k} - c\mathbf{j}) + (-a\mathbf{k} - b +c\mathbf{i}) + (a\mathbf{j} - b\mathbf{i} - c))\\
&&                          (1 - \mathbf{i} - \mathbf{j} - \mathbf{k})\\
&=& \frac{1}{4} ( (-a - b - c) + (a - b+ c) \mathbf{i} + (a + b - c) \mathbf{j} + (-a + b + c) \mathbf{k})\\
&&                          (1 - \mathbf{i} - \mathbf{j} - \mathbf{k})\\
&=& \frac{1}{4} ( ( (-a - b - c) + (a - b + c) \mathbf{i} + (a + b - c) \mathbf{j} + (-a + b + c) \mathbf{k})\\
&&+                      ( (a + b + c) \mathbf{i} + (a - b + c) + (a + b - c) \mathbf{k} + (a - b - c) \mathbf{j})\\
&&+                      ( (a + b + c) \mathbf{j} + (-a + b - c) \mathbf{k} + (a + b - c) + (-a + b + c) \mathbf{i})\\
&&+                      ( (a + b + c) \mathbf{k} + (a - b + c) \mathbf{j} + (-a - b + c) \mathbf{i} + (-a + b + c))\\
&=& \frac{1}{4} ( ( (-a - b - c) + (a - b + c) + (a + b - c) + (-a + b + c) )\\
&&+                      ( (a - b + c) + (a + b + c) + (-a + b + c) + (-a - b + c) ) \mathbf{i}\\
&&+                      ( (a + b - c) + (a - b - c) + (a + b + c) + (a - b + c) ) \mathbf{j}\\
&&+                      ( (-a + b + c) + (a + b - c) + (-a + b - c) + (a + b + c) ) \mathbf{k})\\
&=& \frac{1}{4} (0 + 4c \mathbf{i} + 4a \mathbf{j} + 4b \mathbf{k})\\
&=&c\mathbf{i} + a\mathbf{j} + b\mathbf{k}
\end{array}</math>
 
which is the expected result. As we can see, such computations are relatively long and tedious if done manually; however, in a computer program, this amounts to calling the quaternion multiplication routine twice.
 
=== Quaternion-derived rotation matrix ===
A quaternion rotation can be algebraically manipulated into a [[Rotation matrix#Quaternion|quaternion-derived rotation matrix]]. By simplifying the quaternion multiplications {{math|'''q p q'''*}}, they can be rewritten as a [[rotation matrix]] given an axis–angle representation:
 
: <math> \begin{bmatrix}
c + a_x^2 (1-c) &
a_x a_y (1-c) - a_z s &
a_x a_z (1-c) + a_y s \\
a_y a_x (1-c) + a_z s &
c + a_y^2 (1-c) &
a_y a_z (1-c) - a_x s \\
a_z a_x (1-c) - a_y s &
a_z a_y (1-c) + a_x s &
c + a_z^2 (1-c)
\end{bmatrix}
</math>
 
where {{mvar|s}} and {{mvar|c}} are shorthand for {{math|sin ''&theta;''}} and {{math|cos ''&theta;''}}, respectively.
Although care should be taken (due to [[Degeneracy (mathematics)|degeneracy]] as the quaternion approaches the [[multiplicative identity|identity]] quaternion ({{math|'''1'''}}) or the [[sine]] of the angle approaches zero) the axis and angle can be extracted via:
: <math> \begin{align}
\mathbf{q} & = q_r + q_i i + q_j j + q_k k \\
\theta &= 2 \cos^{-1} q_r = 2 \sin^{-1} \sqrt{q_i^2 + q_j^2 + q_k^2} \\
(a_x, a_y, a_z) &= \frac{1}{\sin \tfrac{1}{2} \theta} (q_i, q_j, q_k)
\end{align}
</math>
Note that the {{mvar|&theta;}} equality holds only when the square root of the sum of the squared imaginary terms takes the same sign as {{mvar|q<sub>r</sub>}}.
 
As with other schemes to apply rotations, the [[Rotation|centre of rotation]] must be [[Translation (geometry)|translated]] to the origin before the rotation is applied and translated back to its original position afterwards.
 
==Explanation==
 
===Quaternions briefly===
 
{{Main|Quaternions}}
The [[complex numbers]] can be defined by introducing an abstract symbol {{math|'''i'''}} which satisfies the usual rules of algebra and additionally the rule {{math|1='''i'''<sup>2</sup> = −1}}. This is sufficient to reproduce all of the rules of complex number arithmetic: for example:
: <math>(a+b\mathbf{i})(c+d\mathbf{i}) = ac + ad\mathbf{i} + b\mathbf{i}c + b\mathbf{i}d\mathbf{i} = ac + ad\mathbf{i} + bc\mathbf{i} + bd\mathbf{i}^2 = (ac - bd) + (bc + ad) \mathbf{i}</math>.
 
In the same way the quaternions can be defined by introducing abstract symbols {{math|'''i'''}}, {{math|'''j'''}}, {{math|'''k'''}} which satisfy the rules {{math|1='''i'''<sup>2</sup> = '''j'''<sup>2</sup> = '''k'''<sup>2</sup> = '''i j k''' = −1}} and the usual algebraic rules ''except'' the commutative law of multiplication (a familiar example of such a noncommutative multiplication is [[matrix multiplication]]). From this all of the rules of quaternion arithmetic follow: for example, one can show that:
: <math>(a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}) (e + f\mathbf{i} + g\mathbf{j} + h\mathbf{k}) =</math>
<math> (ae - bf - cg - dh) + (af + be + ch - dg) \mathbf{i} + (ag - bh + ce + df) \mathbf{j} + (ah + bg - cf + de) \mathbf{k}</math>.
 
The imaginary part <math>b\mathbf{i} + c\mathbf{j} + d\mathbf{k}</math> of a quaternion behaves like a vector <math>\vec{v} = (b,c,d)</math> in three dimension vector space, and the real part {{mvar|a}} behaves like a [[scalar (mathematics)|scalar]] in {{math|'''R'''}}. When quaternions are used in geometry, it is more convenient to define them as [[Classical Hamiltonian quaternions#Quaternion|a scalar plus a vector]]:
: <math>a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k} = a + \vec{v}</math>.
Those who have studied vectors at school might find it strange to add a ''number'' to a ''vector'', as they are objects of very different natures, or to ''multiply'' two vectors together, as this operation is usually undefined. However, if one remembers that it is a mere notation for the real and imaginary parts of a quaternion, it becomes more legitimate. In other words, the correct reasoning is the addition of two quaternions, one with zero vector/imaginary part, and another one with zero scalar/real part:
: <math>a + \vec{v} = (a + \vec{0}) + (0 + \vec{v})</math>.
 
We can express quaternion multiplication in the modern language of vector [[cross product|cross]] and [[dot product]]s (which were actually inspired by the quaternions in the first place {{Citation needed|date=June 2011}}). In place of the rules {{math|1='''i'''<sup>2</sup> = '''j'''<sup>2</sup> = '''k'''<sup>2</sup> = '''ijk''' = −1}} we have the quaternion multiplication rule:
: <math>\vec{v} \vec{w} = \vec{v} \times \vec{w} - \vec{v} \cdot \vec{w},</math>
where:
* <math>\vec{v} \vec{w}</math> is the resulting quaternion,
* <math>\vec{v} \times \vec{w}</math> is vector cross product (a vector),
* <math>\vec{v} \cdot \vec{w}</math> is vector scalar product (a scalar).
 
Quaternion multiplication is noncommutative (because of the cross product, which anti-commutes), while scalar–scalar and scalar–vector multiplications commute. From these rules it follows immediately that ([[Quaternions#Quaternions_and_the_geometry_of_R3|see details]]):
: <math>(s + \vec{v}) (t + \vec{w}) = (s t - \vec{v} \cdot \vec{w}) + (s \vec{w} + t \vec{v} + \vec{v} \times \vec{w})</math>.
 
The (left and right) multiplicative inverse or reciprocal of a nonzero quaternion is given by the conjugate-to-norm ratio ([[Quaternion#Conjugation.2C_the_norm.2C_and_reciprocal|see details]]):
: <math>(s + \vec{v})^{-1} = \frac{(s + \vec{v})^*}{\lVert s + \vec{v} \rVert^2} = \frac{s - \vec{v}}{s^2 + \lVert \vec{v} \rVert^2}</math>,
as can be verified by direct calculation.
 
===Proof of the quaternion rotation identity===
 
Let <math>\vec{u}</math> be a unit vector (the rotation axis) and let <math>q = \cos \frac{\alpha}{2} + \vec{u} \sin \frac{\alpha}{2}</math>. Our goal is to show that
:<math>\vec{v'} = q \vec{v} q^{-1} = \left( \cos \frac{\alpha}{2} + \vec{u} \sin \frac{\alpha}{2} \right) \, \vec{v} \, \left( \cos \frac{\alpha}{2} - \vec{u} \sin \frac{\alpha}{2} \right)</math>
yields the vector <math>\vec{v}</math> rotated by an angle <math>\alpha</math> around the axis <math>\vec{u}</math>. Expanding out, we have
:<math>\begin{array}{lll}
\vec{v'} &=& \vec{v} \cos^2 \frac{\alpha}{2} + (\vec{u}\vec{v} - \vec{v}\vec{u}) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \vec{u}\vec{v}\vec{u} \sin^2 \frac{\alpha}{2} \\
&=& \vec{v} \cos^2 \frac{\alpha}{2} + 2 (\vec{u} \times \vec{v}) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - (\vec{v} (\vec{u} \cdot \vec{u}) - 2 \vec{u} (\vec{u} \cdot \vec{v})) \sin^2 \frac{\alpha}{2} \\
&=& \vec{v} (\cos^2 \frac{\alpha}{2} - \sin^2 \frac{\alpha}{2}) + (\vec{u} \times \vec{v}) (2 \sin \frac{\alpha}{2} \cos \frac{\alpha}{2}) + \vec{u} (\vec{u} \cdot \vec{v}) (2 \sin^2 \frac{\alpha}{2}) \\
&=& \vec{v} \cos \alpha + (\vec{u} \times \vec{v}) \sin \alpha + \vec{u} (\vec{u} \cdot \vec{v}) (1 - \cos \alpha) \\
&=& (\vec{v} - \vec{u} (\vec{u} \cdot \vec{v})) \cos \alpha + (\vec{u} \times \vec{v}) \sin \alpha + \vec{u} (\vec{u} \cdot \vec{v}) \\
&=& \vec{v}_{\bot} \cos \alpha + (\vec{u} \times \vec{v}_{\bot}) \sin \alpha + \vec{v}_{\|}
\end{array}</math>
where <math>\vec{v}_{\bot}</math> and <math>\vec{v}_{\|}</math> are the components of {{vec|''v''}} perpendicular and parallel to {{vec|''u''}} respectively. This is the [[Rodrigues' rotation formula|formula of a rotation]] by {{mvar|&alpha;}} around the {{vec|''u''}} axis.
 
== Quaternion rotation operations ==
 
A very formal explanation of the properties used in this section is given by Altman.<ref>Simon L. Altman (1986) ''Rotations, Quaternions, and Double Groups'', Dover Publications (see especially Ch. 12).</ref>
 
===The hypersphere of rotations===
{{main|Rotation group SO(3)}}
====Visualizing the space of rotations====
Unit quaternions represent the [[group (mathematics)|group]] of Euclidean [[rotation (mathematics)|rotations]] in [[three-dimensional space|three dimensions]] in a very straightforward way. The correspondence between rotations and quaternions can be understood by first visualizing the space of rotations itself.
 
[[File:Space of rotations.png|250px|thumb|right|Two rotations by different angles and different axes in the space of rotations. The length of the vector is related to the magnitude of the rotation.]]
 
In order to visualize the space of rotations, it helps to consider a simpler case. Any rotation in three dimensions can be described by a rotation by some [[Angle of rotation|angle]] about some [[Axis of rotation|axis]]; for our purposes, we will use an axis ''vector'' to establish [[Orientation (vector space)|handedness]] for our angle. Consider the special case in which the axis of rotation lies in the ''xy'' plane. We can then specify the axis of one of these rotations by a point on a circle through which the vector crosses, and we can select the radius of the circle to denote the [[angle of rotation]]. Similarly, a rotation whose axis of rotation lies in the ''xy'' plane can be described as a point on a sphere of ''fixed'' radius in ''three'' dimensions. Beginning at the north pole of a sphere in three dimensional space, we specify the point at the north pole to be the identity rotation (a zero angle rotation). Just as in the case of the identity rotation, no axis of rotation is defined, and the angle of rotation (zero) is irrelevant. A rotation having a very small rotation angle can be specified by a slice through the sphere parallel to the ''xy'' plane and very near the north pole. The circle defined by this slice will be very small, corresponding to the small angle of the rotation. As the rotation angles become larger, the slice moves in the negative ''z'' direction, and the circles become larger until the equator of the sphere is reached, which will correspond to a rotation angle of 180 degrees. Continuing southward, the radii of the circles now become smaller (corresponding to the absolute value of the angle of the rotation considered as a negative number). Finally, as the south pole is reached, the circles shrink once more to the identity rotation, which is also specified as the point at the south pole.
 
Notice that a number of characteristics of such rotations and their representations can be seen by this visualization. The space of rotations is continuous, each rotation has a neighborhood of rotations which are nearly the same, and this neighborhood becomes flat as the neighborhood shrinks. Also, each rotation is actually represented by two antipodal points on the sphere, which are at opposite ends of a line through the center of the sphere. This reflects the fact that each rotation can be represented as a rotation about some axis, or, equivalently, as a negative rotation about an axis pointing in the opposite direction (a so-called [[Double covering group|double cover]]). The "latitude" of a circle representing a particular rotation angle will be half of the angle represented by that rotation, since as the point is moved from the north to south pole, the latitude ranges from zero to 180 degrees, while the angle of rotation ranges from 0 to 360 degrees. (the "longitude" of a point then represents a particular axis of rotation.) Note however that this set of rotations is not closed under composition. Two successive rotations with axes in the ''xy'' plane will not necessarily give a rotation whose axis lies in the ''xy'' plane, and thus cannot be represented as a point on the sphere. This will not be the case with a general rotation in 3-space, in which rotations do form a closed set under composition.
 
[[File:Hypersphere of rotations.png|250px|thumb|right|The sphere of rotations for the rotations that have a "horizontal" axis (in the ''xy'' plane).]]
 
This visualization can be extended to a general rotation in 3-dimensional space. The identity rotation is a point, and a small angle of rotation about some axis can be represented as a point on a sphere with a small radius. As the angle of rotation grows, the sphere grows, until the angle of rotation reaches 180 degrees, at which point the sphere begins to shrink, becoming a point as the angle approaches 360 degrees (or zero degrees from the negative direction). This set of expanding and contracting spheres represents a [[3-sphere|hypersphere in four dimensional space]] (a 3-sphere). Just as in the simpler example above, each rotation represented as a point on the hypersphere is matched by its antipodal point on that hypersphere. The "latitude" on the hypersphere will be half of the corresponding angle of rotation, and the neighborhood of any point will become "flatter" (i.e. be represented by a 3-D Euclidean space of points) as the neighborhood shrinks. This behavior is matched by the set of unit quaternions: A general quaternion represents a point in a four dimensional space, but constraining it to have unit magnitude yields a three dimensional space equivalent to the surface of a hypersphere. The magnitude of the unit quaternion will be unity, corresponding to a hypersphere of unit radius. The vector part of a unit quaternion represents the radius of the 2-sphere corresponding to the axis of rotation, and its magnitude is the cosine of half the angle of rotation. Each rotation is represented by two unit quaternions of opposite sign, and, as in the space of rotations in three dimensions, the quaternion product of two unit quaternions will yield a unit quaternion. Also, the space of unit quaternions is "flat" in any infinitesimal neighborhood of a given unit quaternion.
 
====Parameterizing the space of rotations====
We can parameterize the surface of a sphere with two coordinates, such as latitude and longitude. But latitude and longitude are ill-behaved ([[degeneracy (mathematics)|degenerate]]) at the north and south poles, though the poles are not intrinsically different from any other points on the sphere. At the poles (latitudes +90° and −90°), the longitude becomes meaningless.
 
It can be shown that no two-parameter coordinate system can avoid such degeneracy. We can avoid such problems by embedding the sphere in three-dimensional space and parameterizing it with three Cartesian coordinates {{math|(''w'', ''x'', ''y'')}}, placing the north pole at {{math|1=(''w'', ''x'', ''y'') = (1, 0, 0)}}, the south pole at {{math|1=(''w'', ''x'', ''y'') = (−1, 0, 0)}}, and the equator at {{math|1=''w'' = 0}}, {{math|1=''x''<sup>2</sup> + ''y''<sup>2</sup> = 1}}. Points on the sphere satisfy the constraint {{math|1=''w''<sup>2</sup> + ''x''<sup>2</sup> + ''y''<sup>2</sup> = 1}}, so we still have just two [[degrees of freedom (physics and chemistry)|degrees of freedom]] though there are three coordinates. A point {{math|(''w'', ''x'', ''y'')}} on the sphere represents a rotation in the ordinary space around the horizontal axis directed by the vector {{math|(''x'', ''y'', 0)}} by an angle <math>\alpha= 2 \cos^{-1} w = 2 \sin^{-1} \sqrt{x^2+y^2}</math>.
 
In the same way the hyperspherical space of 3D rotations can be parameterized by three angles ([[Euler angles]]), but any such parameterization is degenerate at some points on the hypersphere, leading to the problem of [[gimbal lock]]. We can avoid this by using four Euclidean coordinates {{math|''w'', ''x'', ''y'', ''z''}}, with {{math|1=''w''<sup>2</sup> + ''x''<sup>2</sup> + ''y''<sup>2</sup> + ''z''<sup>2</sup> = 1}}. The point {{math|(''w'', ''x'', ''y'', ''z'')}} represents a rotation around the axis directed by the vector {{math|(''x'', ''y'', ''z'')}} by an angle <math>\alpha = 2 \cos^{-1} w = 2 \sin^{-1} \sqrt{x^2+y^2+z^2}.</math>
 
== Explaining quaternions' properties with rotations ==
 
=== Non-commutativity ===
 
The multiplication of quaternions is [[non-commutative]]. This fact explains how the {{math|'''p''' ↦ '''q p q'''<sup>−1</sup>}} formula can work at all, having {{math|1='''q q'''<sup>[[multiplicative inverse|−1]]</sup> = 1}} by definition. Since the multiplication of unit quaternions corresponds to the composition of three dimensional rotations, this property can be made intuitive by showing that three dimensional rotations are not commutative in general.
 
Set two books next to each other. Rotate one of them 90&nbsp;degrees clockwise around the ''z'' axis, then flip it 180&nbsp;degrees around the ''x'' axis. Take the other book, flip it 180° around ''x'' axis first, and 90° clockwise around ''z'' later. The two books do not end up parallel. This shows that, in general, the composition of two different rotations around two distinct spatial axes will not commute.
 
=== Orientation ===
 
The [[vector cross product]], used to define the axis–angle representation, does confer an [[orientation (vector space)|orientation]] ("handedness") to space: in a three-dimensional vector space, the three vectors in the equation {{math|1='''a''' × '''b''' = '''c'''}} will always form a right-handed set (or a left-handed set, depending on how the cross product is defined), thus fixing an orientation in the vector space. Alternatively, the dependence on orientation is expressed in referring to such {{mvec|''u''}} that specifies a rotation as to ''[[axial vector]]s''. In quaternionic formalism the choice of an orientation of the space corresponds to order of multiplication: {{math|1='''ij''' = '''k'''}} but {{math|1='''ji''' = −'''k'''}}. If one reverses the orientation, then the formula above becomes {{math|'''p''' ↦ '''q'''<sup>−1</sup> '''p q'''}}, i.e. a unit {{math|'''q'''}} is replaced with the conjugate quaternion – the same behaviour as of axial vectors.
 
== Comparison with other representations of rotations ==
 
=== Advantages of quaternions ===
 
The representation of a rotation as a quaternion (4 numbers) is more compact than the representation as an [[orthogonal matrix]] (9 numbers).  Furthermore, for a given axis and angle, one can easily construct the corresponding quaternion, and conversely, for a given quaternion one can easily read off the axis and the angle.  Both of these are much harder with matrices or [[Euler angles]].
 
In [[video game]]s and other applications, one is often interested in “smooth rotations”, meaning that the scene should slowly rotate and not in a single step.  This can be accomplished by choosing a [[curve]] such as the [[slerp|spherical linear interpolation]] in the quaternions, with one endpoint being the identity transformation 1 (or some other initial rotation) and the other being the intended final rotation.  This is more problematic with other representations of rotations.
 
When composing several rotations on a computer, rounding errors necessarily accumulate.  A quaternion that’s slightly off still represents a rotation after being normalised: a matrix that’s slightly off may not be [[Orthogonal matrix|orthogonal]] anymore and is harder to convert back to a proper orthogonal matrix.
 
Quaternions also avoid a phenomenon called [[gimbal lock]] which can result when, for example in [[flight dynamics|pitch/yaw/roll rotational systems]], the pitch is rotated 90° up or down, so that yaw and roll then correspond to the same motion, and a degree of freedom of rotation is lost. In a [[gimbal]]-based aerospace inertial navigation system, for instance, this could have disastrous results if the aircraft is in a steep dive or ascent.
 
=== Conversion to and from the matrix representation ===
 
==== From a quaternion to an orthogonal matrix ====
 
The [[orthogonal matrix]] corresponding to a rotation by the unit quaternion {{math|1='''z''' = ''a'' + ''b'' '''i''' + ''c'' '''j''' + ''d'' '''k'''}} (with {{math|1={{abs| '''z''' }} = 1}}) when post-multiplying with a column vector is given by
:<math>\begin{pmatrix}
a^2+b^2-c^2-d^2&2bc-2ad        &2bd+2ac        \\
2bc+2ad        &a^2-b^2+c^2-d^2&2cd-2ab        \\
2bd-2ac        &2cd+2ab        &a^2-b^2-c^2+d^2\\
\end{pmatrix}.</math>
 
==== From an orthogonal matrix to a quaternion ====
 
One must be careful when converting a rotation matrix to a quaternion, as several straightforward methods tend to be unstable when the [[Trace (linear algebra)|trace]] (sum of the diagonal elements) of the rotation matrix is zero or very small. For a stable method of converting an orthogonal matrix to a quaternion, see [[Rotation matrix #Quaternion]].
 
==== Fitting quaternions ====
The above section described how to recover a quaternion {{math|'''q'''}} from a {{gaps|3|×|3}} [[rotation matrix]] {{mvar|Q}}. Suppose, however, that we have some matrix {{mvar|Q}} that is not a pure rotation—due to [[round-off error]]s, for example—and we wish to find the quaternion {{math|'''q'''}} that most accurately represents {{mvar|Q}}. In that case we construct a symmetric {{gaps|4|×|4}} matrix
:<math> K = \frac13
\begin{bmatrix}
  Q_{xx}-Q_{yy}-Q_{zz} & Q_{yx}+Q_{xy} & Q_{zx}+Q_{xz} & Q_{yz}-Q_{zy} \\
  Q_{yx}+Q_{xy} & Q_{yy}-Q_{xx}-Q_{zz} & Q_{zy}+Q_{yz} & Q_{zx}-Q_{xz} \\
  Q_{zx}+Q_{xz} & Q_{zy}+Q_{yz} & Q_{zz}-Q_{xx}-Q_{yy} & Q_{xy}-Q_{yx} \\
  Q_{yz}-Q_{zy} & Q_{zx}-Q_{xz} & Q_{xy}-Q_{yx} & Q_{xx}+Q_{yy}+Q_{zz}
\end{bmatrix} ,
</math>
and find the [[eigenvector]] {{math|(''x'', ''y'', ''z'', ''w'')}} corresponding to the largest eigenvalue (that value will be 1 if and only if {{mvar|Q}} is a pure rotation). The quaternion so obtained will correspond to the rotation closest to the original matrix {{mvar|Q}}  {{Dubious|date=December 2009}}<ref>{{Citation
| last=Bar-Itzhack
| first=Itzhack Y.
| author-link=
|date=Nov–Dec 2000
| title=New method for extracting the quaternion from a rotation matrix
| journal=AIAA Journal of Guidance, Control and Dynamics
| volume=23
| issue=6
| pages=1085
| issn=0731-5090
| doi=10.2514/2.4654
}}</ref>
 
=== Performance comparisons ===
This section discusses the performance implications of using quaternions versus other methods (axis/angle or rotation matrices) to perform rotations in 3D.
 
==== Results ====
 
{| class="wikitable"
|+ Storage requirements
|-
!                Method                        !! Storage
|-
| [[Rotation matrix]]                          ||    9
|-
|    [[Quaternion]]                            ||    4
|-
| [[Axis-angle representation|Angle/axis]] ||    3*
|}
 
<nowiki>*</nowiki> Note: angle/axis can be stored as 3 elements by multiplying the unit rotation axis by half of the rotation angle, forming the logarithm of the quaternion, at the cost of additional calculations.
 
{| class="wikitable"
|+ Performance comparison of rotation chaining operations
|-
!                Method                !! # multiplies !! # add/subtracts !! total operations
|-
| Rotation matrices ||      27    ||      18        || 45
|-
|              Quaternions          ||      16    ||      12        || 28
|}
 
{| class="wikitable"
|+ Performance comparison of vector rotating operations
|-
!        Method      !! # multiplies !! # add/subtracts !! # sin/cos !! total operations
|-
| Rotation matrix ||      9      ||        6      || 0        || 15
|-
|    Quaternions  ||      15    ||      15    || 0        || 30
|-
| Angle/axis || 23 || 16 || 2    || 41
|}
 
==== Used methods ====
 
There are three basic approaches to rotating a vector {{vec|''v''}}:
# Compute the matrix product of a 3&#8201;×&#8201;3 [[rotation matrix]] {{mvar|R}} and the original 3&#8201;×&#8201;1 [[column vector|column]] matrix representing {{vec|''v''}}. This requires 3 × (3 multiplications + 2 additions) = 9 multiplications and 6 additions, the most efficient method for rotating a vector.
# A rotation can be represented by a unit-length quaternion {{math|1='''q''' = (''w'', {{vec|''r''}})}} with scalar (real) part {{mvar|w}} and vector (imaginary) part {{vec|''r''}}. The rotation can be applied to a 3D vector {{vec|''v''}} via the formula <math> \vec{v}_\text{new}=\vec{v} + 2\vec{r} \times (\vec{r} \times \vec{v} + w \vec{v})</math>. This requires only 15 multiplications and 15 additions to evaluate (or 18 muls and 12 adds if the factor of 2 is done via multiplication.) This yields the same result as the less efficient but more compact formula <math> \vec{v}_\text{new} = q \vec{v} q^{-1}</math>.
# Use the [[Rotation matrix#Angle-Axis representation and quaternion representation|angle/axis formula]] to convert an angle/axis to a [[rotation matrix]] {{mvar|R}} then multiplying with a vector. Converting the angle/axis to {{mvar|R}} using [[common subexpression elimination]] costs 14 multiplies, 2 function calls (sin, cos), and 10 add/subtracts; from item 1, rotating using {{mvar|R}} adds an additional 9 multiplications and 6 additions for a total of 23 multiplies, 16 add/subtracts, and 2 function calls (sin, cos).
 
== Pairs of unit quaternions as rotations in 4D space ==
 
A pair of unit quaternions {{math|'''z'''<sub>l</sub>}} and {{math|'''z'''<sub>r</sub>}} can represent any [[Rotations in 4-dimensional Euclidean space|rotation in 4D space]]. Given a four dimensional vector {{vec|''v''}}, and pretending that it is a quaternion, we can rotate the vector {{vec|''v''}} like this:
 
:<math>f(\vec{v})=\mathbf{z}_{\rm{l}} \vec{v} \mathbf{z}_{\rm{r}}=
\begin{pmatrix}
a_{\rm{l}}&-b_{\rm{l}}&-c_{\rm{l}}&-d_{\rm{l}}\\
b_{\rm{l}}&a_{\rm{l}}&-d_{\rm{l}}&c_{\rm{l}}\\
c_{\rm{l}}&d_{\rm{l}}&a_{\rm{l}}&-b_{\rm{l}}\\
d_{\rm{l}}&-c_{\rm{l}}&b_{\rm{l}}&a_{\rm{l}}
\end{pmatrix}\begin{pmatrix}
a_{\rm{r}}&-b_{\rm{r}}&-c_{\rm{r}}&-d_{\rm{r}}\\
b_{\rm{r}}&a_{\rm{r}}&d_{\rm{r}}&-c_{\rm{r}}\\
c_{\rm{r}}&-d_{\rm{r}}&a_{\rm{r}}&b_{\rm{r}}\\
d_{\rm{r}}&c_{\rm{r}}&-b_{\rm{r}}&a_{\rm{r}}
\end{pmatrix}\begin{pmatrix}
w\\x\\y\\z
\end{pmatrix}.
</math>
 
 
It is straightforward to check that for each matrix: {{math|''M M''}}<sup>T<!-- may not be serif! --></sup>{{math|1= = [[identity matrix|''I'']]}}, that is, that each matrix (and hence both matrices together) represents a rotation. Note that since <math>(\mathbf{z}_{\rm{l}} \vec{v}) \mathbf{z}_{\rm{r}} = \mathbf{z}_{\rm{l}} (\vec{v} \mathbf{z}_{\rm{r}})</math>, the two matrices must commute. Therefore, there are two commuting subgroups of the set of four dimensional rotations. Arbitrary four dimensional rotations have 6 degrees of freedom, each matrix represents 3 of those 6 degrees of freedom.
 
Since an [[infinitesimal]] four-dimensional rotation can be represented by a pair of quaternions (as follows), all (non-infinitesimal) four-dimensional rotations can also be represented.
 
:<math>\mathbf{z}_{\rm{l}} \vec{v} \mathbf{z}_{\rm{r}} = \begin{pmatrix}
1      &-dt_{ab}&-dt_{ac}&-dt_{ad}\\
dt_{ab}&1      &-dt_{bc}&-dt_{bd}\\
dt_{ac}& dt_{bc}&1      &-dt_{cd}\\
dt_{ad}& dt_{bd}& dt_{cd}&1
\end{pmatrix}\begin{pmatrix}
w\\
x\\
y\\
z
\end{pmatrix}
</math>
 
:<math>\mathbf{z}_{\rm{l}}=
1+{dt_{ab}+dt_{cd}\over 2}i+{dt_{ac}-dt_{bd}\over 2}j+{dt_{ad}+dt_{bc}\over 2}k
</math>
 
:<math>\mathbf{z}_{\rm{r}}=
1+{dt_{ab}-dt_{cd}\over 2}i+{dt_{ac}+dt_{bd}\over 2}j+{dt_{ad}-dt_{bc}\over 2}k
</math>
 
== See also ==
*[[Anti-twister mechanism]]
*[[Binary polyhedral group]]
*[[Biquaternion]]
*[[Charts on SO(3)]]
*[[Clifford algebra]]s
*[[Conversion between quaternions and Euler angles]]
*[[Covering space]]
*[[Dual quaternion]]
*[[Elliptic geometry#Elliptic space]]
*[[Rotation formalisms in three dimensions]]
*[[Rotation (mathematics)]]
*[[Spin group]]
*[[Slerp]], spherical linear interpolation
*[[Olinde Rodrigues]]
*[[William Rowan Hamilton]]
 
== References ==
{{Reflist}}
E. P. Battey-Pratt & T. J. Racey (1980) Geometric Model for Fundamental Particles ''International Journal of Theoretical Physics. Vol 19, No. 6''
 
== External links and resources ==
*[http://www.cs.caltech.edu/courses/cs171/quatut.pdf Shoemake, Ken. Quaternions]
*[http://rosettacode.org/wiki/Simple_Quaternion_type_and_operations Simple Quaternion type and operations in over thirty computer languages] on [[Rosetta Code]]
*[http://graphics.stanford.edu/courses/cs348c-95-fall/software/quatdemo/ Hart, Francis, Kauffman. Quaternion demo]
*[http://www.diku.dk/publikationer/tekniske.rapporter/1998/98-5.ps.gz Dam, Koch, Lillholm. Quaternions, Interpolation and Animation]
*[http://www.cs.unc.edu/techreports/01-014.pdf Vicci, Leandra. Quaternions and Rotations in 3-Space: The Algebra and its Geometric Interpretation]
*[http://world.std.com/~sweetser/quaternions/ps/cornellcstr75-245.pdf Howell, Thomas and Lafon, Jean-Claude. The Complexity of the Quaternion Product, TR75-245, Cornell University, 1975]
*[http://people.csail.mit.edu/bkph/articles/Quaternions.pdf Berthold K.P. Horn. Some Notes on Unit Quaternions and Rotation].
 
[[Category:Quaternions]]
[[Category:Rotation in three dimensions]]
[[Category:3D computer graphics]]

Revision as of 03:35, 12 February 2014

The best hemorrhoid treatment is prevention. The problem is most individuals do not think about preventing hemorrhoids until they find themselves afflicted with them.

If you have been seeing blood on the toilet paper, you're possibly in the late stages of the condition plus need a surprisingly efficient prolapsed hemorrhoid treatment.

If the itch is driving we crazy, try extract of Echinacea on a cotton wool ball. Apply it straight to the area. This will bring you relief from this certainly irritating symptom and ease the pain too. Echinacea can be purchased at the regional wellness food store.

If you find going to the toilet for a bowel movement extremely difficult think about a stool softener. These can work well plus minimize the need for straining. These is purchased conveniently over the counter and is very powerful. If you would like something a little more all-natural we may need to think about eating prunes or drinking prune juice.

There are many factors which lead with all the bleeding of the hemorrhoid. One of them is the being constipated. With this, it is actually significant that you must change a diet. If you use to consume those processed plus fatty foods, then it is time to change those foods and begin eating foods that are rich inside fibers. There are many foods that are rich in fibers like fruits, vegetable and entire wheat bread. This may assist you remedy the constipation plus at the same time do away with your hemorrhoid. But if you find this treatment ineffective then we have to start searching for another treatment. You may ask the doctor regarding it plus ask for a greater remedy.

Step 5 - Consume Sufficient Fiber. Your mother will possibly have told we this when a kid and today you'll understand it's correct. Not consuming an adequate amount of fiber may the fact is result constipation and harder stools. A excellent fiber diet can assist to avert flare ups plus keep the stools soft. Fresh fruits, veggies, beans plus peanut butter are all splendid sources of fiber to help keep we usual.

Depending on the severerity of the symptom, some advertised their hemorrhoids were cure in 48 hours. I have tried it plus they are quite safe plus has no side effect as they use all-natural ingredience.