From: Michael Orlitzky Date: Tue, 20 Aug 2019 14:05:39 +0000 (-0400) Subject: eja: add norm() and trace_norm() methods for elements. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=257faa05a58651e2fbad0545c6413cc3e9203539;p=sage.d.git eja: add norm() and trace_norm() methods for elements. --- diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index aef1c5d..a681ae2 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -829,6 +829,33 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): return W.linear_combination(zip(B,self.to_vector())) + def norm(self): + """ + The norm of this element with respect to :meth:`inner_product`. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (JordanSpinEJA, + ....: RealCartesianProductEJA) + + EXAMPLES:: + + sage: J = RealCartesianProductEJA(2) + sage: x = sum(J.gens()) + sage: x.norm() + sqrt(2) + + :: + + sage: J = JordanSpinEJA(4) + sage: x = sum(J.gens()) + sage: x.norm() + 2 + + """ + return self.inner_product(self).sqrt() + + def operator(self): """ Return the left-multiplication-by-this-element @@ -1177,3 +1204,30 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): raise TypeError("'other' must live in the same algebra") return (self*other).trace() + + + def trace_norm(self): + """ + The norm of this element with respect to :meth:`trace_inner_product`. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (JordanSpinEJA, + ....: RealCartesianProductEJA) + + EXAMPLES:: + + sage: J = RealCartesianProductEJA(2) + sage: x = sum(J.gens()) + sage: x.trace_norm() + sqrt(2) + + :: + + sage: J = JordanSpinEJA(4) + sage: x = sum(J.gens()) + sage: x.trace_norm() + 2*sqrt(2) + + """ + return self.trace_inner_product(self).sqrt()