# Singular

 Page 1 of 1 [ 3 posts ]
 Print view | E-mail friend Previous topic | Next topic
Author Message
 Post subject: monomial's coefficientPosted: Mon May 23, 2016 9:36 pm

Joined: Fri Jun 24, 2011 10:10 am
Posts: 9
friends,
I'm looking for a singular procedure to return a given monomial's coefficient
of a polynomial.

Example poly f = 2 x ^ 3 + 5z^3;
test (f, x ^ 3) // --> 2
test (f, y ^ 3) // --> 0
who can help me?

Top

 Post subject: Re: monomial's coefficientPosted: Tue May 24, 2016 7:49 am

Joined: Sat Apr 16, 2016 7:25 pm
Posts: 8
There is 'coeffs' command for this.
ring r = 0,(x,y,z),dp;
poly f = 2 x ^ 3 + 5z^3;
> coeffs(f,x);
_[1,1]=-5z3 //coefficient of x^0
_[2,1]=0 // coeff of x^1
_[3,1]=0 // coeff of x^2
_[4,1]=2 // coeff of x^3

If you need to extract a specific entry from this matrix, directly specify the position,
> coeffs(f,x)[4,1]; //For x^3
2

Similarly for other ring variables. It shouldn't be too difficult to convert it into a function.

Top

 Post subject: Re: monomial's coefficientPosted: Tue May 24, 2016 4:29 pm

Joined: Wed May 25, 2005 4:16 pm
Posts: 205
Another possibility is 'coeffs'
(http://www.singular.uni-kl.de/Manual/4-0-3/sing_271.htm)
and a third one:
Code:
jet(f/x^3,0)

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

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

 It is currently Sat Oct 20, 2018 4:36 pm