Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Degree of polynomial wrt a variable
PostPosted: Sat Jan 19, 2019 7:52 am 
How do you check the degree of a polynomial wrt a variable? deg(poly) seems to give the total degree.


Report this post
Top
  
Reply with quote  
 Post subject: Re: Degree of polynomial wrt a variable
PostPosted: Sun Jan 20, 2019 7:56 pm 

Joined: Wed Mar 03, 2010 5:08 pm
Posts: 108
Location: Germany, Münster
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 `)`


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 10:59 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group