Simultaneous action of two Quaternions If we have a quaternion Q1 and Q2 that defines rotations (r1, r2) of an object about an axis (x1, y1, z1) and (x2,y2,z2). How to represent simultaneous action of the both quaternions?. Is there any way to define a "resultant quaternion" like a resultant vector?. I would like to rotate a vector when influenced by Q1 and Q2 simultaneously. Thanks for any input.
 A: Quaternions are not necessary for the answer I am giving, as this can be done in any dimension using lie algebras.
If $R$ and $S$ are rotations, then $RS$ and $SR$ are constructed by first performing one rotation and then the other - you don't perform both at the same time. We need to create an interpretation for "at the same time." The way to do this is through lie theory. Heuristically, every rotation is infinitely many applications of infinitessimal rotations, and so if we combine the infinitessimal rotations associated with $R$ and $S$ and apply it infinitely many times we get your desired "resultant."
Now let's make these ideas rigorous. The matrix Lie group $\mathrm{SO}(n)$ is a differentiable manifold, so any differentiable path $p:[0,1]\to\mathrm{SO}(n)$ can be differentiated and evaluated at $0$ yielding a tangent vector (that is, an element of $M_n(\mathbb{R})$ which is tangent to $\mathrm{SO}(n)$ at the identity $I$). The collection of all of these velocity vectors is a vector subspace $\mathfrak{so}(n)\subset M_n(\mathbb{R})$. It actually has more structure making it a lie algebra, but we don't need to discuss the commutator.
Any map $\phi:\mathbb{R}\to\mathrm{SO}(n)$ which is a homomorphism is called a one-parameter subgroup. So for instance in 3D, if $R(\ell,\theta)$ denotes the rotation around an oriented axis $\ell$ by an angle $\theta$, then the map $\theta\mapsto R(\ell,\theta)$ will be a one-parameter subgroup for every $\ell$. Every velocity vector $X\in\mathfrak{so}(n)$ is actually the velocity vector of a one-parameter subgroup $\phi(t):=\exp(tX)$.
This function $\exp:\mathfrak{so}(n)\to\mathrm{SO}(n)$ is called the exponential map. We can define it using power series as $\exp(X)=\sum_{n=0}^\infty \frac{1}{n!}X^n$, or we could use the more suggestive formula $$\exp(X)=\lim_{n\to\infty}\left(1+\frac{X}{n}\right)^n.$$
To understand this formula, consider the 2-dimensional case, which we can do using the complex plane. The rotations are multiplication by elements of $S^1$ (those $z\in\mathbb{C}$ with $|z|=1$). Specifically, counterclockwise rotation by $\theta$ is multiplication by $e^{i\theta}$. Differentiating $e^{i\theta}$ and evaluating at $\theta=0$ yields a velocity vector $i$. Indeed, the lie algebra here is just the imaginary axis $i\mathbb{R}$. Then for very large $n$, the expression $1+i\theta/n$ is approximately the element of $S^1$ an angle of $\theta/n$ away from $1$, and applying this $n$ times (i.e. taking to the $n$th power) should be approximately rotation by an angle of $\theta$, hence $e^{i\theta}\approx (1+i\theta/n)^n$.
Instead of just considering rotations $R$ and $S$, consider "rotations with speed," i.e. a one-parameter subgroup $R,S:\mathbb{R}\to\mathrm{SO}(n)$. Say they have velocity vectors $E$ and $F$. Then while $R(t)S(t)$ may not be a path, it still has a velocity vector which is $E+F\in\mathfrak{so}(n)$. We can then interpret $E+F$ as the infinitessimal rotation associated with a one-parameter subgroup $\exp(t(E+F))$.

If you want to just work with 3D rotations coming from quaternions, then you can combine $e^{\mathbf{u}}$ and $e^{\mathbf{v}}$ to get $e^{\mathbf{u}+\mathbf{v}}$, however you should be aware that $(e^{\mathbf{u}},e^{\mathbf{v}})\mapsto e^{\mathbf{u}+\mathbf{v}}$ is not well-defined. That is, it's possible to have imaginary quaternions satisfying $e^{\mathbf{u}_1}=e^{\mathbf{u}_2}$ and $e^{\mathbf{v}_1}=e^{\mathbf{v_2}}$ but $e^{\mathbf{u}_1+\mathbf{v}_1}\ne e^{\mathbf{u}_2+\mathbf{v}_2}$.
The way to make sense of this then is to think of it as combining a one-parameter subgroup $e^{t\mathbf{u}}$ with another $e^{t\mathbf{v}}$ to get a third $e^{t(\mathbf{u}+\mathbf{v})}$.
A: Just to translate arctic tern's answer in to a rough recipe/gamedev speak:
Take your two rotations in axis angle format, so that you have a normalized axis $\hat{n}$ and a rotation around it $\theta$ for each rotation.  Combine them in to a rotation vector which is just
$$v = \theta \hat{n}$$
(A rotation can be represented as as $e^v$.  This is where arctic tern's answer comes in).
You can additively combine rotation vectors to combine simultaneous rotations, forming a new rotation vector.  eg, for two rotations, you have
$$\theta_{3} \hat{n_3} = \theta_1 \hat{n_1} + \theta_2 \hat{n_2}$$
$\theta_3$ is your new angle and $\hat{n_3}$ is your new axis of rotation.  Rebuild your quaternion/rotation matrix from them and your done.
