Test the second polarization identity from my notes or from
Baes (2.4)::
- sage: x,y,z = random_eja().random_elements(3) # long time
- sage: Lx = x.operator() # long time
- sage: Ly = y.operator() # long time
- sage: Lz = z.operator() # long time
- sage: Lzy = (z*y).operator() # long time
- sage: Lxy = (x*y).operator() # long time
- sage: Lxz = (x*z).operator() # long time
- sage: lhs = Lx*Lzy + Lz*Lxy + Ly*Lxz # long time
- sage: rhs = Lzy*Lx + Lxy*Lz + Lxz*Ly # long time
- sage: bool(lhs == rhs) # long time
+ sage: # long time
+ sage: x,y,z = random_eja().random_elements(3)
+ sage: Lx = x.operator()
+ sage: Ly = y.operator()
+ sage: Lz = z.operator()
+ sage: Lzy = (z*y).operator()
+ sage: Lxy = (x*y).operator()
+ sage: Lxz = (x*z).operator()
+ sage: lhs = Lx*Lzy + Lz*Lxy + Ly*Lxz
+ sage: rhs = Lzy*Lx + Lxy*Lz + Lxz*Ly
+ sage: bool(lhs == rhs)
True
Test the third polarization identity from my notes or from
Baes (2.5)::
- sage: u,y,z = random_eja().random_elements(3) # long time
- sage: Lu = u.operator() # long time
- sage: Ly = y.operator() # long time
- sage: Lz = z.operator() # long time
- sage: Lzy = (z*y).operator() # long time
- sage: Luy = (u*y).operator() # long time
- sage: Luz = (u*z).operator() # long time
- sage: Luyz = (u*(y*z)).operator() # long time
- sage: lhs = Lu*Lzy + Lz*Luy + Ly*Luz # long time
- sage: rhs = Luyz + Ly*Lu*Lz + Lz*Lu*Ly # long time
- sage: bool(lhs == rhs) # long time
+ sage: # long time
+ sage: u,y,z = random_eja().random_elements(3)
+ sage: Lu = u.operator()
+ sage: Ly = y.operator()
+ sage: Lz = z.operator()
+ sage: Lzy = (z*y).operator()
+ sage: Luy = (u*y).operator()
+ sage: Luz = (u*z).operator()
+ sage: Luyz = (u*(y*z)).operator()
+ sage: lhs = Lu*Lzy + Lz*Luy + Ly*Luz
+ sage: rhs = Luyz + Ly*Lu*Lz + Lz*Lu*Ly
+ sage: bool(lhs == rhs)
True
"""
of an element is the inverse of its left-multiplication operator
applied to the algebra's identity, when that inverse exists::
- sage: J = random_eja() # long time
- sage: x = J.random_element() # long time
- sage: (not x.operator().is_invertible()) or ( # long time
- ....: x.operator().inverse()(J.one()) # long time
- ....: == # long time
- ....: x.inverse() ) # long time
+ sage: # long time
+ sage: J = random_eja()
+ sage: x = J.random_element()
+ sage: (not x.operator().is_invertible()) or (
+ ....: x.operator().inverse()(J.one())
+ ....: ==
+ ....: x.inverse() )
True
Check that the fast (cached) and slow algorithms give the same
answer::
- sage: J = random_eja(field=QQ, orthonormalize=False) # long time
- sage: x = J.random_element() # long time
- sage: while not x.is_invertible(): # long time
- ....: x = J.random_element() # long time
- sage: slow = x.inverse() # long time
- sage: _ = J._charpoly_coefficients() # long time
- sage: fast = x.inverse() # long time
- sage: slow == fast # long time
+ sage: J = random_eja(field=QQ, orthonormalize=False)
+ sage: x = J.random_element()
+ sage: while not x.is_invertible():
+ ....: x = J.random_element()
+ sage: slow = x.inverse()
+ sage: _ = J._charpoly_coefficients()
+ sage: fast = x.inverse()
+ sage: slow == fast
True
"""
not_invertible_msg = "element is not invertible"
Test that the fast (cached) and slow algorithms give the same
answer::
- sage: J = random_eja(field=QQ, orthonormalize=False) # long time
- sage: x = J.random_element() # long time
- sage: slow = x.is_invertible() # long time
- sage: _ = J._charpoly_coefficients() # long time
- sage: fast = x.is_invertible() # long time
- sage: slow == fast # long time
+ sage: # long time
+ sage: J = random_eja(field=QQ, orthonormalize=False)
+ sage: x = J.random_element()
+ sage: slow = x.is_invertible()
+ sage: _ = J._charpoly_coefficients()
+ sage: fast = x.is_invertible()
+ sage: slow == fast
True
"""
if self.is_zero():