Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use forgetful functors effectively in Sage?

I am trying to define a linear operator on a graded commutative algebra in Sage. The only way I know to do this is to forget the multiplication on the algebra, and then to define a linear operator in the underlying vector space.

Here is some sage code, with output:

sage: A.<h1,h2> = GradedCommutativeAlgebra(QQ, degrees=(1,1))

sage: A.category()

Category of graded algebras over Rational Field

sage: F = ForgetfulFunctor(A.category(),Modules(QQ).Graded())

....: F(A).category()

Category of graded algebras over Rational Field

Evidently Sage forgets the multiplication on the graded commutative algebra A, but then immediately re-remembers the multiplication, so that the forgetful functor applied to A simply returns A again?

I have tried many variations on this code, e.g. switching to a forgetful functor landing in Q-vector spaces rather than graded Q-modules, ForgetfulFunctor(A.category(),Modules(QQ).Graded()), yields the error message:

TypeError: 'GCAlgebra_with_category' object has no attribute 'vector_space'

What am I missing here?

Even if this odd behavior of forgetful functors can't be figured out, I would be satisfied with another way to get what I want in the end: I am trying to define the Hodge star operator on the Chevalley-Eilenberg DGA of some specific Lie algebras given by specific presentations. While Sage supports the Hodge star on the differential forms on a manifold, it is not obvious how to write down an explicit Lie group whose Lie algebra is any specific one in this family of Lie algebras, and our Lie algebras are also defined over finite fields, so we would prefer to not have the restriction to characteristic zero that comes with the differential forms on a manifold.

Thanks!

How to use forgetful functors effectively in Sage?

I am trying to define a linear operator on a graded commutative algebra in Sage. The only way I know to do this is to forget the multiplication on the algebra, and then to define a linear operator in the underlying vector space.

Here is some sage Sage code, with output:

sage: A.<h1,h2> =
  GradedCommutativeAlgebra(QQ,
  degrees=(1,1))

A.<h1, h2> = GradedCommutativeAlgebra(QQ, degrees=(1, 1)) sage: A.category()

A.category() Category of graded algebras over over Rational Field

Field sage: F = ForgetfulFunctor(A.category(),Modules(QQ).Graded())

....: F(A).category()

= ForgetfulFunctor(A.category(), Modules(QQ).Graded()) sage: F(A).category() Category of graded algebras over over Rational Field

Field

Evidently Sage forgets the multiplication on the graded commutative algebra A, A, but then immediately re-remembers the multiplication, so that the forgetful functor applied to A A simply returns A A again?

I have tried many variations on this code, e.g. switching to a forgetful functor landing in Q-vector Q-vector spaces rather than graded Q-modules, ForgetfulFunctor(A.category(),Modules(QQ).Graded()), Q-modules, ForgetfulFunctor(A.category(), Modules(QQ).Graded()), yields the error message:

TypeError: 'GCAlgebra_with_category'
  'GCAlgebra_with_category' object has no attribute 'vector_space'

'vector_space'

What am I missing here?

Even if this odd behavior of forgetful functors can't be figured out, I would be satisfied with another way to get what I want in the end: I am trying to define the Hodge star operator on the Chevalley-Eilenberg DGA of some specific Lie algebras given by specific presentations. While Sage supports the Hodge star on the differential forms on a manifold, it is not obvious how to write down an explicit Lie group whose Lie algebra is any specific one in this family of Lie algebras, and our Lie algebras are also defined over finite fields, so we would prefer to not have the restriction to characteristic zero that comes with the differential forms on a manifold.

Thanks!