@hannes
Yes, leadmonom is shorter, but
/monomial(leadexp(h)) works nice
in case h is zero.
Actually, I forgot that the command leadmonom exists.
It only became necessary when integers as coefficients were introduced.
Yet, I can't follow your objection agains the use of jet:
You say
hannes wrote:
jet requires that only constants have degree 0 (not always true)
Since I don't see this, we have to go into some subtle details of the commands
jet
http://www.singular.uni-kl.de/Manual/la ... htm#SEC285 and deg
http://www.singular.uni-kl.de/Manual/la ... htm#SEC240I guess you want to say the following:
Supposed we have a basering with a ordering defined by a weight vector
having positive and negative weights.
Then non-constant monomials may have zero-degree w.r.t. to this ordering.
Here I agree; but, unlike
deg, the command
jet computes
by default w.r.t. to the standard weights (1,...,1).
Thus
jet(f,0) always give the constant term.
Problems only occur when jet is called
with the weight vector.
However your solution needs that the user is working in a local ordering,
(but Dmitry wants to work globally) otherwise the result is false.
Example:
Code:
> ring rw = 0,(x,y),ws(2,-3);
> poly f = x3y2 + 8x2y + 4xy2 + 11;
> deg(f); // degree w.r.t. to the weighted degree order
1
> jet(f,0); // constant term independet of the ordering
11
> jet(f,0,intvec(2,-3));
4xy2+11+x3y2
> // with my proc we get
> getcoef(f,x2y);
8
> // with yours we obtain
> getcoef(f,x2y);
xy
In case that there are really problems that I have overlooked
one should use subst (resp. substitute) after division to get the coefficient]