Filtered Algebras With Basis¶
A filtered algebra with basis over a commutative ring \(R\)
is a filtered algebra over \(R\) endowed with the structure
of a filtered module with basis (with the same underlying
filtered-module structure). See
FilteredAlgebras and
FilteredModulesWithBasis
for these two notions.
- class sage.categories.filtered_algebras_with_basis.FilteredAlgebrasWithBasis(base_category)[source]¶
Bases:
FilteredModulesCategoryThe category of filtered algebras with a distinguished homogeneous basis.
A filtered algebra with basis over a commutative ring \(R\) is a filtered algebra over \(R\) endowed with the structure of a filtered module with basis (with the same underlying filtered-module structure). See
FilteredAlgebrasandFilteredModulesWithBasisfor these two notions.EXAMPLES:
sage: C = AlgebrasWithBasis(ZZ).Filtered(); C Category of filtered algebras with basis over Integer Ring sage: sorted(C.super_categories(), key=str) [Category of algebras with basis over Integer Ring, Category of filtered algebras over Integer Ring, Category of filtered modules with basis over Integer Ring]
>>> from sage.all import * >>> C = AlgebrasWithBasis(ZZ).Filtered(); C Category of filtered algebras with basis over Integer Ring >>> sorted(C.super_categories(), key=str) [Category of algebras with basis over Integer Ring, Category of filtered algebras over Integer Ring, Category of filtered modules with basis over Integer Ring]
- class ParentMethods[source]¶
Bases:
object- from_graded_conversion()[source]¶
Return the inverse of the canonical \(R\)-module isomorphism \(A \to \operatorname{gr} A\) induced by the basis of \(A\) (where \(A = ` ``self`\)). This inverse is an isomorphism \(\operatorname{gr} A \to A\).
This is an isomorphism of \(R\)-modules, not of algebras. See the class documentation
AssociatedGradedAlgebra.See also
EXAMPLES:
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 + 3*U['x'] + 3*U['y'] + 3 sage: q = A.to_graded_conversion()(p) sage: A.from_graded_conversion()(q) == p True sage: q.parent() is A.graded_algebra() True
>>> from sage.all import * >>> A = Algebras(QQ).WithBasis().Filtered().example() >>> p = A.an_element() + A.algebra_generators()['x'] + Integer(2); p U['x']^2*U['y']^2*U['z']^3 + 3*U['x'] + 3*U['y'] + 3 >>> q = A.to_graded_conversion()(p) >>> A.from_graded_conversion()(q) == p True >>> q.parent() is A.graded_algebra() True
- graded_algebra()[source]¶
Return the associated graded algebra to
self.See
AssociatedGradedAlgebrafor the definition and the properties of this.If the filtered algebra
selfwith basis is called \(A\), then this method returns \(\operatorname{gr} A\). The methodto_graded_conversion()returns the canonical \(R\)-module isomorphism \(A \to \operatorname{gr} A\) induced by the basis of \(A\), and the methodfrom_graded_conversion()returns the inverse of this isomorphism. The methodprojection()projects elements of \(A\) onto \(\operatorname{gr} A\) according to their place in the filtration on \(A\).Warning
When not overridden, this method returns the default implementation of an associated graded algebra – namely,
AssociatedGradedAlgebra(self), whereAssociatedGradedAlgebraisAssociatedGradedAlgebra. But many instances ofFilteredAlgebrasWithBasisoverride this method, as the associated graded algebra often is (isomorphic) to a simpler object (for instance, the associated graded algebra of a graded algebra can be identified with the graded algebra itself). Generic code that uses associated graded algebras (such as the code of theinduced_graded_map()method below) should make sure to only communicate with them via theto_graded_conversion(),from_graded_conversion(), andprojection()methods (in particular, do not expect there to be a conversion fromselftoself.graded_algebra(); this currently does not work for Clifford algebras). Similarly, when overridinggraded_algebra(), make sure to accordingly redefine these three methods, unless their definitions below still apply to your case (this will happen whenever the basis of yourgraded_algebra()has the same indexing set asself, and the partition of this indexing set according to degree is the same as forself).Todo
Maybe the thing about the conversion from
selftoself.graded_algebra()on the Clifford at least could be made to work? (I would still warn the user against ASSUMING that it must work – as there is probably no way to guarantee it in all cases, and we shouldn’t require users to mess with element constructors.)EXAMPLES:
sage: A = AlgebrasWithBasis(ZZ).Filtered().example() sage: A.graded_algebra() Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Integer Ring
>>> from sage.all import * >>> A = AlgebrasWithBasis(ZZ).Filtered().example() >>> A.graded_algebra() Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Integer Ring
- induced_graded_map(other, f)[source]¶
Return the graded linear map between the associated graded algebras of
selfandothercanonically induced by the filtration-preserving mapf : self -> other.Let \(A\) and \(B\) be two filtered algebras with basis, and let \((F_i)_{i \in I}\) and \((G_i)_{i \in I}\) be their filtrations. Let \(f : A \to B\) be a linear map which preserves the filtration (i.e., satisfies \(f(F_i) \subseteq G_i\) for all \(i \in I\)). Then, there is a canonically defined graded linear map \(\operatorname{gr} f : \operatorname{gr} A \to \operatorname{gr} B\) which satisfies
\[(\operatorname{gr} f) (p_i(a)) = p_i(f(a)) \qquad \text{for all } i \in I \text{ and } a \in F_i ,\]where the \(p_i\) on the left hand side is the canonical projection from \(F_i\) onto the \(i\)-th graded component of \(\operatorname{gr} A\), while the \(p_i\) on the right hand side is the canonical projection from \(G_i\) onto the \(i\)-th graded component of \(\operatorname{gr} B\).
INPUT:
other– a filtered algebra with basisf– a filtration-preserving linear map fromselftoother(can be given as a morphism or as a function)
OUTPUT: the graded linear map \(\operatorname{gr} f\)
EXAMPLES:
Example 1.
We start with the universal enveloping algebra of the Lie algebra \(\RR^3\) (with the cross product serving as Lie bracket):
sage: A = AlgebrasWithBasis(QQ).Filtered().example(); A An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field sage: M = A.indices(); M Free abelian monoid indexed by {'x', 'y', 'z'} sage: x,y,z = [A.basis()[M.gens()[i]] for i in "xyz"]
>>> from sage.all import * >>> A = AlgebrasWithBasis(QQ).Filtered().example(); A An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field >>> M = A.indices(); M Free abelian monoid indexed by {'x', 'y', 'z'} >>> x,y,z = [A.basis()[M.gens()[i]] for i in "xyz"]
Let us define a stupid filtered map from
Ato itself:sage: def map_on_basis(m): ....: d = m.dict() ....: i = d.get('x', 0); j = d.get('y', 0); k = d.get('z', 0) ....: g = (y ** (i+j)) * (z ** k) ....: if i > 0: ....: g += i * (x ** (i-1)) * (y ** j) * (z ** k) ....: return g sage: f = A.module_morphism(on_basis=map_on_basis, ....: codomain=A) sage: f(x) U['y'] + 1 sage: f(x*y*z) U['y']^2*U['z'] + U['y']*U['z'] sage: f(x*x*y*z) U['y']^3*U['z'] + 2*U['x']*U['y']*U['z'] sage: f(A.one()) 1 sage: f(y*z) U['y']*U['z']
>>> from sage.all import * >>> def map_on_basis(m): ... d = m.dict() ... i = d.get('x', Integer(0)); j = d.get('y', Integer(0)); k = d.get('z', Integer(0)) ... g = (y ** (i+j)) * (z ** k) ... if i > Integer(0): ... g += i * (x ** (i-Integer(1))) * (y ** j) * (z ** k) ... return g >>> f = A.module_morphism(on_basis=map_on_basis, ... codomain=A) >>> f(x) U['y'] + 1 >>> f(x*y*z) U['y']^2*U['z'] + U['y']*U['z'] >>> f(x*x*y*z) U['y']^3*U['z'] + 2*U['x']*U['y']*U['z'] >>> f(A.one()) 1 >>> f(y*z) U['y']*U['z']
(There is nothing here that is peculiar to this universal enveloping algebra; we are only using its module structure, and we could just as well be using a polynomial algebra in its stead.)
We now compute \(\operatorname{gr} f\)
sage: grA = A.graded_algebra(); grA Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field sage: xx, yy, zz = [A.to_graded_conversion()(i) for i in [x, y, z]] sage: xx+yy*zz bar(U['y']*U['z']) + bar(U['x']) sage: grf = A.induced_graded_map(A, f); grf Generic endomorphism of Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field sage: grf(xx) bar(U['y']) sage: grf(xx*yy*zz) bar(U['y']^2*U['z']) sage: grf(xx*xx*yy*zz) bar(U['y']^3*U['z']) sage: grf(grA.one()) bar(1) sage: grf(yy*zz) bar(U['y']*U['z']) sage: grf(yy*zz-2*yy) bar(U['y']*U['z']) - 2*bar(U['y'])
>>> from sage.all import * >>> grA = A.graded_algebra(); grA Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field >>> xx, yy, zz = [A.to_graded_conversion()(i) for i in [x, y, z]] >>> xx+yy*zz bar(U['y']*U['z']) + bar(U['x']) >>> grf = A.induced_graded_map(A, f); grf Generic endomorphism of Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field >>> grf(xx) bar(U['y']) >>> grf(xx*yy*zz) bar(U['y']^2*U['z']) >>> grf(xx*xx*yy*zz) bar(U['y']^3*U['z']) >>> grf(grA.one()) bar(1) >>> grf(yy*zz) bar(U['y']*U['z']) >>> grf(yy*zz-Integer(2)*yy) bar(U['y']*U['z']) - 2*bar(U['y'])
Example 2.
We shall now construct \(\operatorname{gr} f\) for a different map \(f\) out of the same
A; the new map \(f\) will lead into a graded algebra already, namely into the algebra of symmetric functions:sage: # needs sage.combinat sage.modules sage: h = SymmetricFunctions(QQ).h() sage: def map_on_basis(m): # redefining map_on_basis ....: d = m.dict() ....: i = d.get('x', 0); j = d.get('y', 0); k = d.get('z', 0) ....: g = (h[1] ** i) * (h[2] ** (j // 2) * (h[3] ** (k // 3))) ....: g += i * (h[1] ** (i+j+k)) ....: return g sage: f = A.module_morphism(on_basis=map_on_basis, ....: codomain=h) # redefining f sage: f(x) 2*h[1] sage: f(y) h[] sage: f(z) h[] sage: f(y**2) h[2] sage: f(x**2) 3*h[1, 1] sage: f(x*y*z) h[1] + h[1, 1, 1] sage: f(x*x*y*y*z) 2*h[1, 1, 1, 1, 1] + h[2, 1, 1] sage: f(A.one()) h[]
>>> from sage.all import * >>> # needs sage.combinat sage.modules >>> h = SymmetricFunctions(QQ).h() >>> def map_on_basis(m): # redefining map_on_basis ... d = m.dict() ... i = d.get('x', Integer(0)); j = d.get('y', Integer(0)); k = d.get('z', Integer(0)) ... g = (h[Integer(1)] ** i) * (h[Integer(2)] ** (j // Integer(2)) * (h[Integer(3)] ** (k // Integer(3)))) ... g += i * (h[Integer(1)] ** (i+j+k)) ... return g >>> f = A.module_morphism(on_basis=map_on_basis, ... codomain=h) # redefining f >>> f(x) 2*h[1] >>> f(y) h[] >>> f(z) h[] >>> f(y**Integer(2)) h[2] >>> f(x**Integer(2)) 3*h[1, 1] >>> f(x*y*z) h[1] + h[1, 1, 1] >>> f(x*x*y*y*z) 2*h[1, 1, 1, 1, 1] + h[2, 1, 1] >>> f(A.one()) h[]
The algebra
hof symmetric functions in the \(h\)-basis is already graded, so its associated graded algebra is implemented as itself:sage: # needs sage.combinat sage.modules sage: grh = h.graded_algebra(); grh is h True sage: grf = A.induced_graded_map(h, f); grf Generic morphism: From: Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field To: Symmetric Functions over Rational Field in the homogeneous basis sage: grf(xx) 2*h[1] sage: grf(yy) 0 sage: grf(zz) 0 sage: grf(yy**2) h[2] sage: grf(xx**2) 3*h[1, 1] sage: grf(xx*yy*zz) h[1, 1, 1] sage: grf(xx*xx*yy*yy*zz) 2*h[1, 1, 1, 1, 1] sage: grf(grA.one()) h[]
>>> from sage.all import * >>> # needs sage.combinat sage.modules >>> grh = h.graded_algebra(); grh is h True >>> grf = A.induced_graded_map(h, f); grf Generic morphism: From: Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field To: Symmetric Functions over Rational Field in the homogeneous basis >>> grf(xx) 2*h[1] >>> grf(yy) 0 >>> grf(zz) 0 >>> grf(yy**Integer(2)) h[2] >>> grf(xx**Integer(2)) 3*h[1, 1] >>> grf(xx*yy*zz) h[1, 1, 1] >>> grf(xx*xx*yy*yy*zz) 2*h[1, 1, 1, 1, 1] >>> grf(grA.one()) h[]
Example 3.
After having had a graded algebra as the codomain, let us try to have one as the domain instead. Our new
fwill go fromhtoA:sage: # needs sage.combinat sage.modules sage: def map_on_basis(lam): # redefining map_on_basis ....: return x ** (sum(lam)) + y ** (len(lam)) sage: f = h.module_morphism(on_basis=map_on_basis, ....: codomain=A) # redefining f sage: f(h[1]) U['x'] + U['y'] sage: f(h[2]) U['x']^2 + U['y'] sage: f(h[1, 1]) U['x']^2 + U['y']^2 sage: f(h[2, 2]) U['x']^4 + U['y']^2 sage: f(h[3, 2, 1]) U['x']^6 + U['y']^3 sage: f(h.one()) 2 sage: grf = h.induced_graded_map(A, f); grf Generic morphism: From: Symmetric Functions over Rational Field in the homogeneous basis To: Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field sage: grf(h[1]) bar(U['x']) + bar(U['y']) sage: grf(h[2]) bar(U['x']^2) sage: grf(h[1, 1]) bar(U['x']^2) + bar(U['y']^2) sage: grf(h[2, 2]) bar(U['x']^4) sage: grf(h[3, 2, 1]) bar(U['x']^6) sage: grf(h.one()) 2*bar(1)
>>> from sage.all import * >>> # needs sage.combinat sage.modules >>> def map_on_basis(lam): # redefining map_on_basis ... return x ** (sum(lam)) + y ** (len(lam)) >>> f = h.module_morphism(on_basis=map_on_basis, ... codomain=A) # redefining f >>> f(h[Integer(1)]) U['x'] + U['y'] >>> f(h[Integer(2)]) U['x']^2 + U['y'] >>> f(h[Integer(1), Integer(1)]) U['x']^2 + U['y']^2 >>> f(h[Integer(2), Integer(2)]) U['x']^4 + U['y']^2 >>> f(h[Integer(3), Integer(2), Integer(1)]) U['x']^6 + U['y']^3 >>> f(h.one()) 2 >>> grf = h.induced_graded_map(A, f); grf Generic morphism: From: Symmetric Functions over Rational Field in the homogeneous basis To: Graded Algebra of An example of a filtered algebra with basis: the universal enveloping algebra of Lie algebra of RR^3 with cross product over Rational Field >>> grf(h[Integer(1)]) bar(U['x']) + bar(U['y']) >>> grf(h[Integer(2)]) bar(U['x']^2) >>> grf(h[Integer(1), Integer(1)]) bar(U['x']^2) + bar(U['y']^2) >>> grf(h[Integer(2), Integer(2)]) bar(U['x']^4) >>> grf(h[Integer(3), Integer(2), Integer(1)]) bar(U['x']^6) >>> grf(h.one()) 2*bar(1)
Example 4.
The construct \(\operatorname{gr} f\) also makes sense when \(f\) is a filtration-preserving map between graded algebras.
sage: # needs sage.combinat sage.modules sage: def map_on_basis(lam): # redefining map_on_basis ....: return h[lam] + h[len(lam)] sage: f = h.module_morphism(on_basis=map_on_basis, ....: codomain=h) # redefining f sage: f(h[1]) 2*h[1] sage: f(h[2]) h[1] + h[2] sage: f(h[1, 1]) h[1, 1] + h[2] sage: f(h[2, 1]) h[2] + h[2, 1] sage: f(h.one()) 2*h[] sage: grf = h.induced_graded_map(h, f); grf Generic endomorphism of Symmetric Functions over Rational Field in the homogeneous basis sage: grf(h[1]) 2*h[1] sage: grf(h[2]) h[2] sage: grf(h[1, 1]) h[1, 1] + h[2] sage: grf(h[2, 1]) h[2, 1] sage: grf(h.one()) 2*h[]
>>> from sage.all import * >>> # needs sage.combinat sage.modules >>> def map_on_basis(lam): # redefining map_on_basis ... return h[lam] + h[len(lam)] >>> f = h.module_morphism(on_basis=map_on_basis, ... codomain=h) # redefining f >>> f(h[Integer(1)]) 2*h[1] >>> f(h[Integer(2)]) h[1] + h[2] >>> f(h[Integer(1), Integer(1)]) h[1, 1] + h[2] >>> f(h[Integer(2), Integer(1)]) h[2] + h[2, 1] >>> f(h.one()) 2*h[] >>> grf = h.induced_graded_map(h, f); grf Generic endomorphism of Symmetric Functions over Rational Field in the homogeneous basis >>> grf(h[Integer(1)]) 2*h[1] >>> grf(h[Integer(2)]) h[2] >>> grf(h[Integer(1), Integer(1)]) h[1, 1] + h[2] >>> grf(h[Integer(2), Integer(1)]) h[2, 1] >>> grf(h.one()) 2*h[]
Example 5.
For another example, let us compute \(\operatorname{gr} f\) for a map \(f\) between two Clifford algebras:
sage: # needs sage.modules sage: Q = QuadraticForm(ZZ, 2, [1,2,3]) sage: B = CliffordAlgebra(Q, names=['u','v']); B The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: [ 1 2 ] [ * 3 ] sage: m = Matrix(ZZ, [[1, 2], [1, -1]]) sage: f = B.lift_module_morphism(m, names=['x','y']) sage: A = f.domain(); A The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: [ 6 0 ] [ * 3 ] sage: x, y = A.gens() sage: f(x) u + v sage: f(y) 2*u - v sage: f(x**2) 6 sage: f(x*y) -3*u*v + 3 sage: grA = A.graded_algebra(); grA The exterior algebra of rank 2 over Integer Ring sage: A.to_graded_conversion()(x) x sage: A.to_graded_conversion()(y) y sage: A.to_graded_conversion()(x*y) x*y sage: u = A.to_graded_conversion()(x*y+1); u x*y + 1 sage: A.from_graded_conversion()(u) x*y + 1 sage: A.projection(2)(x*y+1) x*y sage: A.projection(1)(x+2*y-2) x + 2*y sage: grf = A.induced_graded_map(B, f); grf Generic morphism: From: The exterior algebra of rank 2 over Integer Ring To: The exterior algebra of rank 2 over Integer Ring sage: grf(A.to_graded_conversion()(x)) u + v sage: grf(A.to_graded_conversion()(y)) 2*u - v sage: grf(A.to_graded_conversion()(x**2)) 6 sage: grf(A.to_graded_conversion()(x*y)) -3*u*v sage: grf(grA.one()) 1
>>> from sage.all import * >>> # needs sage.modules >>> Q = QuadraticForm(ZZ, Integer(2), [Integer(1),Integer(2),Integer(3)]) >>> B = CliffordAlgebra(Q, names=['u','v']); B The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: [ 1 2 ] [ * 3 ] >>> m = Matrix(ZZ, [[Integer(1), Integer(2)], [Integer(1), -Integer(1)]]) >>> f = B.lift_module_morphism(m, names=['x','y']) >>> A = f.domain(); A The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: [ 6 0 ] [ * 3 ] >>> x, y = A.gens() >>> f(x) u + v >>> f(y) 2*u - v >>> f(x**Integer(2)) 6 >>> f(x*y) -3*u*v + 3 >>> grA = A.graded_algebra(); grA The exterior algebra of rank 2 over Integer Ring >>> A.to_graded_conversion()(x) x >>> A.to_graded_conversion()(y) y >>> A.to_graded_conversion()(x*y) x*y >>> u = A.to_graded_conversion()(x*y+Integer(1)); u x*y + 1 >>> A.from_graded_conversion()(u) x*y + 1 >>> A.projection(Integer(2))(x*y+Integer(1)) x*y >>> A.projection(Integer(1))(x+Integer(2)*y-Integer(2)) x + 2*y >>> grf = A.induced_graded_map(B, f); grf Generic morphism: From: The exterior algebra of rank 2 over Integer Ring To: The exterior algebra of rank 2 over Integer Ring >>> grf(A.to_graded_conversion()(x)) u + v >>> grf(A.to_graded_conversion()(y)) 2*u - v >>> grf(A.to_graded_conversion()(x**Integer(2))) 6 >>> grf(A.to_graded_conversion()(x*y)) -3*u*v >>> grf(grA.one()) 1
- projection(i)[source]¶
Return the \(i\)-th projection \(p_i : F_i \to G_i\) (in the notations of the class documentation
AssociatedGradedAlgebra, where \(A = ` ``self`\)).This method actually does not return the map \(p_i\) itself, but an extension of \(p_i\) to the whole \(R\)-module \(A\). This extension is the composition of the \(R\)-module isomorphism \(A \to \operatorname{gr} A\) with the canonical projection of the graded \(R\)-module \(\operatorname{gr} A\) onto its \(i\)-th graded component \(G_i\). The codomain of this map is \(\operatorname{gr} A\), although its actual image is \(G_i\). The map \(p_i\) is obtained from this map by restricting its domain to \(F_i\) and its image to \(G_i\).
EXAMPLES:
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 + 3*U['x'] + 3*U['y'] + 3 sage: q = A.projection(7)(p); q bar(U['x']^2*U['y']^2*U['z']^3) sage: q.parent() is A.graded_algebra() True sage: A.projection(8)(p) 0
>>> from sage.all import * >>> A = Algebras(QQ).WithBasis().Filtered().example() >>> p = A.an_element() + A.algebra_generators()['x'] + Integer(2); p U['x']^2*U['y']^2*U['z']^3 + 3*U['x'] + 3*U['y'] + 3 >>> q = A.projection(Integer(7))(p); q bar(U['x']^2*U['y']^2*U['z']^3) >>> q.parent() is A.graded_algebra() True >>> A.projection(Integer(8))(p) 0
- to_graded_conversion()[source]¶
Return the canonical \(R\)-module isomorphism \(A \to \operatorname{gr} A\) induced by the basis of \(A\) (where \(A = ` ``self`\)).
This is an isomorphism of \(R\)-modules, not of algebras. See the class documentation
AssociatedGradedAlgebra.See also
EXAMPLES:
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 + 3*U['x'] + 3*U['y'] + 3 sage: q = A.to_graded_conversion()(p); q bar(U['x']^2*U['y']^2*U['z']^3) + 3*bar(U['x']) + 3*bar(U['y']) + 3*bar(1) sage: q.parent() is A.graded_algebra() True
>>> from sage.all import * >>> A = Algebras(QQ).WithBasis().Filtered().example() >>> p = A.an_element() + A.algebra_generators()['x'] + Integer(2); p U['x']^2*U['y']^2*U['z']^3 + 3*U['x'] + 3*U['y'] + 3 >>> q = A.to_graded_conversion()(p); q bar(U['x']^2*U['y']^2*U['z']^3) + 3*bar(U['x']) + 3*bar(U['y']) + 3*bar(1) >>> q.parent() is A.graded_algebra() True