[sympy] Re: subclassing Poly

2009-09-08 Thread William Purcell
list(_.iter_all_coeffs()) does what I want. I will still take a look at Mateusz's work. Thanks for the help guys. Bill smichr wrote: > If you use .iter_all_coeffs() I think you will get what you want: > > ### Poly(x**2+1,x) > Poly(x**2 + 1, x) list(_.iter_all_coeffs()) > [1, 0, 1]

[sympy] Re: subclassing Poly

2009-09-08 Thread smichr
If you use .iter_all_coeffs() I think you will get what you want: ### >>> Poly(x**2+1,x) Poly(x**2 + 1, x) >>> list(_.iter_all_coeffs()) [1, 0, 1] ### Another option is to compare the coeffs zipped up with the monomials: ### >>> p=Poly(x**2+1,x) >>> zip(p.coeffs,p.monoms) [(1, (2,)), (1, (0,))]

[sympy] Re: subclassing Poly

2009-09-08 Thread Aaron S. Meurer
You might look at the new rewritten polys module on issue 1598. We should hopefully have that merged in whenever Mateusz is fully finished with it. Until then, you can pull his branch and check it out. Aaron Meurer On Sep 8, 2009, at 7:24 AM, William Purcell wrote: > > I am trying to subcl

[sympy] Re: Subclassing Poly?

2009-04-29 Thread Ondrej Certik
On Thu, Apr 23, 2009 at 9:48 AM, Ondrej Certik wrote: > On Tue, Apr 21, 2009 at 8:46 AM, dhruv wrote: >> It seems like the above is the only thing I can do!  The Poly class >> can be instantiated using a few different calling schemes (lists, >> tuples, dictionaries, &c.) and I'm going to have to

[sympy] Re: Subclassing Poly?

2009-04-23 Thread Ondrej Certik
On Tue, Apr 21, 2009 at 8:46 AM, dhruv wrote: > > Thanks for the help, but I'm still stuck! > >> create GeneratingFunction.__new__() with your own arguments and then >> call Poly.__new__() from it, with any preprocessing that you need. > > This is what I've got so far: > > == generating_funct

[sympy] Re: Subclassing Poly?

2009-04-21 Thread dhruv
Thanks for the help, but I'm still stuck! > create GeneratingFunction.__new__() with your own arguments and then > call Poly.__new__() from it, with any preprocessing that you need. This is what I've got so far: == generating_functions.py from sympy import Poly X = Symbol('X') c

[sympy] Re: Subclassing Poly?

2009-04-19 Thread Ondrej Certik
Hi Dhruv! On Sat, Apr 18, 2009 at 1:10 PM, dhruv wrote: > > Hello all, > > I want to build a class to describe a generating function (as used in > the context of discrete probability distributions).  It would have > exactly the functionality of the Poly class, have a normalization > constraint o