This is in contrast with the usual indexing that returns only
a coefficient.
- .. WARNING:
-
- This returns zero if you request a component that does
- not exist (with ``i`` strictly less than ``j``).
-
SETUP::
sage: from mjo.clan.t_algebra_clan import RealSymmetricClan
+ sage: from mjo.clan.vinberg_clan import VinbergClan
EXAMPLES::
[ 0 0 0]
[ 0 0 18]
+ TESTS::
+
+ sage: C = VinbergClan()
+ sage: x = C.random_element()
+ sage: x.elt(pi, 1)
+ Traceback (most recent call last):
+ ...
+ TypeError: i=pi and j=1 must be integral
+ sage: x.elt(1, 2)
+ Traceback (most recent call last):
+ ...
+ IndexError: i=1 must be greater than or equal to j=2
+
"""
+ from sage.rings.integer_ring import ZZ
+ if not (i in ZZ and j in ZZ):
+ raise TypeError(f"i={i} and j={j} must be integral")
+ if not j <= i:
+ raise IndexError (f"i={i} must be greater than or equal to j={j}")
+
return self.parent().sum_of_terms(
item
for item in self.items()