text:
# Quaternions and spatiaw rotation

Unit qwaternions, awso known as versors, provide a convenient madematicaw notation for representing orientations and rotations of objects in dree dimensions. Compared to Euwer angwes dey are simpwer to compose and avoid de probwem of gimbaw wock. Compared to rotation matrices dey are more compact, more numericawwy stabwe, and more efficient. Quaternions have appwications in computer graphics,[1] computer vision, robotics,[2] navigation, mowecuwar dynamics, fwight dynamics,[3] orbitaw mechanics of satewwites[4] and crystawwographic texture anawysis.[5]

When used to represent rotation, unit qwaternions are awso cawwed rotation qwaternions as dey represent de 3D rotation group. When used to represent an orientation (rotation rewative to a reference coordinate system), dey are cawwed orientation qwaternions or attitude qwaternions. The eqwation for spatiaw rotations can be summarized for θ radians about a unit axis ${\dispwaystywe (X,Y,Z)}$ as de Quaternion ${\dispwaystywe (C,X*S,Y*S,Z*S)}$ where ${\dispwaystywe C=\cos(\deta /2)}$ and ${\dispwaystywe S=\sin(\deta /2)}$.

## Introduction

### Quaternions

The compwex numbers can be defined by introducing an abstract symbow i which satisfies de usuaw ruwes of awgebra and additionawwy de ruwe i2 = −1. This is sufficient to reproduce aww of de ruwes of compwex number aridmetic: for exampwe:

${\dispwaystywe (a+b\madbf {i} )(c+d\madbf {i} )=ac+ad\madbf {i} +b\madbf {i} c+b\madbf {i} d\madbf {i} =ac+ad\madbf {i} +bc\madbf {i} +bd\madbf {i} ^{2}=(ac-bd)+(bc+ad)\madbf {i} .}$

In de same way de qwaternions can be defined by introducing abstract symbows i, j, k which satisfy de ruwes i2 = j2 = k2 = i j k = −1 and de usuaw awgebraic ruwes except de commutative waw of muwtipwication (a famiwiar exampwe of such a noncommutative muwtipwication is matrix muwtipwication). From dis aww of de ruwes of qwaternion aridmetic fowwow, such as de ruwes on muwtipwication of qwaternion basis ewements. Using dese ruwes, one can show dat:

${\dispwaystywe (a+b\madbf {i} +c\madbf {j} +d\madbf {k} )(e+f\madbf {i} +g\madbf {j} +h\madbf {k} )=}$

${\dispwaystywe (ae-bf-cg-dh)+(af+be+ch-dg)\madbf {i} +(ag-bh+ce+df)\madbf {j} +(ah+bg-cf+de)\madbf {k} .}$

The imaginary part ${\dispwaystywe b\madbf {i} +c\madbf {j} +d\madbf {k} }$ of a qwaternion behaves wike a vector ${\dispwaystywe {\vec {v}}=(b,c,d)}$ in dree dimension vector space, and de reaw part a behaves wike a scawar in R. When qwaternions are used in geometry, it is more convenient to define dem as a scawar pwus a vector:

${\dispwaystywe a+b\madbf {i} +c\madbf {j} +d\madbf {k} =a+{\vec {v}}.}$

Those who have studied vectors at schoow might find it strange to add a number to a vector, as dey are objects of very different natures, or to muwtipwy two vectors togeder, as dis operation is usuawwy undefined. However, if one remembers dat it is a mere notation for de reaw and imaginary parts of a qwaternion, it becomes more wegitimate. In oder words, de correct reasoning is de addition of two qwaternions, one wif zero vector/imaginary part, and anoder one wif zero scawar/reaw part:

${\dispwaystywe a+{\vec {v}}=(a,{\vec {0}})+(0,{\vec {v}}).}$

We can express qwaternion muwtipwication in de modern wanguage of vector cross and dot products (which were actuawwy inspired by de qwaternions in de first pwace [6]). When muwtipwying de vector/imaginary parts, in pwace of de ruwes i2 = j2 = k2 = ijk = −1 we have de qwaternion muwtipwication ruwe:

${\dispwaystywe {\vec {v}}{\vec {w}}={\vec {v}}\times {\vec {w}}-{\vec {v}}\cdot {\vec {w}},}$

where:

• ${\dispwaystywe {\vec {v}}{\vec {w}}}$ is de resuwting qwaternion,
• ${\dispwaystywe {\vec {v}}\times {\vec {w}}}$ is vector cross product (a vector),
• ${\dispwaystywe {\vec {v}}\cdot {\vec {w}}}$ is vector scawar product (a scawar).

Quaternion muwtipwication is noncommutative (because of de cross product, which anti-commutes), whiwe scawar–scawar and scawar–vector muwtipwications commute. From dese ruwes it fowwows immediatewy dat (see detaiws):

${\dispwaystywe (s+{\vec {v}})(t+{\vec {w}})=(st-{\vec {v}}\cdot {\vec {w}})+(s{\vec {w}}+t{\vec {v}}+{\vec {v}}\times {\vec {w}}).}$

The (weft and right) muwtipwicative inverse or reciprocaw of a nonzero qwaternion is given by de conjugate-to-norm ratio (see detaiws):

${\dispwaystywe (s+{\vec {v}})^{-1}={\frac {(s+{\vec {v}})^{*}}{\wVert s+{\vec {v}}\rVert ^{2}}}={\frac {s-{\vec {v}}}{s^{2}+\wVert {\vec {v}}\rVert ^{2}}},}$

as can be verified by direct cawcuwation, uh-hah-hah-hah.

### Proof of de qwaternion rotation identity

Let ${\dispwaystywe {\vec {u}}}$ be a unit vector (de rotation axis) and wet ${\dispwaystywe q=\cos {\frac {\awpha }{2}}+{\vec {u}}\sin {\frac {\awpha }{2}}}$. Our goaw is to show dat

