Closed
Description
From the manual:
For a quaternion z = c_1 e + c_2 i + c_3 j + c_4 k, ComplexConjugate returns c_1 e - c_2 i - c_3 j - c_4 k, [...]
When ComplexConjugate is defined for an object z then RealPart and ImaginaryPart return (z + ComplexConjugate( z )) / 2 and (z - ComplexConjugate( z )) / 2 i, respectively, where i denotes the corresponding imaginary unit.
But what is the "corresponding imaginary unit" ?
The code in lib/algsc.gi
does not clarify, to the contrary, I don't understand how it is supposed to be correct. It says this:
InstallMethod( ImaginaryPart,
"for a quaternion",
[ IsQuaternion and IsSCAlgebraObj ],
function( quat )
local v, z;
v:= ExtRepOfObj( quat );
z:= Zero( v[1] );
return ObjByExtRep( FamilyObj( quat ), [ v[2], z, v[4], -v[3] ] );
end );
That looks to me as if it can only be valid for a single specific set of parameters a,b
, not in general. But note this:
gap> A:= QuaternionAlgebra( Rationals );
<algebra-with-one of dimension 4 over Rationals>
gap> AssignGeneratorVariables(A);
#I Assigned the global variables [ e, i, j, k ]
gap> v:=e+i+j+k;
e+i+j+k
gap> (v - ComplexConjugate( v )) / (2*i);
e+(-1)*j+k
gap> ImaginaryPart(v);
e+j+(-1)*k
Perhaps @ThomasBreuer has some insights on this?