weighted univariate polynomials
I have a polynomial algebra in n variables k[x_1,...,x_n]. I know how assign different degrees to each of the generators as in
sage: P = PolynomialRing(QQ, 'x,y,z', order = TermOrder('wdegrevlex', (2,3,4)))
sage: P.inject_variables()
Defining x, y, z
sage: z.degree()
sage:
4
However if I want to do this with only one variable this does not work
sage: P = PolynomialRing(QQ, 'x', order = TermOrder('wdegrevlex', (2)))
sage: P.inject_variables()
Defining x
sage: x.degree()
1
I wander if I can do this in an uniform way cause I need to use a class that takes an arbitrary number of variables.
You can use
GradedCommutativeAlgebra
, as I suggested in my answer to another of your questions.That doesn't work for a number of other reasons, I have a particular derivation of degree 1 and doubling the degrees is not an option. I need a number of methods from PolynomialRings and Groebner bases that I cannot coalesce to GradedCommutativeAlgebra and a few more. But still it's striking why that example as in my question is implemented the way it is