On 10/10/10 11:58 AM, Simon King wrote:
Hi Andrew!
On 10 Okt., 16:58, andrew ewart<[email protected]> wrote:
hmm sage doesnt seem to recognise the Im() command
How do you define your polynomials? Are you sure that you *do* define
polynomials?
Examples:
1. This is a polynomial:
sage: R.<x,y> = QQ[]
sage: p = x^2+3*x*y+y^3
sage: p.lm()
y^3
sage: type(p)
<type
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
2. This is not a polynomial (but a symbolic expression):
sage: var('x y')
(x, y)
sage: p = x^2+3*x*y+y^3
sage: p.lm()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
...
AttributeError: 'sage.symbolic.expression.Expression' object has no
attribute 'lm'
sage: type(p)
<type 'sage.symbolic.expression.Expression'>
Also please note the .polynomial() method for symbolic expressions, and
that q is a polynomial below:
sage: var('x y')
(x, y)
sage: p = x^2+3*x*y+y^3
sage: q=p.polynomial(QQ)
sage: type(q)
<type
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
sage: parent(q)
Multivariate Polynomial Ring in x, y over Rational Field
sage: q
y^3 + x^2 + 3*x*y
sage: parent(q).gens()
(x, y)
sage: q.lm()
y^3
-Jason
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org