Singular
https://www.singular.uni-kl.de/forum/

Degree of polynomial wrt a variable
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2819
Page 1 of 1

Author:  IliaToli [ Sat Jan 19, 2019 7:52 am ]
Post subject:  Degree of polynomial wrt a variable

How do you check the degree of a polynomial wrt a variable? deg(poly) seems to give the total degree.

Author:  gorzel [ Sun Jan 20, 2019 7:56 pm ]
Post subject:  Re: Degree of polynomial wrt a variable

deg can be called with an intvec as a second argument:
http://www.singular.uni-kl.de/Manual/latest/sing_225.htm#SEC265
Thus one can easily build a suitable command, e.g:
Code:
> proc vardeg(poly f, int n) { return(deg(f,leadexp(var(n)))); }
> ring rdp =0,(x,y),dp;
> poly f = x2+y3+x4y2+x5 +x2y;
> deg(f);
6
> vardeg(f,2);
3
> vardeg(f,1);
5
> // the proc makes an implicit check of the second argument for the variable number:
> vardeg(f,3);
   ? var number 3 out of range 1..2
   ? error occurred in or before ::vardeg line 1: ` return(deg(f,leadexp(var(n)))); `
   ? leaving ::vardeg
   skipping text from `;` error at token `)`

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/