The C++ language provides a general template-based implementation of complex numbers. Normally, these are using to manipulate numbers of the form $a + b i$, where $a, b$ are chosen as either 32 or 64 bit floating point numbers. These are respectively denoted by std::complex<float>
and std::complex<double>
. The language implements the standard multiplication, division, addition etc. operators on complex numbers.
Because the code provided to manipulate complex numbers is general, we can embed complex numbers within complex numbers, e.g. using std::complex<std::complex<double>>
, nesting arbitrarily deeply. The doubly nested data type is uniquely defined by four floating point numbers. It is thus representing numbers in a form $(a + b i) + (c + d i) j$, where $i^2 = -1$, $j^2 = -1$, and $a, b, c, d \in \mathbb{R}$.
I initially thought these would be related to quaternions, but the structure encountered here is not anti-commutative in the $i, j$ basis units which is apparently a property of quaternions. On top of that, these seem to not be equivalent to bicomplex numbers, because there is no third analog of the imaginary unit present, named $k$ in this article. I get the suspicion that std::complex<std::complex<double>>
is isomorphic to the complex numbers after reading the Frobenius theorem about real division algebras.
Is this the correct conclusion? If so, why? If not, what algebraic structure is std::complex<std::complex<double>>
isomorphic to?
std::complex<std::complex<double>>
. – Gavin Ridley Feb 10 '23 at 19:00