1 | initial version |
Use the inject_variables
method.
It has an optional parameter verbose
, which defaults to True
.
Set it to False
if you want less noise.
Example.
Slightly simplified version of the code in the question:
sage: L = LieAlgebra(QQ, 3, step=3)
sage: L
Free Nilpotent Lie algebra on 14 generators
(X_1, X_2, X_3, X_12, X_13, X_23, X_112, X_113,
X_122, X_123, X_132, X_133, X_223, X_233)
over Rational Field
sage: A = GradedCommutativeAlgebra(QQ, names=L.basis())
sage: A
Graded Commutative Algebra with generators
('X_1', 'X_2', 'X_3', 'X_12', 'X_13', 'X_23', 'X_112', 'X_113',
'X_122', 'X_123', 'X_132', 'X_133', 'X_223', 'X_233')
in degrees (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
over Rational Field
Let us inject variables:
sage: A.inject_variables()
Defining X_1, X_2, X_3, X_12, X_13, X_23, X_112,
X_113, X_122, X_123, X_132, X_133, X_223, X_233
Or with less noise:
sage: A.inject_variables(verbose=False)
The generators are now available and have the correct parent and type:
sage: X_1
X_1
sage: parent(X_1)
Graded Commutative Algebra with generators
('X_1', 'X_2', 'X_3', 'X_12', 'X_13', 'X_23', 'X_112', 'X_113',
'X_122', 'X_123', 'X_132', 'X_133', 'X_223', 'X_233')
in degrees (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
over Rational Field
sage: type(X_1)
<class 'sage.algebras.commutative_dga.GCAlgebra_with_category.element_class'>