Dear All,
Are there any inbuilt function to work with degrees of polynomials?
For example,
x=Symbol('x')
y=symbol('y')
f=2*x**3+3*x*y+1
So
f.highestDegree(x) would return 3
f.coeff(x**1) would return 3*y
Many thanks
Colin
--~--~-~--~~~---~--~~
You received
Thanks for the quick response.
When I do
from sympy import *
I don't have a function Poly . I presume I should use Polynomial
instead?
Cheers
Colin
On Mar 29, 3:54 pm, Mateusz Paprocki [EMAIL PROTECTED] wrote:
Hi,
given the following input
In [1]: f=2*x**3+3*x*y+1
we get an expression:
I don't have a function Poly . I presume I should use Polynomial
Poly, and 'polys' module was added after 0.5.13 release, so if
you wish to use this you would need latest HG repository.
Of course you can use Polynomial, however the interface
is a bit different. Note also that 'polynomials'
One thing, is there any way of passing a list/tuple to the function, e.g.
vars = (x,y)
Poly(x+2*y, vars)
You must unpack a tuple or a list when passing to a constructor:
In [26]: Poly(x+2*y, x, y)
Out[26]: Poly((1, 2), ((1, 0), (0, 1)), (x, y), 'grlex')
In [27]: symbols = (x, y)
In [28]: