Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fixing trivial failing doctests due to new iterator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Apr 10, 2016
1 parent ee0536e commit c95e024
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/sage/algebras/associated_graded.py
Expand Up @@ -139,10 +139,10 @@ class AssociatedGradedAlgebra(CombinatorialFreeModule):
``grA`` are isomorphic::
sage: grA(A.an_element())
bar(U['x']^2*U['y']^2*U['z']^3)
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(U['z']) + 3*bar(1)
sage: elt = A.an_element() + A.algebra_generators()['x'] + 2
sage: grelt = grA(elt); grelt
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
bar(U['x']^2*U['y']^2*U['z']^3) + 2*bar(U['x']) + 2*bar(U['z']) + 5*bar(1)
sage: A(grelt) == elt
True
Expand Down Expand Up @@ -241,8 +241,10 @@ def _element_constructor_(self, x):
sage: grA = A.graded_algebra()
sage: grA(A.an_element())
bar(U['x']^2*U['y']^2*U['z']^3)
+ bar(U['x']) + 2*bar(U['z']) + 3*bar(1)
sage: grA(A.an_element() + A.algebra_generators()['x'] + 2)
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
bar(U['x']^2*U['y']^2*U['z']^3)
+ 2*bar(U['x']) + 2*bar(U['z']) + 5*bar(1)
"""
if isinstance(x, CombinatorialFreeModule.Element):
if x.parent() is self._A:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/jordan_algebra.py
Expand Up @@ -287,7 +287,7 @@ def _an_element_(self):
sage: F.<x,y,z> = FreeAlgebra(QQ)
sage: J = JordanAlgebra(F)
sage: J.an_element()
x
2*y + 2*y^2 + 3*y^2*z
"""
return self.element_class(self, self._A.an_element())

Expand Down
6 changes: 5 additions & 1 deletion src/sage/categories/examples/filtered_algebras_with_basis.py
Expand Up @@ -114,8 +114,12 @@ def degree_on_basis(self, m):
sage: A.degree_on_basis((x^4).leading_support())
4
sage: a = A.an_element(); a
U['x']^2*U['y']^2*U['z']^3 + U['x'] + 2*U['z'] + 3
sage: A.degree_on_basis(a.trailing_support())
1
sage: s = sorted(a.support(), key=str)[2]; s
U['x']^2*U['y']^2*U['z']^3
sage: A.degree_on_basis(a.leading_support())
sage: A.degree_on_basis(s)
7
"""
return len(m)
Expand Down
9 changes: 5 additions & 4 deletions src/sage/categories/filtered_algebras_with_basis.py
Expand Up @@ -131,9 +131,10 @@ def to_graded_conversion(self):
sage: A = Algebras(QQ).WithBasis().Filtered().example()
sage: p = A.an_element() + A.algebra_generators()['x'] + 2; p
U['x']^2*U['y']^2*U['z']^3 + U['x'] + 2
U['x']^2*U['y']^2*U['z']^3 + 2*U['x'] + 2*U['z'] + 5
sage: q = A.to_graded_conversion()(p); q
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
bar(U['x']^2*U['y']^2*U['z']^3)
+ 2*bar(U['x']) + 2*bar(U['z']) + 5*bar(1)
sage: q.parent() is A.graded_algebra()
True
"""
Expand All @@ -159,7 +160,7 @@ def from_graded_conversion(self):
sage: A = Algebras(QQ).WithBasis().Filtered().example()
sage: p = A.an_element() + A.algebra_generators()['x'] + 2; p
U['x']^2*U['y']^2*U['z']^3 + U['x'] + 2
U['x']^2*U['y']^2*U['z']^3 + 2*U['x'] + 2*U['z'] + 5
sage: q = A.to_graded_conversion()(p)
sage: A.from_graded_conversion()(q) == p
True
Expand Down Expand Up @@ -190,7 +191,7 @@ def projection(self, i):
sage: A = Algebras(QQ).WithBasis().Filtered().example()
sage: p = A.an_element() + A.algebra_generators()['x'] + 2; p
U['x']^2*U['y']^2*U['z']^3 + U['x'] + 2
U['x']^2*U['y']^2*U['z']^3 + 2*U['x'] + 2*U['z'] + 5
sage: q = A.projection(7)(p); q
bar(U['x']^2*U['y']^2*U['z']^3)
sage: q.parent() is A.graded_algebra()
Expand Down
19 changes: 12 additions & 7 deletions src/sage/categories/filtered_modules_with_basis.py
Expand Up @@ -832,12 +832,14 @@ def homogeneous_component(self, n):
0
sage: A = AlgebrasWithBasis(ZZ).Filtered().example()
sage: g = A.an_element() - 2 * A.algebra_generators()['x'] * A.algebra_generators()['y']; g
sage: G = A.algebra_generators()
sage: g = A.an_element() - 2 * G['x'] * G['y']; g
U['x']^2*U['y']^2*U['z']^3 - 2*U['x']*U['y']
+ U['x'] + 2*U['z'] + 3
sage: g.homogeneous_component(-1)
0
sage: g.homogeneous_component(0)
0
3
sage: g.homogeneous_component(2)
-2*U['x']*U['y']
sage: g.homogeneous_component(5)
Expand Down Expand Up @@ -896,22 +898,25 @@ def truncate(self, n):
2*P[] + 2*P[1] + 3*P[2]
sage: A = AlgebrasWithBasis(ZZ).Filtered().example()
sage: g = A.an_element() - 2 * A.algebra_generators()['x'] * A.algebra_generators()['y']; g
sage: G = A.algebra_generators()
sage: g = A.an_element() - 2 * G['x'] * G['y']; g
U['x']^2*U['y']^2*U['z']^3 - 2*U['x']*U['y']
+ U['x'] + 2*U['z'] + 3
sage: g.truncate(-1)
0
sage: g.truncate(0)
0
sage: g.truncate(2)
0
U['x'] + 2*U['z'] + 3
sage: g.truncate(3)
-2*U['x']*U['y']
-2*U['x']*U['y'] + U['x'] + 2*U['z'] + 3
sage: g.truncate(5)
-2*U['x']*U['y']
-2*U['x']*U['y'] + U['x'] + 2*U['z'] + 3
sage: g.truncate(7)
-2*U['x']*U['y']
-2*U['x']*U['y'] + U['x'] + 2*U['z'] + 3
sage: g.truncate(8)
U['x']^2*U['y']^2*U['z']^3 - 2*U['x']*U['y']
+ U['x'] + 2*U['z'] + 3
TESTS:
Expand Down

0 comments on commit c95e024

Please sign in to comment.