${\dispwaystywe {\vec {v'}}=q{\vec {v}}q^{-1}=\weft(\cos {\frac {\awpha }{2}}+{\vec {u}}\sin {\frac {\awpha }{2}}\right)\,{\vec {v}}\,\weft(\cos {\frac {\awpha }{2}}-{\vec {u}}\sin {\frac {\awpha }{2}}\right)}$

yiewds de vector ${\dispwaystywe {\vec {v}}}$ rotated by an angwe ${\dispwaystywe \awpha }$ around de axis ${\dispwaystywe {\vec {u}}}$. Expanding out, we have

${\dispwaystywe {\begin{awigned}{\vec {v'}}&={\vec {v}}\cos ^{2}{\frac {\awpha }{2}}+({\vec {u}}{\vec {v}}-{\vec {v}}{\vec {u}})\sin {\frac {\awpha }{2}}\cos {\frac {\awpha }{2}}-{\vec {u}}{\vec {v}}{\vec {u}}\sin ^{2}{\frac {\awpha }{2}}\\[6pt]&={\vec {v}}\cos ^{2}{\frac {\awpha }{2}}+2({\vec {u}}\times {\vec {v}})\sin {\frac {\awpha }{2}}\cos {\frac {\awpha }{2}}-({\vec {v}}({\vec {u}}\cdot {\vec {u}})-2{\vec {u}}({\vec {u}}\cdot {\vec {v}}))\sin ^{2}{\frac {\awpha }{2}}\\[6pt]&={\vec {v}}(\cos ^{2}{\frac {\awpha }{2}}-\sin ^{2}{\frac {\awpha }{2}})+({\vec {u}}\times {\vec {v}})(2\sin {\frac {\awpha }{2}}\cos {\frac {\awpha }{2}})+{\vec {u}}({\vec {u}}\cdot {\vec {v}})(2\sin ^{2}{\frac {\awpha }{2}})\\[6pt]&={\vec {v}}\cos \awpha +({\vec {u}}\times {\vec {v}})\sin \awpha +{\vec {u}}({\vec {u}}\cdot {\vec {v}})(1-\cos \awpha )\\[6pt]&=({\vec {v}}-{\vec {u}}({\vec {u}}\cdot {\vec {v}}))\cos \awpha +({\vec {u}}\times {\vec {v}})\sin \awpha +{\vec {u}}({\vec {u}}\cdot {\vec {v}})\\[6pt]&={\vec {v}}_{\bot }\cos \awpha +({\vec {u}}\times {\vec {v}})\sin \awpha +{\vec {v}}_{\|}\end{awigned}}}$

where ${\dispwaystywe {\vec {v}}_{\bot }}$ and ${\dispwaystywe {\vec {v}}_{\|}}$ are de components of v perpendicuwar and parawwew to u respectivewy. This is de formuwa of a rotation by α around de u axis.

## Using qwaternion as rotations

A visuawization of a rotation represented by an Euwer axis and angwe.

In 3-dimensionaw space, according to Euwer's rotation deorem, any rotation or seqwence of rotations of a rigid body or coordinate system about a fixed point is eqwivawent to a singwe rotation by a given angwe θ about a fixed axis (cawwed de Euwer axis) dat runs drough de fixed point. The Euwer axis is typicawwy represented by a unit vector u. Therefore, any rotation in dree dimensions can be represented as a combination of a vector u and a scawar θ. Quaternions give a simpwe way to encode dis axis–angwe representation in four numbers, and can be used to appwy de corresponding rotation to a position vector, representing a point rewative to de origin in R3.

A Eucwidean vector such as (2, 3, 4) or (ax, ay, az) can be rewritten as 2 i + 3 j + 4 k or axi + ayj + azk, where i, j, k are unit vectors representing de dree Cartesian axes. A rotation drough an angwe of θ around de axis defined by a unit vector

${\dispwaystywe {\vec {u}}=(u_{x},u_{y},u_{z})=u_{x}\madbf {i} +u_{y}\madbf {j} +u_{z}\madbf {k} }$

can be represented by a qwaternion, uh-hah-hah-hah. This can be done using an extension of Euwer's formuwa:

${\dispwaystywe \madbf {q} =e^{{\frac {\deta }{2}}{(u_{x}\madbf {i} +u_{y}\madbf {j} +u_{z}\madbf {k} )}}=\cos {\frac {\deta }{2}}+(u_{x}\madbf {i} +u_{y}\madbf {j} +u_{z}\madbf {k} )\sin {\frac {\deta }{2}}}$

It can be shown dat de desired rotation can be appwied to an ordinary vector ${\dispwaystywe \madbf {p} =(p_{x},p_{y},p_{z})=p_{x}\madbf {i} +p_{y}\madbf {j} +p_{z}\madbf {k} }$ in 3-dimensionaw space, considered as a qwaternion wif a reaw coordinate eqwaw to zero, by evawuating de conjugation of p by q:

${\dispwaystywe \madbf {p'} =\madbf {q} \madbf {p} \madbf {q} ^{-1}}$

using de Hamiwton product, where p′ = (px′, py′, pz′) is de new position vector of de point after de rotation, uh-hah-hah-hah. In a programmatic impwementation, dis is achieved by constructing a qwaternion whose vector part is p and reaw part eqwaws zero and den performing de qwaternion muwtipwication, uh-hah-hah-hah. The vector part of de resuwting qwaternion is de desired vector p.

Madematicawwy, dis operation carries de set of aww "pure" qwaternions p (dose wif reaw part eqwaw to zero)—which constitute a 3-dimensionaw space among de qwaternions—into itsewf, by de desired rotation about de axis u, by de angwe θ. (Each reaw qwaternion is carried into itsewf by dis operation, uh-hah-hah-hah. But for de purpose of rotations in 3-dimensionaw space, we ignore de reaw qwaternions.)

The rotation is cwockwise if our wine of sight points in de same direction as u.

In dis instance, q is a unit qwaternion and

${\dispwaystywe \madbf {q} ^{-1}=e^{-{\frac {\deta }{2}}{(u_{x}\madbf {i} +u_{y}\madbf {j} +u_{z}\madbf {k} )}}=\cos {\frac {\deta }{2}}-(u_{x}\madbf {i} +u_{y}\madbf {j} +u_{z}\madbf {k} )\sin {\frac {\deta }{2}}.}$

It fowwows dat conjugation by de product of two qwaternions is de composition of conjugations by dese qwaternions: If p and q are unit qwaternions, den rotation (conjugation) by pq is

${\dispwaystywe \madbf {pq} {\vec {v}}(\madbf {pq} )^{-1}=\madbf {pq} {\vec {v}}\madbf {q} ^{-1}\madbf {p} ^{-1}=\madbf {p} (\madbf {q} {\vec {v}}\madbf {q} ^{-1})\madbf {p} ^{-1}}$,

which is de same as rotating (conjugating) by q and den by p. The scawar component of de resuwt is necessariwy zero.

The qwaternion inverse of a rotation is de opposite rotation, since ${\dispwaystywe \madbf {q} ^{-1}(\madbf {q} {\vec {v}}\madbf {q} ^{-1})\madbf {q} ={\vec {v}}}$. The sqware of a qwaternion rotation is a rotation by twice de angwe around de same axis. More generawwy qn is a rotation by n times de angwe around de same axis as q. This can be extended to arbitrary reaw n, awwowing for smoof interpowation between spatiaw orientations; see Swerp.

Two rotation qwaternions can be combined into one eqwivawent qwaternion by de rewation:

${\dispwaystywe \madbf {q} '=\madbf {q} _{2}\madbf {q} _{1}}$

in which q corresponds to de rotation q1 fowwowed by de rotation q2. (Note dat qwaternion muwtipwication is not commutative.) Thus, an arbitrary number of rotations can be composed togeder and den appwied as a singwe rotation, uh-hah-hah-hah.

### Exampwe

#### The conjugation operation

A rotation of 120° around de first diagonaw permutes i, j, and k cycwicawwy.

Conjugating p by q refers to de operation pqpq−1.

Consider de rotation f around de axis ${\dispwaystywe {\vec {v}}=\madbf {i} +\madbf {j} +\madbf {k} }$, wif a rotation angwe of 120°, or /3 radians.

${\dispwaystywe \awpha ={\dfrac {2\pi }{3}}}$
pq p for q = 1 + i + j + k/2 on de unit 3-sphere. Note dis one-sided (namewy, weft) muwtipwication yiewds a 60° rotation of qwaternions

The wengf of v is 3, de hawf angwe is π/3 (60°) wif cosine 1/2, (cos 60° = 0.5) and sine 3/2, (sin 60° ≈ 0.866). We are derefore deawing wif a conjugation by de unit qwaternion

${\dispwaystywe {\begin{array}{www}u&=&\cos {\dfrac {\awpha }{2}}+\sin {\dfrac {\awpha }{2}}\cdot {\dfrac {1}{\|{\vec {v}}\|}}{\vec {v}}\\&=&\cos {\dfrac {\pi }{3}}+\sin {\dfrac {\pi }{3}}\cdot {\dfrac {1}{\sqrt {3}}}{\vec {v}}\\&=&{\dfrac {1}{2}}+{\dfrac {\sqrt {3}}{2}}\cdot {\dfrac {1}{\sqrt {3}}}{\vec {v}}\\&=&{\dfrac {1}{2}}+{\dfrac {\sqrt {3}}{2}}\cdot {\dfrac {\madbf {i} +\madbf {j} +\madbf {k} }{\sqrt {3}}}\\&=&{\dfrac {1+\madbf {i} +\madbf {j} +\madbf {k} }{2}}\end{array}}}$

If f is de rotation function,

${\dispwaystywe f(a\madbf {i} +b\madbf {j} +c\madbf {k} )=u(a\madbf {i} +b\madbf {j} +c\madbf {k} )u^{-1}}$

It can be proven dat de inverse of a unit qwaternion is obtained simpwy by changing de sign of its imaginary components. As a conseqwence,

${\dispwaystywe u^{-1}={\dfrac {1-\madbf {i} -\madbf {j} -\madbf {k} }{2}}}$

and

${\dispwaystywe f(a\madbf {i} +b\madbf {j} +c\madbf {k} )={\dfrac {1+\madbf {i} +\madbf {j} +\madbf {k} }{2}}(a\madbf {i} +b\madbf {j} +c\madbf {k} ){\dfrac {1-\madbf {i} -\madbf {j} -\madbf {k} }{2}}}$

This can be simpwified, using de ordinary ruwes for qwaternion aridmetic, to

${\dispwaystywe f(a\madbf {i} +b\madbf {j} +c\madbf {k} )=c\madbf {i} +a\madbf {j} +b\madbf {k} }$

As expected, de rotation corresponds to keeping a cube hewd fixed at one point, and rotating it 120° about de wong diagonaw drough de fixed point (observe how de dree axes are permuted cycwicawwy).

### Quaternion-derived rotation matrix

A qwaternion rotation ${\dispwaystywe \madbf {p'} =\madbf {q} \madbf {p} \madbf {q} ^{-1}}$ (wif ${\dispwaystywe \madbf {q} =q_{r}+q_{i}\madbf {i} +q_{j}\madbf {j} +q_{k}\madbf {k} }$) can be awgebraicawwy manipuwated into a matrix rotation ${\dispwaystywe \madbf {p'} =\madbf {Rp} }$, where R is de rotation matrix given by:[7]

${\dispwaystywe {\begin{awigned}\madbf {R} &={\begin{bmatrix}1-2s(q_{j}^{2}+q_{k}^{2})&2s(q_{i}q_{j}-q_{k}q_{r})&2s(q_{i}q_{k}+q_{j}q_{r})\\2s(q_{i}q_{j}+q_{k}q_{r})&1-2s(q_{i}^{2}+q_{k}^{2})&2s(q_{j}q_{k}-q_{i}q_{r})\\2s(q_{i}q_{k}-q_{j}q_{r})&2s(q_{j}q_{k}+q_{i}q_{r})&1-2s(q_{i}^{2}+q_{j}^{2})\end{bmatrix}}\end{awigned}}}$

Here ${\dispwaystywe s=||q||^{-2}}$ and if q is a unit qwaternion, ${\dispwaystywe s=1}$

This can be obtained by using vector cawcuwus and winear awgebra if we express ${\dispwaystywe \madbf {p} }$ and ${\dispwaystywe \madbf {q} }$ as scawar and vector parts and use de formuwa for de muwtipwication operation in de eqwation ${\dispwaystywe \madbf {p'} =\madbf {q} \madbf {p} \madbf {q} ^{-1}}$. If we write ${\dispwaystywe \madbf {p} }$ as ${\dispwaystywe (0,\ \madbf {p} )}$, ${\dispwaystywe \madbf {p} '}$ as ${\dispwaystywe (0,\ \madbf {p} ')}$ and ${\dispwaystywe \madbf {q} }$ as ${\dispwaystywe (q_{r},\ \madbf {v} )}$, where ${\dispwaystywe \madbf {v} =(q_{i},q_{j},q_{k})}$, our eqwation turns into ${\dispwaystywe (0,\ \madbf {p} ')=(q_{r},\ \madbf {v} )(0,\ \madbf {p} )s(q_{r},\ -\madbf {v} )}$. By using de formuwa for muwtipwication of two qwaternions dat are expressed as scawar and vector parts,

${\dispwaystywe (r_{1},\ {\vec {v}}_{1})(r_{2},\ {\vec {v}}_{2})=(r_{1}r_{2}-{\vec {v}}_{1}\cdot {\vec {v}}_{2},\ r_{1}{\vec {v}}_{2}+r_{2}{\vec {v}}_{1}+{\vec {v}}_{1}\times {\vec {v}}_{2}),}$

dis eqwation can be rewritten as

${\dispwaystywe {\begin{awigned}(0,\ \madbf {p} ')=&\ ((q_{r},\ \madbf {v} )(0,\ \madbf {p} ))s(q_{r},\ -\madbf {v} )\\(0,\ \madbf {p} ')=&\ (q_{r}\times 0-\madbf {v} \cdot \madbf {p} ,\ q_{r}\madbf {p} +0\madbf {v} +\madbf {v} \times \madbf {p} )s(q_{r},\ -\madbf {v} )\\(0,\ \madbf {p} ')=&\ s(-\madbf {v} \cdot \madbf {p} ,\ q_{r}\madbf {p} +\madbf {v} \times \madbf {p} )(q_{r},\ -\madbf {v} )\\(0,\ \madbf {p} ')=&\ s(-\madbf {v} \cdot \madbf {p} q_{r}-(q_{r}\madbf {p} +\madbf {v} \times \madbf {p} )\cdot (-\madbf {v} ),\ (-\madbf {v} \cdot \madbf {p} )(-\madbf {v} )+q_{r}(q_{r}\madbf {p} +\madbf {v} \times \madbf {p} )+(q_{r}\madbf {p} +\madbf {v} \times \madbf {p} )\times (-\madbf {v} ))\\(0,\ \madbf {p} ')=&\ s(-\madbf {v} \cdot \madbf {p} q_{r}+q_{r}\madbf {v} \cdot \madbf {p} ,\ \madbf {v} (\madbf {v} \cdot \madbf {p} )+q_{r}^{2}\madbf {p} +q_{r}\madbf {v} \times \madbf {p} +\madbf {v} \times (q_{r}\madbf {p} +\madbf {v} \times \madbf {p} ))\\(0,\ \madbf {p} ')=&\ (0,\ s(\madbf {v} \otimes \madbf {v} +q_{r}^{2}\madbf {I} +2q_{r}[\madbf {v} ]_{\times }+[\madbf {v} ]_{\times }^{2})\madbf {p} ),\end{awigned}}}$

where ${\dispwaystywe \otimes }$ denotes de outer product, ${\dispwaystywe \madbf {I} }$ is de identity matrix and ${\dispwaystywe [\madbf {v} ]_{\times }}$ is de transformation matrix dat when muwtipwied from de weft wif a vector ${\dispwaystywe \madbf {u} }$ gives de cross product ${\dispwaystywe \madbf {v} \times \madbf {u} }$.

Since ${\dispwaystywe \madbf {p} '=\madbf {R} \madbf {p} }$, we can identify ${\dispwaystywe \madbf {R} }$ as ${\dispwaystywe s(\madbf {v} \otimes \madbf {v} +q_{r}^{2}\madbf {I} +2q_{r}[\madbf {v} ]_{\times }+[\madbf {v} ]_{\times }^{2})}$, which upon expansion shouwd resuwt in de expression written in matrix form above.

### Recovering de axis-angwe representation

The expression ${\dispwaystywe \madbf {q} \madbf {p} \madbf {q} ^{-1}}$ rotates any vector qwaternion ${\dispwaystywe \madbf {p} }$ around an axis given by de vector ${\dispwaystywe \madbf {a} }$ by de angwe ${\dispwaystywe \deta }$, where ${\dispwaystywe \madbf {a} }$ and ${\dispwaystywe \deta }$ depends on de qwaternion ${\dispwaystywe \madbf {q} =q_{r}+q_{i}\madbf {i} +q_{j}\madbf {j} +q_{k}\madbf {k} }$.

${\dispwaystywe \madbf {a} }$ and ${\dispwaystywe \deta }$ can be found from de fowwowing eqwations:

${\dispwaystywe (a_{x},a_{y},a_{z})\ =\ {\frac {(q_{i},q_{j},q_{k})}{\sqrt {q_{i}^{2}+q_{j}^{2}+q_{k}^{2}}}}}$
${\dispwaystywe \deta \ =\ 2\operatorname {atan2} \weft({\sqrt {q_{i}^{2}+q_{j}^{2}+q_{k}^{2}}},q_{r}\right),}$

where ${\dispwaystywe \madrm {atan2} }$ is de two-argument arctangent. Care shouwd be taken when de qwaternion approaches a scawar, since due to degeneracy de axis of an identity rotation is not weww-defined.

### The composition of spatiaw rotations

A benefit of de qwaternion formuwation of de composition of two rotations RB and RA is dat it yiewds directwy de rotation axis and angwe of de composite rotation RC=RBRA.

Let de qwaternion associated wif a spatiaw rotation R be constructed from its rotation axis S wif de rotation angwe φ around dis axis. The associated qwaternion is given by,

${\dispwaystywe S=\cos {\frac {\varphi }{2}}+\sin {\frac {\varphi }{2}}\madbf {S} .}$

Then de composition of de rotation RB wif RA is de rotation RC=RBRA wif rotation axis and angwe defined by de product of de qwaternions

${\dispwaystywe A=\cos {\frac {\awpha }{2}}+\sin {\frac {\awpha }{2}}\madbf {A} \qwad {\text{and}}\qwad B=\cos {\frac {\beta }{2}}+\sin {\frac {\beta }{2}}\madbf {B} ,}$

dat is

${\dispwaystywe C=\cos {\frac {\gamma }{2}}+\sin {\frac {\gamma }{2}}\madbf {C} ={\Big (}\cos {\frac {\beta }{2}}+\sin {\frac {\beta }{2}}\madbf {B} {\Big )}{\Big (}\cos {\frac {\awpha }{2}}+\sin {\frac {\awpha }{2}}\madbf {A} {\Big )}.}$

Expand dis product to obtain

${\dispwaystywe \cos {\frac {\gamma }{2}}+\sin {\frac {\gamma }{2}}\madbf {C} ={\Big (}\cos {\frac {\beta }{2}}\cos {\frac {\awpha }{2}}-\sin {\frac {\beta }{2}}\sin {\frac {\awpha }{2}}\madbf {B} \cdot \madbf {A} {\Big )}+{\Big (}\sin {\frac {\beta }{2}}\cos {\frac {\awpha }{2}}\madbf {B} +\sin {\frac {\awpha }{2}}\cos {\frac {\beta }{2}}\madbf {A} +\sin {\frac {\beta }{2}}\sin {\frac {\awpha }{2}}\madbf {B} \times \madbf {A} {\Big )}.}$

Divide bof sides of dis eqwation by de identity, which is de waw of cosines on a sphere,

${\dispwaystywe \cos {\frac {\gamma }{2}}=\cos {\frac {\beta }{2}}\cos {\frac {\awpha }{2}}-\sin {\frac {\beta }{2}}\sin {\frac {\awpha }{2}}\madbf {B} \cdot \madbf {A} ,}$

and compute

${\dispwaystywe \tan {\frac {\gamma }{2}}\madbf {C} ={\frac {\tan {\frac {\beta }{2}}\madbf {B} +\tan {\frac {\awpha }{2}}\madbf {A} +\tan {\frac {\beta }{2}}\tan {\frac {\awpha }{2}}\madbf {B} \times \madbf {A} }{1-\tan {\frac {\beta }{2}}\tan {\frac {\awpha }{2}}\madbf {B} \cdot \madbf {A} }}.}$

This is Rodrigues formuwa for de axis of a composite rotation defined in terms of de axes of de two rotations. He derived dis formuwa in 1840 (see page 408).[8]

The dree rotation axes A, B, and C form a sphericaw triangwe and de dihedraw angwes between de pwanes formed by de sides of dis triangwe are defined by de rotation angwes. Hamiwton[9] presented de component form of dese eqwations showing dat de qwaternion product computes de dird vertex of a sphericaw triangwe from two given vertices and deir associated arc-wengds, which is awso defines an awgebra for points in Ewwiptic geometry.

### Differentiation wif respect to de rotation qwaternion

The rotated qwaternion p'=q p q* needs to be differentiated wif respect to de rotating qwaternion q , when de rotation is estimated from numericaw optimization, uh-hah-hah-hah. The estimation of rotation angwe is an essentiaw procedure in 3D object registration or camera cawibration, uh-hah-hah-hah. The derivative can be represented using de Matrix Cawcuwus notation, uh-hah-hah-hah.

${\dispwaystywe {\begin{awigned}{\frac {\partiaw \madbf {p'} }{\partiaw \madbf {q} }}\eqwiv \weft[{\frac {\partiaw \madbf {p'} }{\partiaw q_{0}}},{\frac {\partiaw \madbf {p'} }{\partiaw q_{x}}},{\frac {\partiaw \madbf {p'} }{\partiaw q_{y}}},{\frac {\partiaw \madbf {p'} }{\partiaw q_{z}}}\right]=\weft[\madbf {pq} -(\madbf {pq} )^{*},(\madbf {pqi} )^{*}-\madbf {pqi} ,(\madbf {pqj} )^{*}-\madbf {pqj} ,(\madbf {pqk} )^{*}-\madbf {pqk} \right].\end{awigned}}}$

A derivation can be found in, uh-hah-hah-hah.[10]

## Quaternion rotation operations

A very formaw expwanation of de properties used in dis section is given by Awtman, uh-hah-hah-hah.[11]

### The hypersphere of rotations

#### Visuawizing de space of rotations

Unit qwaternions represent de group of Eucwidean rotations in dree dimensions in a very straightforward way. The correspondence between rotations and qwaternions can be understood by first visuawizing de space of rotations itsewf.

Two rotations by different angwes and different axes in de space of rotations. The wengf of de vector is rewated to de magnitude of de rotation, uh-hah-hah-hah.

In order to visuawize de space of rotations, it hewps to consider a simpwer case. Any rotation in dree dimensions can be described by a rotation by some angwe about some axis; for our purposes, we wiww use an axis vector to estabwish handedness for our angwe. Consider de speciaw case in which de axis of rotation wies in de xy pwane. We can den specify de axis of one of dese rotations by a point on a circwe drough which de vector crosses, and we can sewect de radius of de circwe to denote de angwe of rotation.

Simiwarwy, a rotation whose axis of rotation wies in de xy pwane can be described as a point on a sphere of fixed radius in dree dimensions. Beginning at de norf powe of a sphere in dree-dimensionaw space, we specify de point at de norf powe to be de identity rotation (a zero angwe rotation). Just as in de case of de identity rotation, no axis of rotation is defined, and de angwe of rotation (zero) is irrewevant. A rotation having a very smaww rotation angwe can be specified by a swice drough de sphere parawwew to de xy pwane and very near de norf powe. The circwe defined by dis swice wiww be very smaww, corresponding to de smaww angwe of de rotation, uh-hah-hah-hah. As de rotation angwes become warger, de swice moves in de negative z direction, and de circwes become warger untiw de eqwator of de sphere is reached, which wiww correspond to a rotation angwe of 180 degrees. Continuing soudward, de radii of de circwes now become smawwer (corresponding to de absowute vawue of de angwe of de rotation considered as a negative number). Finawwy, as de souf powe is reached, de circwes shrink once more to de identity rotation, which is awso specified as de point at de souf powe.

Notice dat a number of characteristics of such rotations and deir representations can be seen by dis visuawization, uh-hah-hah-hah. The space of rotations is continuous, each rotation has a neighborhood of rotations which are nearwy de same, and dis neighborhood becomes fwat as de neighborhood shrinks. Awso, each rotation is actuawwy represented by two antipodaw points on de sphere, which are at opposite ends of a wine drough de center of de sphere. This refwects de fact dat each rotation can be represented as a rotation about some axis, or, eqwivawentwy, as a negative rotation about an axis pointing in de opposite direction (a so-cawwed doubwe cover). The "watitude" of a circwe representing a particuwar rotation angwe wiww be hawf of de angwe represented by dat rotation, since as de point is moved from de norf to souf powe, de watitude ranges from zero to 180 degrees, whiwe de angwe of rotation ranges from 0 to 360 degrees. (de "wongitude" of a point den represents a particuwar axis of rotation, uh-hah-hah-hah.) Note however dat dis set of rotations is not cwosed under composition, uh-hah-hah-hah. Two successive rotations wif axes in de xy pwane wiww not necessariwy give a rotation whose axis wies in de xy pwane, and dus cannot be represented as a point on de sphere. This wiww not be de case wif a generaw rotation in 3-space, in which rotations do form a cwosed set under composition, uh-hah-hah-hah.

The sphere of rotations for de rotations dat have a "horizontaw" axis (in de xy pwane).

This visuawization can be extended to a generaw rotation in 3-dimensionaw space. The identity rotation is a point, and a smaww angwe of rotation about some axis can be represented as a point on a sphere wif a smaww radius. As de angwe of rotation grows, de sphere grows, untiw de angwe of rotation reaches 180 degrees, at which point de sphere begins to shrink, becoming a point as de angwe approaches 360 degrees (or zero degrees from de negative direction). This set of expanding and contracting spheres represents a hypersphere in four dimensionaw space (a 3-sphere). Just as in de simpwer exampwe above, each rotation represented as a point on de hypersphere is matched by its antipodaw point on dat hypersphere. The "watitude" on de hypersphere wiww be hawf of de corresponding angwe of rotation, and de neighborhood of any point wiww become "fwatter" (i.e. be represented by a 3-D Eucwidean space of points) as de neighborhood shrinks. This behavior is matched by de set of unit qwaternions: A generaw qwaternion represents a point in a four dimensionaw space, but constraining it to have unit magnitude yiewds a dree-dimensionaw space eqwivawent to de surface of a hypersphere. The magnitude of de unit qwaternion wiww be unity, corresponding to a hypersphere of unit radius. The vector part of a unit qwaternion represents de radius of de 2-sphere corresponding to de axis of rotation, and its magnitude is de cosine of hawf de angwe of rotation, uh-hah-hah-hah. Each rotation is represented by two unit qwaternions of opposite sign, and, as in de space of rotations in dree dimensions, de qwaternion product of two unit qwaternions wiww yiewd a unit qwaternion, uh-hah-hah-hah. Awso, de space of unit qwaternions is "fwat" in any infinitesimaw neighborhood of a given unit qwaternion, uh-hah-hah-hah.

#### Parameterizing de space of rotations

We can parameterize de surface of a sphere wif two coordinates, such as watitude and wongitude. But watitude and wongitude are iww-behaved (degenerate) at de norf and souf powes, dough de powes are not intrinsicawwy different from any oder points on de sphere. At de powes (watitudes +90° and −90°), de wongitude becomes meaningwess.

It can be shown dat no two-parameter coordinate system can avoid such degeneracy. We can avoid such probwems by embedding de sphere in dree-dimensionaw space and parameterizing it wif dree Cartesian coordinates (w, x, y), pwacing de norf powe at (w, x, y) = (1, 0, 0), de souf powe at (w, x, y) = (−1, 0, 0), and de eqwator at w = 0, x2 + y2 = 1. Points on de sphere satisfy de constraint w2 + x2 + y2 = 1, so we stiww have just two degrees of freedom dough dere are dree coordinates. A point (w, x, y) on de sphere represents a rotation in de ordinary space around de horizontaw axis directed by de vector (x, y, 0) by an angwe ${\dispwaystywe \awpha =2\cos ^{-1}w=2\sin ^{-1}{\sqrt {x^{2}+y^{2}}}}$.

In de same way de hypersphericaw space of 3D rotations can be parameterized by dree angwes (Euwer angwes), but any such parameterization is degenerate at some points on de hypersphere, weading to de probwem of gimbaw wock. We can avoid dis by using four Eucwidean coordinates w, x, y, z, wif w2 + x2 + y2 + z2 = 1. The point (w, x, y, z) represents a rotation around de axis directed by de vector (x, y, z) by an angwe ${\dispwaystywe \awpha =2\cos ^{-1}w=2\sin ^{-1}{\sqrt {x^{2}+y^{2}+z^{2}}}.}$

## Expwaining qwaternions' properties wif rotations

### Non-commutativity

The muwtipwication of qwaternions is non-commutative. This fact expwains how de pq p q−1 formuwa can work at aww, having q q−1 = 1 by definition, uh-hah-hah-hah. Since de muwtipwication of unit qwaternions corresponds to de composition of dree-dimensionaw rotations, dis property can be made intuitive by showing dat dree-dimensionaw rotations are not commutative in generaw.

Set two books next to each oder. Rotate one of dem 90 degrees cwockwise around de z axis, den fwip it 180 degrees around de x axis. Take de oder book, fwip it 180° around x axis first, and 90° cwockwise around z water. The two books do not end up parawwew. This shows dat, in generaw, de composition of two different rotations around two distinct spatiaw axes wiww not commute.

### Orientation

The vector cross product, used to define de axis–angwe representation, does confer an orientation ("handedness") to space: in a dree-dimensionaw vector space, de dree vectors in de eqwation a × b = c wiww awways form a right-handed set (or a weft-handed set, depending on how de cross product is defined), dus fixing an orientation in de vector space. Awternativewy, de dependence on orientation is expressed in referring to such u dat specifies a rotation as to axiaw vectors. In qwaternionic formawism de choice of an orientation of de space corresponds to order of muwtipwication: ij = k but ji = −k. If one reverses de orientation, den de formuwa above becomes pq−1p q, i.e., a unit q is repwaced wif de conjugate qwaternion – de same behaviour as of axiaw vectors.

## Comparison wif oder representations of rotations

The representation of a rotation as a qwaternion (4 numbers) is more compact dan de representation as an ordogonaw matrix (9 numbers). Furdermore, for a given axis and angwe, one can easiwy construct de corresponding qwaternion, and conversewy, for a given qwaternion one can easiwy read off de axis and de angwe. Bof of dese are much harder wif matrices or Euwer angwes.

In video games and oder appwications, one is often interested in “smoof rotations”, meaning dat de scene shouwd swowwy rotate and not in a singwe step. This can be accompwished by choosing a curve such as de sphericaw winear interpowation in de qwaternions, wif one endpoint being de identity transformation 1 (or some oder initiaw rotation) and de oder being de intended finaw rotation, uh-hah-hah-hah. This is more probwematic wif oder representations of rotations.

When composing severaw rotations on a computer, rounding errors necessariwy accumuwate. A qwaternion dat is swightwy off stiww represents a rotation after being normawised: a matrix dat is swightwy off may not be ordogonaw any more and is harder to convert back to a proper ordogonaw matrix.

Quaternions awso avoid a phenomenon cawwed gimbaw wock which can resuwt when, for exampwe in pitch/yaw/roww rotationaw systems, de pitch is rotated 90° up or down, so dat yaw and roww den correspond to de same motion, and a degree of freedom of rotation is wost. In a gimbaw-based aerospace inertiaw navigation system, for instance, dis couwd have disastrous resuwts if de aircraft is in a steep dive or ascent.

### Conversion to and from de matrix representation

#### From a qwaternion to an ordogonaw matrix

The ordogonaw matrix corresponding to a rotation by de unit qwaternion z = a + bi + cj + dk (wif |z| = 1) when post-muwtipwying wif a cowumn vector is given by

${\dispwaystywe R={\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}}.}$

This rotation matrix is used on vector w as ${\dispwaystywe w_{rotated}=R\cdot w}$. The qwaternion representation of dis rotation is given by:

${\dispwaystywe {\begin{bmatrix}0\\w_{rotated}\end{bmatrix}}=z{\begin{bmatrix}0\\w\end{bmatrix}}z^{*},}$

where ${\dispwaystywe z^{*}}$ is de conjugate of de qwaternion ${\dispwaystywe z}$, given by ${\dispwaystywe \madbf {z} ^{*}=a-b\madbf {i} -c\madbf {j} -d\madbf {k} }$

Awso, qwaternion muwtipwication is defined as (assuming a and b are qwaternions, wike z above):

${\dispwaystywe ab=(a_{0}b_{0}-{\vec {a}}\cdot {\vec {b}};a_{0}{\vec {b}}+b_{0}{\vec {a}}+{\vec {a}}\times {\vec {b}})}$

where de order a,b is important since de cross product of two vectors is not commutative.

#### From an ordogonaw matrix to a qwaternion

One must be carefuw when converting a rotation matrix to a qwaternion, as severaw straightforward medods tend to be unstabwe when de trace (sum of de diagonaw ewements) of de rotation matrix is zero or very smaww. For a stabwe medod of converting an ordogonaw matrix to a qwaternion, see de Quaternion subsection of de Rotation matrix articwe.

#### Fitting qwaternions

The above section described how to recover a qwaternion q from a 3×3 rotation matrix Q. Suppose, however, dat we have some matrix Q dat is not a pure rotation—due to round-off errors, for exampwe—and we wish to find de qwaternion q dat most accuratewy represents Q. In dat case we construct a symmetric 4×4 matrix

${\dispwaystywe K={\frac {1}{3}}{\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}},}$

and find de eigenvector (x, y, z, w) corresponding to de wargest eigenvawue (dat vawue wiww be 1 if and onwy if Q is a pure rotation). The qwaternion so obtained wiww correspond to de rotation cwosest to de originaw matrix Q[dubious ].[12]

### Performance comparisons

This section discusses de performance impwications of using qwaternions versus oder medods (axis/angwe or rotation matrices) to perform rotations in 3D.

#### Resuwts

Storage reqwirements
Medod Storage
Rotation matrix 9
Quaternion 3 or 4 (see bewow)
Angwe/axis 3 or 4 (see bewow)

Onwy dree of de qwaternion components are independent, as a rotation is represented by a unit qwaternion, uh-hah-hah-hah. For furder cawcuwation one usuawwy needs aww four ewements, so aww cawcuwations wouwd suffer additionaw expense from recovering de fourf component. Likewise, angwe/axis can be stored in a dree-component vector by muwtipwying de unit direction by de angwe (or a function dereof), but dis comes at additionaw computationaw cost when using it for cawcuwations.

Performance comparison of rotation chaining operations
Medod # muwtipwies # add/subtracts totaw operations
Rotation matrices 27 18 45
Quaternions 16 12 28
Performance comparison of vector rotating operations[13][14]
Medod # muwtipwies # add/subtracts # sin/cos totaw operations
Rotation matrix 9 6 0 15
Quaternions * 15 15 0 30
Angwe/axis 18 12 2 30 + 2

* Note: Quaternions can be impwicitwy converted to a rotation-wike matrix (12 muwtipwies and 12 add/subtracts), which wevews de fowwowing vectors rotating cost wif de rotation matrix medod

#### Used medods

There are dree basic approaches to rotating a vector v:

1. Compute de matrix product of a 3 × 3 rotation matrix R and de originaw 3 × 1 cowumn matrix representing v. This reqwires 3 × (3 muwtipwications + 2 additions) = 9 muwtipwications and 6 additions, de most efficient medod for rotating a vector.
2. A rotation can be represented by a unit-wengf qwaternion q = (w, r) wif scawar (reaw) part w and vector (imaginary) part r. The rotation can be appwied to a 3D vector v via de formuwa ${\dispwaystywe {\vec {v}}_{\text{new}}={\vec {v}}+2{\vec {r}}\times ({\vec {r}}\times {\vec {v}}+w{\vec {v}})}$. This reqwires onwy 15 muwtipwications and 15 additions to evawuate (or 18 muwtipwications and 12 additions if de factor of 2 is done via muwtipwication, uh-hah-hah-hah.) This formuwa, originawwy dought to be used wif axis/angwe notation (Rodrigues' formuwa), can awso be appwied to qwaternion notation, uh-hah-hah-hah. This yiewds de same resuwt as de wess efficient but more compact formuwa of qwaternion muwtipwication ${\dispwaystywe {\vec {v}}_{\text{new}}=q{\vec {v}}q^{-1}}$.
3. Use de angwe/axis formuwa to convert an angwe/axis to a rotation matrix R den muwtipwying wif a vector, or, simiwarwy, use a formuwa to convert qwaternion notation to a rotation matrix, den muwtipwying wif a vector. Converting de angwe/axis to R costs 12 muwtipwies, 2 function cawws (sin, cos), and 10 add/subtracts; from item 1, rotating using R adds an additionaw 9 muwtipwications and 6 additions for a totaw of 21 muwtipwies, 16 add/subtracts, and 2 function cawws (sin, cos). Converting a qwaternion to R costs 12 muwtipwies and 12 add/subtracts; from item 1, rotating using R adds an additionaw 9 muwtipwications and 6 additions for a totaw of 21 muwtipwies and 18 add/subtracts.

## Pairs of unit qwaternions as rotations in 4D space

A pair of unit qwaternions zw and zr can represent any rotation in 4D space. Given a four dimensionaw vector v, and assuming dat it is a qwaternion, we can rotate de vector v wike dis:

${\dispwaystywe f({\vec {v}})=\madbf {z} _{\rm {w}}{\vec {v}}\madbf {z} _{\rm {r}}={\begin{pmatrix}a_{\rm {w}}&-b_{\rm {w}}&-c_{\rm {w}}&-d_{\rm {w}}\\b_{\rm {w}}&a_{\rm {w}}&-d_{\rm {w}}&c_{\rm {w}}\\c_{\rm {w}}&d_{\rm {w}}&a_{\rm {w}}&-b_{\rm {w}}\\d_{\rm {w}}&-c_{\rm {w}}&b_{\rm {w}}&a_{\rm {w}}\end{pmatrix}}{\begin{pmatrix}w\\x\\y\\z\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}}.}$

The pair of matrices represents a rotation of ℝ4. Note dat since ${\dispwaystywe (\madbf {z} _{\rm {w}}{\vec {v}})\madbf {z} _{\rm {r}}=\madbf {z} _{\rm {w}}({\vec {v}}\madbf {z} _{\rm {r}})}$, de two matrices must commute. Therefore, dere are two commuting subgroups of de set of four dimensionaw rotations. Arbitrary four dimensionaw rotations have 6 degrees of freedom, each matrix represents 3 of dose 6 degrees of freedom.

Since de generators of de four-dimensionaw rotations can be represented by pairs of qwaternions (as fowwows), aww four-dimensionaw rotations can awso be represented.

${\dispwaystywe \madbf {z} _{\rm {w}}{\vec {v}}\madbf {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}}}$
${\dispwaystywe \madbf {z} _{\rm {w}}=1+{dt_{ab}+dt_{cd} \over 2}i+{dt_{ac}-dt_{bd} \over 2}j+{dt_{ad}+dt_{bc} \over 2}k}$
${\dispwaystywe \madbf {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}$

## References

1. ^ Shoemake, Ken (1985). "Animating Rotation wif Quaternion Curves" (PDF). Computer Graphics. 19 (3): 245–254. doi:10.1145/325165.325242. Presented at SIGGRAPH '85.
2. ^ J. M. McCardy, 1990, Introduction to Theoreticaw Kinematics, MIT Press
3. ^ Amnon Katz (1996) Computationaw Rigid Vehicwe Dynamics, Krieger Pubwishing Co. ISBN 978-1575240169
4. ^ J. B. Kuipers (1999) Quaternions and rotation Seqwences: a Primer wif Appwications to Orbits, Aerospace, and Virtuaw Reawity, Princeton University Press ISBN 978-0-691-10298-6
5. ^ Karsten Kunze, Hewmut Schaeben (November 2004). "The Bingham Distribution of Quaternions and Its Sphericaw Radon Transform in Texture Anawysis". Madematicaw Geowogy. 8: 917–943. doi:10.1023/B:MATG.0000048799.56445.59.
6. ^ Awtmann, Simon L. "Hamiwton, Rodrigues, and de Quaternion Scandaw". Madematics Magazine. 62 (5): 306. doi:10.2307/2689481.
7. ^ "comp.graphics.awgoridms FAQ". Retrieved 2 Juwy 2017.
8. ^ Rodrigues, O. (1840), Des wois géométriqwes qwi régissent wes dépwacements d’un système sowide dans w’espace, et wa variation des coordonnées provenant de ses dépwacements con- sidérés indépendamment des causes qwi peuvent wes produire, Journaw de Mafématiqwes Pures et Appwiqwées de Liouviwwe 5, 380–440.
9. ^ Wiwwiam Rowan Hamiwton (1844 to 1850) On qwaternions or a new system of imaginaries in awgebra, Phiwosophicaw Magazine, wink to David R. Wiwkins cowwection at Trinity Cowwege, Dubwin
10. ^ Lee, Byung-Uk (1991), "Differentiation wif Quaternions, Appendix B" (PDF), Ph. D. Thesis, Stereo Matching of Skuww Landmarks, Stanford University: 57–58
11. ^ Simon L. Awtman (1986) Rotations, Quaternions, and Doubwe Groups, Dover Pubwications (see especiawwy Ch. 12).
12. ^ Bar-Itzhack, Itzhack Y. (Nov–Dec 2000), "New medod for extracting de qwaternion from a rotation matrix", AIAA Journaw of Guidance, Controw and Dynamics, 23 (6): 1085, Bibcode:2000JGCD...23.1085B, doi:10.2514/2.4654, ISSN 0731-5090
13. ^ Eberwy, D., Rotation Representations and performance issues
14. ^ "Bitbucket". bitbucket.org.


text:
# Thread: Monotone likelihood ratio

1. ## Monotone likelihood ratio

I am trying to show that the monotone likelihood ratio for a uniform distribution [0,theta] is the maximum value (X1,...Xn). I know how to compute the monotone likelihood ratio by using fn(x given theta1)/fn(x given theta2), but then how do i show this is the maximum (X1,...Xn)?? Thanks

2. do you know that the likelihood function is

$\displaystyle {1\over \theta^n} I_{X_{(1)}>0} I_{X_{(n)}<\theta}$

3. Yes so the MLR becomes (theta2^n)/(theta1^n). But what is the step that shows that that is the maximum (X1,...Xn)??

4. I'm not quite sure what your two theta's are
are you testing theta1 vs theta2?

5. Monotone likelihood ratio - Wikipedia, the free encyclopedia

It is like the formula on this page only our class uses theta1 as f(x) and theta2 as g(x)

6. Suppose $\displaystyle \theta_2>\theta_1$. Then the ratio becomes $\displaystyle \frac{\theta_1^n}{\theta_2^n}\frac{I(X_{(n)},\thet a_2)}{I(X_{(n)},\theta_1)}$ [where $\displaystyle I(a,b)=1 ,$ if $\displaystyle a\leq b$ and 0 otherwise.]

$\displaystyle =\frac{\theta_1^n}{\theta_2^n}\frac{1}{1}$ , if $\displaystyle 0<X_{(n)}<\theta_1$
and $\displaystyle \frac{\theta_1^n}{\theta_2^n}\frac{1}{0}$ if $\displaystyle \theta_1<X_{(n)}<\infty$

that is $\displaystyle = \frac{\theta_1^n}{\theta_2^n}$ ,if $\displaystyle 0<X_{(n)}<\theta_1$
and $\displaystyle = \infty$ if $\displaystyle \theta_1<X_{(n)}<\infty$

So as $\displaystyle X_{(n)}$ increases, the ratio also increases. Hence MLR in $\displaystyle X_{(n)}$.

7. Thank you, but how do i show the statistic is the maximum(X1,...Xn)

8. Originally Posted by andyaddition
Thank you, but how do i show the statistic is the maximum(X1,...Xn)
How do you write the pdf (or the joint pdf) of a $\displaystyle U(0,\theta)$ distribution?

9. 1/theta^n ??

10. You are missing something. The joint pdf is given by $\displaystyle f(x_1,x_2,....,x_n)=\frac{1}{\theta^n},$ if $\displaystyle 0<X_i<\theta$ $\displaystyle \forall i=1(1)n$. Since all $\displaystyle x_i$ are less than $\displaystyle \theta$, it is enough to ensure that max (X1,X2,....,Xn), which is denoted by $\displaystyle X_{(n)}$, is always less than $\displaystyle \theta$. Hence the joint pdf becomes $\displaystyle f(x_1,x_2,....,x_n)=\frac{1}{\theta^n},$ if $\displaystyle 0<X_{(n)}<\theta$. Now you move to the ratio.

format: plain


text:
# Team:Aachen/Notebook/Software/Measurarty

(Difference between revisions)
 Revision as of 21:30, 17 October 2014 (view source) (→Source Code)← Older edit Revision as of 00:02, 18 October 2014 (view source)Mjoppich (Talk | contribs) (→Measurarty - An Introduction)Newer edit → Line 86: Line 86: Finally, a classification algorithm can detect the pathogen on our chips. Finally, a classification algorithm can detect the pathogen on our chips. + To demonstrate the algorithm, the following sample image will be discussed. + + {{Team:Aachen/Figure|align=center|Aachen_meas_test.jpg|title=Image taken from WatsOn to be analyzed by Measurarty algorithm|width=700px}} {{Team:Aachen/BlockSeparator}} {{Team:Aachen/BlockSeparator}}

# Measurarty

Measurarty is the evil player in the game of Cellock Holmes and WatsOn. Measurarty is the pathogen detection logic behind our project. Using our Measurarty algorithm, we want to automatically detect pathogens from the chip photos delivered by WatsOn, without human interaction. Besides reducing the risk of human errors, this makes our device usable by almost everyone.

## Measurarty - An Introduction

Our device control software is able to take images of incubated chips inside WatsOn. Yet, that does not bring the user closer to the answer of the question:

What's on the chip?

In fact, answering this question seems trivial for a human: Just check whether a colony grown has grown on the chip and you're done. This task is even easier with our chip system, because these show fluorescence wherever a pathogen has been detected.

But is this an easy task for a computer? Actually not. The task of automatic detection is tried by several disciplines in computer science, from pattern recognition over machine learning to by medical imaging chairs.

Here, we would like to present a pipeline for this task that makes use of easy segmentation and classification algorithms. First, Measurarty segments the target image using Statistical Region Merging (SRM) in order to find regions of similar properties. After this step, we can segment the picture using histogram thresholding in HSV color space to find candidate regions for pathogens. Finally, a classification algorithm can detect the pathogen on our chips.

To demonstrate the algorithm, the following sample image will be discussed.

## Statistical Region Merging (SRM)

Before briefly introducing Statistical Region Merging (SRM), we would like to explain why we need this step, and why this algorithm is an ideal choice.

Compared to other clustering algorithms, SRM is quite leight weight, yet delivers deterministic results and is not dependent on a certain seed (like k-means, for example).

On the other hand, it can create as many refinements as one wants and is thus flexible enough for the our purposes. Finally there's already been knowledge about this algorithm in the group.

Statistical Region Merging (SRM) (Nook and Nielson, 2004) is a clustering technique also used directly for image segmentation. A region $R$ is a set of pixels and the cardinality $\lvert R \rvert$ determines how many pixels are in one region. Starting with a sorted set of connected regions (w. r. t. some distance function $f$), two regions $R$ and $R'$ are merged if the qualification criteria $\vert \overline{R'}-\overline{R} \vert \leq \sqrt{b^2(R)+b^2(R')}$ with $b(R) = g \cdot \sqrt{\frac{\ln \frac{\mathcal{R}_{\lvert R \rvert}}{\delta}}{2Q\lvert R \rvert}}$ is fulfilled. Therefore, $\mathcal{R}_{\lvert R \rvert}$ is the set of regions with $\lvert R \rvert$ pixels. Typically $Q$ is chosen as $Q \in \lbrack 256, 1\rbrack$ and $\delta = \frac{1}{\lvert I \rvert^2}$.

The $Q$ parameter mainly influences the merging process. For an example, see the figure SRM Regions below. The lower the chosen value for $Q$, more coarse the regions become. Using a union-find structure, the segmentation does not need to be recalculated for each $Q$ level. For the step from $q$ to $\frac{q}{2}$, just the qualification criteria needs to be applied to the regions from the $q$ result. A MATLAB implementation is also available (Boltz, 2009).

### SRM Clustering

In our project, we used Statistical Region Merging for clustering. In contrast to other algorithms, such as k-means, this approach is highly deterministic. For our purposes we only have one SRM run for $Q=256$.

In MATLAB, we use the previously mentioned code from MATLAB Fileexchange (Boltz, 2009). For our Qt-based GUI we implemented the SRM method ourselves.

The SRM clustering reduces the amount of different colors in the image and hence eases the recognition of parts belonging together.

Qlevel = 256;
[maps,images]=singlesrm(double(image),Qlevel);

## Segmentation

In the segmentation stage all background regions are removed. This task is quite crucial. If one removes too few, the final stage of finding pathogens might get irritated. On the other hand, if one removes too many regions, positive hits might get removed early before detection. This surely must be avoided.

We opted for a simple thresholding step because it showed that while being easy, it is an effective weapon against the uniform background. In fact, the good image quality we wanted to reach with our device allows now less sophisticated methods. Also the less computational intensive the steps are, the better they might even run directly on the Raspberry Pi in our device!

The HSV thresholding is performed on each component seperately. For more information on the HSV color space we refer to Wikipedia. The first component is the hue which we select to be inbetween $0.462$ and $0.520$ to select any blue-greenish color. We will not see bright green due to the filter selection in our device. The saturation value must be high, between $0.99$ and $1.0$. Moreover, the value component of the HSV image has to lie between $0.25$ and $0.32$, which assumes a relatively dark color.

Indeed, these values are not problem specific, but specific for each setup and therefore have to be determined empirically.

The remainder of this stage creates a mask of pixels that fulfill the conditions.

• image of masked bit

% Auto-generated by colorThresholder app on 15-Oct-2014
%-------------------------------------------------------
RGB = srmimg;

% Convert RGB image to chosen color space
I = rgb2hsv(RGB);

% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.462;
channel1Max = 0.520;

% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.99;
channel2Max = 1.000;

% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.25;
channel3Max = 0.32;

% Create mask based on chosen histogram thresholds
BW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);

% Initialize output masked image based on input image.

% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;

end

## Classification

### Smoothness Index

For position prediction in virtual environments, jitter or noise in the output signal is not wanted though often present. Since discovering smooth areas is a similar problem to jitter detection, a simple method for determining jitter can be used to measure non-jitter, smoothness (Joppich, Rausch and Kuhlen, 2013). It is assumed that jitter-free areas of a position signal do not differ in velocity.

Smooth areas do not differ in intensity, and therefore only low changes in velocity (intensity change) can be recorded. For the reduction of noise, this operation is performed on the smoothed input image. Then the smoothness $s$ of a pixel $p$ in its k-neighbourhood $\mathcal{N}_k$ can be determined as: $$s(p) = \sum\limits_{p' \in \mathcal{N}_k} \nabla(p') / \arg\max\limits_{p} s(p)$$

Using thresholding, $TS_l \leq s(p) \leq TS_u \wedge TI_l \leq I \leq TI_u$, different areas, such as background or pathogen, can be selected.

For the empirical choice of thresholds, it can be argued that these are tailored to the specific case. While this surely is true to a certain extent, the here presented method has been successfully tested on images from a completely different domain, and no changes to the thresholds have been made to make it work. A proper theoretical evaluation is emphasized, however, is probably not the aim of the iGEM competition.

Finally, selecting for the red region, this delivers the location of possible pathogens. Since the size of the agar chips is variable but fixed a quantitative analysis can be performed by counting pixels for instance.

### Empirical Evaluation

Using our MATLAB code we found the lower threshold for the smoothness index to be $TS_l = 0.85$ and the upper threshold $TS_u = \infty$. Similarly, for $TI_l = 235$ and $TI_u = \infty$.

Using these settings, we can find a response already in images taken after 42 minutes.

Ideally, one would rate the quality of the image segmentation using some ground truth, such as manual delineations. This still has to be done for our method. However, from visual observations, our method is showing promising results.

• image of smoothness index

### Automatic Classification

function [mask, seg] = automaticseeds(im)

imc = im;

%% to grayscale and filtering
Z = double(rgb2gray(im));
Z = 255 * Z / max(max(Z));

filtertype = 'disk';
Z = filter2(fspecial(filtertype), Z);
Z = filter2(fspecial(filtertype), filter2(fspecial(filtertype), Z));
Z = 255 * Z / max(max(Z));

%% calculating similarity score/smoothness index
k=4;
sSI = similarity(Z,k);
sSI = sSI / max(max(sSI));

%% classify
pathogene = ((sSI > 0.85) == 1) & ((Z > 235) == 1);

mask = ones( size(imc) );
seg = zeros( size(imc) );

%% output
for i=1:size(im,1)
for j=1:size(im,2)

if (pathogene(i,j) == 1)
seg(i,j,1:3) = [255 0 0];
mask(i, j, 1:3) = [0 0 0];
end
end
end
end

## Achievements

Measurarty is the image analysis logic behind our project. It is comprised of simple constructs put together into a pipeline, that is clearly laid out, easily maintainable and - if needed - easily adaptable. For example, changing from green to red fluorescence, only means to change the createMask function to select another target area.

Overall the results look convincing. We have not yet performed a comparison to a manual delineation, however, by eye the results look promising and have a low error.

Talking about computational complexity, the MATLAB code of course performs better than our own C++ implementation, which must be regarded as a proof-of-principle.

Space-wise, the code depends heavily on the image size $O( x \cdot y)$ (width $x$, height $y$, which also limits the number of edges in SRM between regions, as each pixel is one region to start with. However, it cannot take less memory, as the image is stored in an uncompressed format.

On the computational side, the thresholding, image conversion and gradient steps are linear in the number of pixels, and are thus in $O(x \cdot y)$. Unfortunately, the summation of the gradient for the smoothness index adds a heavy factor to it (k-neighbourhood for smoothness index). Due to the merging step in our C++-SRM algorithm implementation, our code has to do $O(x^2 \cdot y^2)$ comparisons, which then finally results in a runtime complexity of $O( x^2 \cdot y^2)$.

• include image here

From the above figure it can also be seen that the detected amount of pathogenic-area correlates with time after induction. The lag-phase can be explained first by the lag-phase of the cells, which first need to generate a response to the pathogen, and on the other hand, by too low fluorescence which is not detectable. The pixel count also meets the expectation when looking at the sample files by eye.

It can be concluded that the Measurarty pipeline defines a robustly working chip-analysis algorithm which can detect pathogens from images supplied by WatsOn. Therefore, this algorithm closes the gap between our biology, detection hardware and the user who wants easy-to-interpret results.

For future prospects, it would be interesting to do a proper performance analysis on our code, to find hotspots and optimize the code. Many for-loops leave plenty of room for vectorization and loop-unrolling. Parallelization, specifically with respect to embedded hardware such as the Raspberry Pi or Odroid U3, is limited to the extend that the overhead created would probably eliminate the improvements.

## Source Code

Measuarty is the image analysis logic behind our project. It has been prototyped and developed in MATLAB, and only later been ported into our WatsOn GUI.

We are happy to provide you with a zip-ped download of our MATLAB code here, as well as on the iGEM softwarerepository on github.

For the C++ conversion please see our WatsOn Software section.

### Using the MATLAB Code

In general, please follow the included README.MD file. Our package comes with a set of test files from one of our experiments. After installing the Statistical Region Merging code (see readme), you can simply run igem_srm_demo.m. Select your current folder, and MATLAB will automatically segment and classify the included jpg-images.

## References

• Joppich, M., Rausch, D., & Kuhlen, T. (2013). Adaptive human motion prediction using multiple model approaches.. Virtuelle und erweiterte Realität (p. 169–180). 10. Workshop der GI-Fachgruppe VR/AR: Shaker.
• Nock, R., & Nielsen, F. (2004). Statistical region merging. IEEE Transactions on Pattern Analysis and Machine Intelligence, 26(11), 1452-1458.


text:
location:  Publications → journals → CMB
Abstract view

# Very Ample Linear Systems on Blowings-Up at General Points of Projective Spaces

Published:2002-09-01
Printed: Sep 2002
• Marc Coppens
 Format: HTML LaTeX MathJax PDF PostScript

## Abstract

Let $\mathbf{P}^n$ be the $n$-dimensional projective space over some algebraically closed field $k$ of characteristic $0$. For an integer $t\geq 3$ consider the invertible sheaf $O(t)$ on $\mathbf{P}^n$ (Serre twist of the structure sheaf). Let $N = \binom{t+n}{n}$, the dimension of the space of global sections of $O(t)$, and let $k$ be an integer satisfying $0\leq k\leq N - (2n+2)$. Let $P_1,\dots,P_k$ be general points on $\mathbf{P}^n$ and let $\pi \colon X \to \mathbf{P}^n$ be the blowing-up of $\mathbf{P}^n$ at those points. Let $E_i = \pi^{-1} (P_i)$ with $1\leq i\leq k$ be the exceptional divisor. Then $M = \pi^* \bigl( O(t) \bigr) \otimes O_X (-E_1 - \cdots -E_k)$ is a very ample invertible sheaf on $X$.
 Keywords: blowing-up, projective space, very ample linear system, embeddings, Veronese map
 MSC Classifications: 14E25 - Embeddings 14N05 - Projective techniques [See also 51N35] 14N15 - Classical problems, Schubert calculus


text:
# VRPTW implementation

Does anybody have an example of the vehicle routing problem with time windows (VRPTW), implemented on Python with CPLEX library, AMPL, or MiniZinc? So far I've looked into https://github.com/industrial-ucn/jupyter-examples/blob/master/optimization/cvrp-cplex.ipynb which I found really helpful for the VRP problem, but I'm looking for VRPTW implementation. I haven't found any example for MiniZinc yet. So if anybody has one at hand so I could try to understand.

• hint: look at constraint (4) in the .ipynb, and try to write an equivalent equation for time. Nov 13 '20 at 9:20

Before implementing anything, you need to understand the equations. A good approach is to think in terms of resources. When handling capacity constraints, you are dealing with a load resource which is limited to the vehicle's capacity. When dealing with constraints linked to time, you need an extra resource for this. Each of these resources can be delt with in a similar fashion. In essence, you use equations that keep track of how these resources are incremented when using an arc.

You need to write an equivalent equation as the one which keeps track of the total load : $$x_{ij} = 1 \quad\Rightarrow \quad u_j =u_i +q_j \quad \forall (i,j)\in A$$ This means that if you use arc $$(i,j)$$, then the total load that has been delivered up to node $$j$$, $$u_j$$, is the total load up to node $$i$$, $$u_i$$, plus the amount that is delivered at node $$j$$, $$q_j$$.

So if $$t_i$$ is a variable that denotes the time at which you reach node $$i$$, and if $$\Delta_{ij}$$ denotes the time it takes to go from $$i$$ to $$j$$, you can write the following equation: $$x_{ij} = 1 \quad \Rightarrow \quad t_j = t_i + \Delta_{ij} \quad \forall (i,j)\in A$$ Once you have this, writing the time window constraint should be straightforward.

Note however that this formulation assumes that the lower bounds on the time windows $$[a_i,b_i]$$ are hard. Typically, this is not the case, as waiting is usually allowed upon arrival. In this case, the above constraint has to be tweaked as follows:

$$x_{ij} = 1 \quad \Rightarrow \quad t_j = \max\{a_j,t_i + \Delta_{ij}\} \quad \forall (i,j)\in A$$

Also, there may be a service time at each node. If you understand the above equations, you should be able to take this service time into account.

• you are now 4000!
– BCLC
Nov 14 '20 at 17:02
• I think I got it thanks but just to clarify shouldn't be $t_j=\max\{a_i,t_i\}+\Delta_{ij} + s_i$ instead of $t_j=\max\{a_i,t_i+\Delta_{ij} + s_i\}$ . Where $s_i$ is the service time at node $i$.
– AGH
Nov 15 '20 at 18:59
• $t_j = \max\{a_i,t_i + \Delta_{ij} +s_i\}$ looks good to me. You have to consider two cases : a) service time + travel time is smaller than $a_i$, in this case you wait, and $t_j = a_i$ or b) is larger and in this case $t_j = t_i +$ service time +travel time Nov 15 '20 at 19:53


text:
Courses
Courses for Kids
Free study material
Free LIVE classes
More

Let U= {4, 8, 12, 16, 20, 24, 28}, A= { 8, 16, 24} and B= { 4, 16, 20, 28}. Find ${\text{(A}} \cup {\text{B)'}}$ and ${\text{(A}} \cap {\text{B)'}}$.

Last updated date: 23rd Mar 2023
Total views: 304.5k
Views today: 4.83k
Verified
304.5k+ views
Hint: In order to solve this problem we need to know that $\cup \,{\text{and }} \cap$ are the signs of union and intersection. Union means collection of all the elements of all the sets provided and intersection between two sets means the element common in those sets will be considered and if there is a set P then P’ means all the elements except that of P. Knowing this information you will get the right answer to this question.

We have the set U= {4, 8, 12, 16, 20, 24, 28}, A= { 8, 16, 24} and B= { 4, 16, 20, 28}.
We have to find ${\text{(A}} \cup {\text{B)'}}$ and ${\text{(A}} \cap {\text{B)'}}$
We know that ${\text{(A}} \cup {\text{B)}}$ means all the elements in A and B
Therefore, ${\text{(A}} \cup {\text{B)}}$={4, 8, 16, 20, 24, 28}
And ${\text{(A}} \cup {\text{B)'}}$ means all the elements of U except that present in ${\text{(A}} \cup {\text{B)}}$.
Therefore, ${\text{(A}} \cup {\text{B)'}}$= {12}

We know that ${\text{(A}} \cap {\text{B)}}$ means all the elements common in A and B.
Therefore, ${\text{(A}} \cap {\text{B)}}$={16}
And ${\text{(A}} \cap {\text{B)'}}$ means all the elements of U except that present in ${\text{(A}} \cap {\text{B)}}$.
Therefore, ${\text{(A}} \cap {\text{B)'}}$= {4, 8, 12, 20, 24, 28}.
Hence, ${\text{(A}} \cup {\text{B)'}}$= {12} and ${\text{(A}} \cap {\text{B)'}}$= {4, 8, 12, 20, 24, 28}.

Note: Whenever you face such types of problems you need to know that $\cup \,{\text{and }} \cap$ are the signs of union and intersection. Union means collection of all the elements of all the sets provided and intersection between two sets means the element common in those sets will be considered and if there is a set P then P’ means all the elements except that of P. Proceeding with the help of this will solve your problem.


text:
# Q5. The masonry pier is subjected to the 800-kN load. If x=0.25m and y=0.5m determine the...

###### Question:

Q5. The masonry pier is subjected to the 800-kN load. If x=0.25m and y=0.5m determine the normal stress at each corner A, B, C, D (not shown) and plot the stress distribution over the cross section. Neglect the weight of the pier. 800 KN 1.5 1.5 m 2.25 m 2.25 m

#### Similar Solved Questions

##### 2. Compute the half-wave potential for the reduction of Fe to Fe in 0.1 M KCIO4 at 3+ 25 °C. To d...
2. Compute the half-wave potential for the reduction of Fe to Fe in 0.1 M KCIO4 at 3+ 25 °C. To do so use: (0) the standard potential for the Fe Fe2 couple, (ii) diffusion coefficients of Fe and Fe2, calculated from molar ionic conductivities (iii) activity coefficients, calculated from the Deby...
##### Which correctly describes the functional significance of the RNA structures? Select one: a. Local base-parings are...
Which correctly describes the functional significance of the RNA structures? Select one: a. Local base-parings are the key causes of unique RNA 3-D structures. b. RNAs have various 3-D structures for their biological functions. c. Changes in RNA structures are employed in controls of transcription a...
##### 11. Working with Numbers and Graphs Q11 Suppose that an economy, producing at point A on...
11. Working with Numbers and Graphs Q11 Suppose that an economy, producing at point A on a production possibilities frontier, produces 200 units of good X and 500 units of good Y. Also suppose that, with the same resources and technology, the economy could produce at point B, which represents 350 un...
##### Identify and discuss potential benefits and pitfalls of technology usage in tackling ageing workforce.
Identify and discuss potential benefits and pitfalls of technology usage in tackling ageing workforce....


text:
# Team:HUST-China/Modelling

The genetic pathway we used in modelling work is described as below.

Fig 1.The pathway of genetic oscillator used in our project.

#### Approach and Result

Our modeling work includes 3 parts: (1)Feasibility, stability and sensitivity of single genetic oscillator and its parameters;
(2)Feasibility of multi cells’ oscillator made up by a group of single genetic oscillators and comparison with experiment data;
(3)Statistically analyzing our wet-lab result.

To finish part (1), we construct DDEs model, which superb model using ODEs because it is capable of describing time interval between expression of regulating protein and their binding to promoters; in other words, our model is much more precise than ODEs model. Moreover, DDEs model is more flexible than ODEs model, as we can degrade it into an ODEs one by setting lag equal to 0. Result of our model is satisfying, as our oscillator is stable while circumstance(Arabinose and IPTG) varies, and sensitive when itself($\tau$) changes. That is to say, it is easy for manipulate, which is good for further application.

To accomplish part (2), we use data from part (1) and simulate using Agent-Based Model. We then compare simulation outcome with our wet-lab data. There comes a promising result, as florescent intensity linearly related to expression of AraC of these two groups of data match each other well, namely our model is supported by our experiment. This model is extendable because it has capability simulating other problem in large population. Also method that used to compar wetlab and drylab data, which is Q-Q plot, provides a quick way for analyzing groups of data correspondent time interval remained unknown.

To fulfill part (3), we use Q-Q plot and K-S test to confirm that single transformed cells and co-transformed cells are different. We then use S-W test to demonstrate that the oscillatory behavior of our oscillator is not a Brownian motion, which is often neglected regardless of its importance.

#### Notes

Throughout the whole modelling work, we choose to study AraC instead of mRFP since they are in the same plasmid and we assumed that the expression rate of both protein is similar. By doing this, we can reduce the number of equations.


text:
Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

### desikachariar's blog

By desikachariar, 5 years ago, ,

I submitted a solution for the problem "http://codeforces.com/problemset/problem/14/B" Though the solution has a logical bug, It ran perfectly in my system (gave a output) but when submitted here it gave a runtime error. This happens sometimes with my friend also here. Can anyone help me with how this happened.

Submissions: http://codeforces.com/contest/14/submission/11125428 (without '#define's)

• +1

 » 5 years ago, # | ← Rev. 2 →   +4 size() method returns an unsigned integer, so if les is empty then les.size()-1 overflows and becomes a large positive value.Upd: the difference between your local run and Codeforces is probably the sizes of integer types. On my system sizeof(size_t) = sizeof(long long int) = 8, on Codeforces sizeof(size_t) = 4, sizeof(long long int) = 8.
•  » » 5 years ago, # ^ |   0 That was very useful. Thanks for helping.
•  » » » 5 years ago, # ^ |   +5 I can see how thankful you are from your profile pic :P
 » 5 years ago, # |   +1 ill countl = les.size()-1vector's size can be 0, and it is unsigned int. So count1 will be very big number. Just write:ill count1 = int(les.size())-1
•  » » 5 years ago, # ^ |   0 But then It should overflow in my system also right. Also ill is not unsigned but signed only. Anyway thanks for replying. I got where my mistake could be. I'll avoid writing like this next time.Thanks again.
 » 5 years ago, # |   0 while(countl >= 0 and les[countl] >= i)The problem lies in this line If count is -1 or less than 0 First condition is false but it still evaluates the second condition and returns falseSo in that way you are trying to access count[-1] To avoid this give the second condition inside the loop
•  » » 5 years ago, # ^ |   +6 As far as I know, it doesn't evaluate the second condition if the first is false, I always use this and never got a runtime error because of it .


text:
# RDP 2021-08: Job Loss, Subjective Expectations and Household Spending 5. Do Expectations Affect the Sensitivity of Household Spending to Unemployment?

So far we have documented 2 observations about Australian households. The first is that, as in other countries, individuals are able to foresee both job loss and job finding at least to some extent. The second observation is that at unemployment, households significantly reduce their spending. We now link these 2 findings and explore whether the sensitivity of consumption to unemployment is affected by whether the household expected to lose their job or not.

As shown in Section 4.1, standard consumption models predict that households will mostly adjust spending in response to unexpected shocks to current income. Any adjustment to expected income shocks could be taken as evidence against these theoretical models. We directly test these ideas within the following regression framework:

(5) $ln( grocerie s it )= β n it + α i + ϑ t +ρ y it−1 e +δ U it +ϕ U it * y it−1 e + ε it , ∀∈{ −2,−1,....3 }$

Equation (5) is specified in the same way as Equations (1) through (4), however here we only consider spending in the year of unemployment. We include the same controls as before but now also add a term for (lagged) job loss expectations of the household head, ${y}_{it-1}^{e}$. This measure ranges from 0 if they perceived no chance of job loss to 1 if they perceived job loss was certain. We also include an interaction term between lagged job loss expectations and a dummy for whether the household head became unemployed during the survey year.

Under this specification, the change in spending in response to unemployment is estimated by $\delta +\varphi *{y}_{it-1}^{e}$. Consider 2 extreme cases. The coefficient $\delta$ captures the effect of unemployment on spending for those working household heads that fully expect to not lose their jobs $\left({y}_{it-1}^{e}=0\right)$ and hence are completely ‘surprised’ by unemployment. The sum of the coefficients $\left(\delta +\varphi \right)$ captures the spending response to unemployment in the case in which a working household head fully expects to lose their job and hence is completely unsurprised by unemployment $\left({y}_{it-1}^{e}=1\right)$. The coefficient $\varphi$ therefore captures how the consumption sensitivity to unemployment varies with job loss expectations.

Within this framework we can also test whether household spending is sensitive to job loss expectations for households that do not lose their jobs. This is captured by the coefficient $\rho$ on the lagged job loss expectations term. This allows us to explore the links between job insecurity and household spending for all households, not just those actually affected by unemployment.

As before, we separately estimate Equation (5) for different types of spending as the dependent variable, including spending on groceries, meals eaten outside the home and all items (including durable goods).

Results for all 3 specifications are presented in Table 2. We find that the fall in spending at unemployment is large for those that are completely surprised by unemployment (as shown by the large negative coefficient, $\delta$). This is consistent with the predictions of standard workhorse models. But we also find that the fall in spending at unemployment is just as large when the household at least partly expects job loss (as shown by the negative coefficient on the sum of the coefficients, $\delta +\varphi$, and the fact that estimates of $\varphi$ are not significantly different from 0). This suggests that households adjust spending in response to a predictable change in income (unemployment), which contradicts the predictions of standard models. However, this result is consistent with prior empirical research suggesting that household spending is excessively sensitive to predictable income changes (Japelli and Pistaferri 2017).

For grocery expenditure, and spending on meals eaten outside the home, we find that lagged job loss probability does not provide any additional information about household expenditure, as shown by the estimates of $\rho$ that are not statistically significantly different from 0. This tells us that households who do not lose their jobs also do not adjust their spending on these expenditure categories when their expectations of job loss change. However, we find our estimate of $\rho$ to be significant and negative in the regression with total annual expenditure. The coefficient estimate of -0.04 means that households that change their probability of job loss from 0 (no chance) to 1 (100 per cent certainty) decrease their total spending in the following year by 4 per cent. This result provides some suggestive evidence that job security may matter for spending on some goods and services.

Table 2: Model Output
Unemployment, expectations and spending
Dependent variable Groceries Meals eaten outside the home Total expenditure
Unemployed $\left(\delta \right)$ −0.05***
(0.01)
−0.44***
(0.05)
−0.05*
(0.03)
Unemployed * lagged job loss probability $\left(\varphi \right)$ −0.03
(0.04)
0.11
(0.15)
−0.02
(0.07)
Lagged job loss probability $\left(\rho \right)$ 0.01
(0.01)
−0.03
(0.02)
−0.04**
(0.02)
Fixed effects Yes Yes Yes
R squared (overall) 0.31 0.01 0.16
Observations 96,060 91,461 30,558

Notes: ***, ** and * denote statistical significance at the 1, 5 and 10 per cent levels, respectively; standard errors in parentheses; coefficient estimate for year dummies and number of persons in household omitted

Sources: Authors' calculations; HILDA Survey Release 19.0


text:
# Atom, Bond, and Conformer Indices¶

The following methods return the unique index assigned to its associated object upon creation.

Note

There is a parallel method SetIdx as well. This is an advanced API that should never be used.

Warning

Atoms, bonds and conformers are stored inside the molecule. If the molecule is deallocated, the cached atoms, bonds, and conformers can not be accessed any longer.

## Unique Identifiers¶

This index can be used to distinguish one object from another, as it is unique amongst all objects of the same type of the same molecule. Indices are also stable, meaning a given object will have the same index throughout its lifetime, independent of any other molecule manipulations, e.g., reordering the molecule (OEMolBase.OrderAtoms), or the creation or deletion of other objects (OEMolBase.NewAtom or OEMolBase.DeleteAtom). The exception is the following methods.

These methods were designed with the intent of changing something about the underlying structure of the molecule, and thus are allowed to invalidate indices if they deem it necessary.

Indices can be assumed to be dense small integers greater than or equal to zero and less than the values returned by the following methods.

The index created on a new atom, bond, or conformer using OEMolBase.NewAtom, OEMolBase.NewBond, or OEMCMolBase.NewConf respectively is guaranteed to be greater than or equal to the index returned by the above methods.

## Parallel Data Structures¶

Indices are ideal for indexing into densely packed arrays of information about the molecule. Many OEChem TK functions use them to this end, e.g., OEAddMols, OESubsetMol, or OEDetermineComponents. The coordinates of a molecule are retrieved as an array of floating point values indexed by the atom indices. The following example demonstrates how to use the atom indices for a rudimentary XYZ file format writer.

Listing 1: Rudimentary XYZ writer

package openeye.docexamples.oechem;

import openeye.oechem.*;

public class XYZWriter {
public static void main(String argv[]) {
if (argv.length != 1)
oechem.OEThrow.Usage("XYZWriter <input>");

oemolistream ifs = new oemolistream();

if (!ifs.open(argv[0]))
oechem.OEThrow.Fatal("Unable to open " + argv[0]);

OEGraphMol mol = new OEGraphMol();
{
System.out.println(mol.NumAtoms());
System.out.println(mol.GetTitle());

float coords[] = new float[mol.GetMaxAtomIdx() * 3];
mol.GetCoords(coords);

for (OEAtomBase atom : mol.GetAtoms())
{
int idx = atom.GetIdx();

System.out.printf("%-3s%11.5f%11.5f%11.5f\n",
oechem.OEGetAtomicSymbol(atom.GetAtomicNum()),
coords[idx*3],
coords[idx*3+1],
coords[idx*3+2]);
}
}
ifs.close();
}
}

Computers are very efficient at doing this sort of sequential lookup. Whenever an efficient temporary data structure is needed to track information about a molecule indices should be used.

## Indices for Molecule Lookup Considered Harmful¶

Note that atom, bond, and conformer indices are not guaranteed to be sequential, or even created sequentially, and hence atom indices can not and should not be used to retrieve all of the atoms of a molecule. Even typing the following idiom may invalidate any chance of support and eliminate any glimmer of respect from OpenEye Scientific Software or the computational chemistry/cheminformatics community.

Warning

// Never ever, ever do this!!!
for (int i=0;i<=mol.NumAtoms();++i) {
OEAtomBase atom = mol.GetAtom(new OEHasAtomIdx(i));
// pretend atom is valid
}

There are far more efficient methods of crashing computer software that should be used instead.

The common misconception is that OEChem TK indices should be stored in order to reference back to an atom in the molecule. This leads to the idiom used in Listing 2 which is technically legal OEChem TK, however, is just as insidious as the previous code snippet. The code is supposed to mimic a common technique to cache particular atoms based on some expensive to calculate property. The property in this instance is whether the atom is alpha beta unsaturated.

Warning

Listing 2: Evil atom cache

package openeye.docexamples.oechem;

import java.util.*;
import openeye.oechem.*;

public class AtomSubsetEvil {
public static void main(String argv[]) {
OEGraphMol mol = new OEGraphMol(); // initialized somehow

ArrayList<Integer> acache = new ArrayList<Integer>(); // cache of atoms
for (OEAtomBase atom : mol.GetAtoms(new OEHasAlphaBetaUnsat()))

// pretend this code is deep in some inner loop that needs to go fast
for (int aidx : acache) {
OEAtomBase catom = mol.GetAtom(new OEHasAtomIdx(aidx)); // O(n) lookup!

// do something with the cached atom "catom"
catom.SetName("Hello World");
}
}
}

The OEMolBase.GetAtom method performs a linear, $$O(mol.NumAtoms())$$, search over the molecule looking for the first atom that matches the predicate. This leads to a multiplicative effect when looping over multiple atoms, calling GetAtom for each atom. The resulting algorithm is quadratic $$O(mol.NumAtoms()^2)$$, possibly destroying any benefits of caching the user’s expensive per atom calculation.

The proper way to store references to atoms for later use is to store the OEAtomBase itself. It is guaranteed that these atoms will be valid for the lifetime of the molecule.

This is regardless of molecule manipulations, e.g., reordering the molecule (OEMolBase.OrderAtoms), or the creation or deletion of other atoms (OEMolBase.NewAtom or OEMolBase.DeleteAtom). The Sweep and Compress methods are again exceptions to this rule.

Listing 3 demonstrates the proper way to create a cache of atoms. It is important to remember that the OEAtomBases in the container are only valid while the molecule exists. Using the atoms after the molecule is destroyed is undefined behavior (usually a segmentation fault).

Listing 3: Atom caching

package openeye.docexamples.oechem;

import java.util.*;
import openeye.oechem.*;

public class AtomSubsetGood {
public static void main(String argv[]) {
OEGraphMol mol = new OEGraphMol(); // initialized somehow

ArrayList<OEAtomBase> acache = new ArrayList<OEAtomBase>(); // cache of atoms
for (OEAtomBase atom : mol.GetAtoms(new OEHasAlphaBetaUnsat()))


text:
## A community for students. Sign up today

Here's the question you clicked on:

## frank0520 one year ago Suppose a, b, c and d are non-zero constants such that a d – b c = 1. Show that the augmented matrix a b | e c d | f  always represents a consistent and independent system of linear equations, no matter what the values of e and f.

• This Question is Closed
1. frank0520

This is what I got so far and now I'm stuck: $\left[\begin{matrix}a & b | e \\ c & d|f\end{matrix}\right]$ $\left[\begin{matrix}ac & bc|ec \\ ac & ad|fa\end{matrix}\right]$ $\left[\begin{matrix}ac & bc|ec \\ 0 & ad-bc|fa-ec\end{matrix}\right]$

#### Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy


text:
# Refine which network errors result in LNet Health activity

XMLWordPrintable

#### Details

• Improvement
• Status: Resolved
• Major
• Resolution: Fixed
• None
• None
• 9223372036854775807

#### Description

There are a category of errors, like unable to resolve address or route which shouldn't result in health of the remote or the local being decremented or recovered. This category of errors indicate that the remote address does not exist or is unreachable.

Rather than ignore these errors we decided that with the enhancement in https://jira.whamcloud.com/browse/LU-13569 we should instead have LND return LNET_MSG_STATUS_NETWORK_TIMEOUT to LNet so that both the local NI and remote NI health is ding'd. This way, if the problem really is with the remote NI then we can have that reflected in the health value for the remote NI and it can be accounted for on future sends. With LU-13569 we don't run the risk of forever recovering a remote NI that will never be returned to service.

Related to this, we decided that the LOCAL_TIMEOUT returned in kiblnd_check_conns() path should also be NETWORK_TIMEOUT:

kiblnd_check_conns()
...
list_for_each_entry_safe(tx, tx_tmp, &peer_ni->ibp_tx_queue, tx_list) {
if (ktime_compare(ktime_get(), tx->tx_deadline) >= 0) {
CWARN("Timed out tx for %s: %lld seconds\n",
libcfs_nid2str(peer_ni->ibp_nid),
ktime_ms_delta(ktime_get(),
list_move(&tx->tx_list, &timedout_txs);
}
}
...
if (!list_empty(&timedout_txs))
kiblnd_txlist_done(&timedout_txs, -ETIMEDOUT,
LNET_MSG_STATUS_LOCAL_TIMEOUT);

So for this ticket I plan to push three patches:
1. Modify lnet_health_check() so that NETWORK_TIMEOUT dings both local and remote NI health (this was the original design intent).
2. Modify kiblnd_check_conns() so that it returns NETWORK_TIMEOUT rather than LOCAL_TIMEOUT.
3. Modify the status for unresolvable address or route to return NETWORK_TIMEOUT.

3 probably needs to be based on top of the patches for LU-13569.

#### People

Chris Horn
Chris Horn


text:
# Write one equation each for decomposition reactions where energy is supplied in the form of heat, light or electricity:

9.5k views

Write one equation each for decomposition reactions where energy is supplied in the form of heat, light or electricity.

by (96.1k points)
selected

i.    Decomposition reaction that requires energy in the form of heat:


text:
+0

# what is the the square root of 5 squared plus 2 squared?

0
304
2

what is the the square root of 5 squared plus 2 squared?

Guest Mar 2, 2017
#1
+7348
0

what is the the square root of 5 squared plus 2 squared?

$$\sqrt{5^2+2^2}=\sqrt{34}=5.831$$

!

asinus  Mar 2, 2017
#2
+7348
+5

what is the the square root of 5 squared plus 2 squared?

Sorry! Thanks CPhill!

$$\sqrt{5^2+2^2}=\sqrt{25+4}=\sqrt{29}=5.38516$$ !

asinus  Mar 2, 2017


text:
# DynamicModule in packages [closed]

I want to write a Package with a function in it. fun[]:= (DynamicModule[{},(a=10;a)]) . This works fine,but when i call it twice, they are related to each other. how do i localize the values?

-

## closed as too localized by Ajasja, Artes, Mr.Wizard♦Jan 19 '13 at 8:19

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I recommend reading the help pages in the documentation center of Mathematica on DynamicModule. Let's consider the first example that is shown in the help and assign it to a function fun[]:

fun[]:= DynamicModule[{x}, {Slider[Dynamic[x]], Dynamic[x]}]

If you now call fun[] twice, the variable x will be local in each DynamicModule. The first Slider won't change the value of x in the second Slider. Your achieve a local variable by putting it into the curly brackets at the beginning of your DynamicModule (similarly to Module).

For your example, you have to put a into the curly brackets. Otherwise it will be globally accessible:

fun[]:= DynamicModule[
{a},
a=10;
a
]

Now a is a local variable inside the DynamicModule assigned to fun[].

-


text:
License
when quoting this document, please refer to the following
DOI:
URN: urn:nbn:de:0030-drops-18054
URL:

;

### Ambiguity and Communication

 pdf-format:

### Abstract

The ambiguity of a nondeterministic finite automaton (NFA) $N$ for input size $n$ is the maximal number of accepting computations of $N$ for an input of size $n$. For all $k,r \in \mathbb{N}$ we construct languages $L_{r,k}$ which can be recognized by NFA's with size $k \cdot$poly$(r)$ and ambiguity $O(n^k)$, but $L_{r,k}$ has only NFA's with exponential size, if ambiguity $o(n^k)$ is required. In particular, a hierarchy for polynomial ambiguity is obtained, solving a long standing open problem (Ravikumar and Ibarra, 1989, Leung, 1998).

### BibTeX - Entry

@InProceedings{hromkovic_et_al:LIPIcs:2009:1805,
author =	{Juraj Hromkovic and Georg Schnitger},
title =	{{Ambiguity and Communication}},
booktitle =	{26th International Symposium on Theoretical Aspects of Computer Science},
pages =	{553--564},
series =	{Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN =	{978-3-939897-09-5},
ISSN =	{1868-8969},
year =	{2009},
volume =	{3},
editor =	{Susanne Albers and Jean-Yves Marion},
publisher =	{Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik},
address =	{Dagstuhl, Germany},
URL =		{http://drops.dagstuhl.de/opus/volltexte/2009/1805},
URN =		{urn:nbn:de:0030-drops-18054},
doi =		{http://dx.doi.org/10.4230/LIPIcs.STACS.2009.1805},
annote =	{Keywords: Nondeterministic finite automata, Ambiguity, Communication complexity}
}

 Keywords: Nondeterministic finite automata, Ambiguity, Communication complexity Seminar: 26th International Symposium on Theoretical Aspects of Computer Science Related Scholarly Article: Issue date: 2009 Date of publication: 2009

DROPS-Home | Fulltext Search | Imprint


text:
• Create Account

### #ActualJuliean

Posted 15 April 2013 - 12:36 PM

In my implementation the models don't have access to the render queue, (in my opinion the model class should be independent on the Renderer), instead the model class has a method getStateGroups() an array containing the effect, material, mesh, model state groups.

My implementation isn't that different. I just gave the model a "Render"-method where I pass the render queue and let it submit its sort key, state groups and draw command.

void Model::Draw(render::IRenderer& render) const
{
const render::StateGroup* pInstanceStates = &m_states;
const render::StateGroup* pMaterialStates = &m_pMaterial->GetState();
const render::StateGroup* pEffectStates = &m_pMaterial->GetEffect().GetState();
const render::StateGroup* pMeshStates = &m_pMesh->GetState();
const render::StateGroup* groupArr[4] = { pInstanceStates, pMaterialStates, pEffectStates, pMeshStates };

render.Render(m_sortKey, &m_pMesh->GetDraw(), groupArr, 4);
}

I do agree that the model probably should be completely independand of the renderer, but for now, it works OK (going to change that somewhen). Note that I've adapted Hodgmans method of having draw calls seperated from state groups, and create an "render instance" out of all this data...

The Stage group is submitted individually before the models. How do you bind render targets/depth stencil buffers?

Right now the bound render targets are determined by the effect only:

void Effect::RenderTarget(unsigned int index, const Texture* pTexture)
{
const D3DTexture* pD3DTexture = nullptr;

if(pTexture != nullptr)
pD3DTexture = &pTexture->GetD3DTexture();

switch(index)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
}
}

I don't really know what else I'm going to need (probably per-material/per-instance/per-pass render targets too?), but as far as this is concerned, would you say this is ok? As far as clearing render targets goes, it obviously can't be per-effect, since that would clear the target every time I e.g. render another one of my lights, etc...

I don't have commands to set individual constants, instead I work with constant buffers, the model "SetVertexConstant"-method will change the value of the constant in a POD buffer then the model uses two commands, UpdateCBuffer (that fills a D3D buffer with the contents of the POD buffer containing the constants) and VSBindCBuffer0 (that binds the D3D buffer to the constant buffer slot 0 of the vertex stage)

I quess you are working with DirectX 11? does this concept of constant buffers also translate to DirectX9? In DX9 I've got up to 256 (I quess) constant registeres, and I figured the best direct way for now was to simply adress the register directly (when I'm going to implement shader permutations etc.. I'm going to think about another solution anyway)...

But as for the render target clearing, where'd you say this would fit here?

### #1Juliean

Posted 15 April 2013 - 12:36 PM

In my implementation the models don't have access to the render queue, (in my opinion the model class should be independent on the Renderer), instead the model class has a method getStateGroups() an array containing the effect, material, mesh, model state groups.

My implementation isn't that different. I just gave the model a "Render"-method where I pass the render queue and let it submit its sort key, state groups and draw command.

void Model::Draw(render::IRenderer& render) const
{
const render::StateGroup* pInstanceStates = &m_states;
const render::StateGroup* pMaterialStates = &m_pMaterial->GetState();
const render::StateGroup* pEffectStates = &m_pMaterial->GetEffect().GetState();
const render::StateGroup* pMeshStates = &m_pMesh->GetState();
const render::StateGroup* groupArr[4] = { pInstanceStates, pMaterialStates, pEffectStates, pMeshStates };

render.Render(m_sortKey, &m_pMesh->GetDraw(), groupArr, 4);
}

I do agree that the model probably should be completely independand of the renderer, but for now, it works OK (going to change that somewhen).

The Stage group is submitted individually before the models. How do you bind render targets/depth stencil buffers?

Right now the bound render targets are determined by the effect only:

void Effect::RenderTarget(unsigned int index, const Texture* pTexture)
{
const D3DTexture* pD3DTexture = nullptr;

if(pTexture != nullptr)
pD3DTexture = &pTexture->GetD3DTexture();

switch(index)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
}
}

I don't really know what else I'm going to need (probably per-material/per-instance/per-pass render targets too?), but as far as this is concerned, would you say this is ok? As far as clearing render targets goes, it obviously can't be per-effect, since that would clear the target every time I e.g. render another one of my lights, etc...

I don't have commands to set individual constants, instead I work with constant buffers, the model "SetVertexConstant"-method will change the value of the constant in a POD buffer then the model uses two commands, UpdateCBuffer (that fills a D3D buffer with the contents of the POD buffer containing the constants) and VSBindCBuffer0 (that binds the D3D buffer to the constant buffer slot 0 of the vertex stage)

I quess you are working with DirectX 11? does this concept of constant buffers also translate to DirectX9? In DX9 I've got up to 256 (I quess) constant registeres, and I figured the best direct way for now was to simply adress the register directly (when I'm going to implement shader permutations etc.. I'm going to think about another solution anyway)...

But as for the render target clearing, where'd you say this would fit here?

PARTNERS


text:
# An extension of Gaussian Isoperimetry

The Gaussian isoperimetric inequality (Tsirelson,Sudakov, Borell) states that among all sets of given Gaussian measure in the n-dimensional Euclidean space, half-spaces have the minimal Gaussian boundary measure. Suppose we put an additional restriction on the set, that it should be symmetric about the origin. Then can we conclude that quarter-spaces (intuitively the first and third quadrant in 2-dimensions, say) have the minimal Gaussian boundary measure?

-
Also, if possible, could someone please suggest a more readable version of the Gaussian isoperimetry proofs, and possibly other related references on Gaussian measures (like lecture notes or surveys available free on the internet)? –  BharatRam May 23 '11 at 17:10
A bit off topic, but you could find this helpful: a nice review connecting concentration (and isoperimetric inequalities) to Markov chains. This allows to study discrete analogues of the picture. Yann Ollivier, A survey of Ricci curvature for metric spaces and Markov chains (pdf) yann-ollivier.org/rech/publs/surveycurvmarkov.pdf –  Leonid Petrov May 24 '11 at 5:28
A little bit of computation shows that 'quarter-spaces' (or a symmetrization of halfspaces around the origin) is clearly not the best we can do. For example in two dimensions, just a circle of measure 1/2 has smaller boundary measure than the above set. But the question remains open. Also, thanks everyone, for the references. –  BharatRam May 24 '11 at 12:39
Following up on Ryan's suggestions, here's a paper by Barthe (subscription probably required) whose introduction suggests that the problem as you stated, and the analogous problem on the sphere, are open and difficult: journals.cambridge.org/action/… –  Mark Meckes May 24 '11 at 15:01
Nice find, Mark. –  Ryan O'Donnell May 25 '11 at 2:59
show 1 more comment

My guess is that the optimizer is actually a "strip"; i.e., a set of the form {$x : -t \leq x_1 \leq t$}. But I'm somewhat sure that the solution to this problem is not known. You might take a look at the discussion surrounding after Corollary 3.6 in this paper by Klartag and Regev:

http://eccc.hpi-web.de/report/2010/140/

Barthe may also have some relevant papers.

-
Suppose we are looking at sets of measure 1/2 say. Then t as above is root(2) erfinverse(.5) which is roughly .67449 The boundary measure in this case is .635553 Compared to a boundary measure of .588 in the case of a circle of measure 1/2. Assuming my calculations are correct. –  BharatRam May 24 '11 at 13:11
Yeah, that's very possible. So maybe a sphere is best in general? Another good question (which might suggest the answer) is whether the analogous isoperimetric problem on the surface of the sphere is solved. –  Ryan O'Donnell May 24 '11 at 13:46