Within the past few weeks, I have been encountering and coding into my Python programs scripts for handling Quaternion Mathematics. Quaternion Algebra and Calculus is still a relatively new concept to me, so I'm still doing research on how Quaternions interact with various other values, such as Scalars, Tensors, and other Quaternions.
My question today has to do with Addition. Addition involving two quaternions is done on a 'per element' basis: if $q_0 = A + Bi + Cj + Dk$ and $q_1 = W + Xi + Yj + Zk$, with ${A, B, C, D, W, X, Y, Z} \in \mathbb R$ then
$$q_0 + q_1 = (A + W) + (B + X)i + (C + Y)j + (D + Z)k$$
My question now involves Quaternion Addition with a Scalar. Is a Scalar in this case to be represented as a Quaternion with $Bi + Cj + Dk = 0$? Is it even possible to add these two things directly? Or is there no such way or reason to perform this operation? I merely ask so as to determine whether or not to implement such functionality within my Python class...
By "scalar", I believe you mean a real number. It is normal to identify the real numbers $\Bbb{R}$ as a subalgebra of the quaternions $\Bbb{H}$, by identifying $x \in \Bbb{R}$ with $x + 0i + 0j + 0k$. So you work as if $\Bbb{R} \subseteq \Bbb{H}$. Operations between "scalars" and quaternions are then just special cases of the quaternion operations. In the usual mathematical notation, this is virtually invisible: the sum $x + (a + bi+cj+dk)$ of the real number $x$ and the quaternion $a +bi+cj+dk$ is $(x + a) + bi + cj+dk$: if you drop the brackets (because "addition is associative") you can't tell the difference. Of course, this is likely to look a bit more clunky in a programming language that doesn't allow you the freedom to overload operators that we enjoy in traditional mathematical notations.
As an aside: you can similarly identify the complex numbers $\Bbb{C}$ with a subalgebra of $\Bbb{H}$ by identifying $x + yi$ with $x + yi + 0j + 0k$, but that is not the only possibility: given any purely imaginary quaternion $u = bi + cj + dk$ with $b^2 + c^2 + d^2 = 1$, you can identify $ x + yi$ with $x + yu$. The quaternions have only one subalgebra isomorphic to the real numbers, but they have an abundance of subalgebras isomorphic to the complex numbers, one for each point $(b, c, d)$ on the unit sphere in $\Bbb{R}^3$.