Ask Your Question

Revision history [back]

The easiest for your question is to explore using the <tab> key.

Define

sage: p = po['ly1']

then type this followed by <tab>

sage: p.

and you will see a list of available methods.

The method you are looking for is leading_coefficient.

For the leading term, I'm afraid you have to do

 sage: p.leading_coefficient() * x^p.degree()

Note that since the polynomials are univariate, you can use .degree() and you don't have to specify .degree(x).

The easiest for your question is to explore using the <tab> key.

DefineHaving run your code, I got

sage: p = po['ly1']
-x + 2

then type this followed by <tab>

sage: p.

and you will see a list of available methods.

The method you are looking for is leading_coefficient.

sage: p.leading_coefficient()
-1

For the leading term, I'm afraid you have to do

 sage: p.leading_coefficient() * x^p.degree()
-x

Note that since the polynomials are univariate, you can use .degree() and you don't have to specify .degree(x).