[Numpy-discussion] Unpleasant behavior with poly1d and numpy scalar multiplication

David Goldsmith d.l.goldsmith at gmail.com
Sun Feb 14 02:40:05 EST 2010


On Sat, Feb 13, 2010 at 11:10 PM, Fernando Perez <fperez.net at gmail.com>wrote:

> On Sat, Feb 13, 2010 at 10:32 PM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> > Note that ipython calls __repr__ to print the output. __repr__ is
> supposed
> > to provide a string that can be used to recreate the object, a pretty
> > printed version of __repr__ doesn't provide that. Also, an array or list
> of
>
> IPython calls repr because that's the convention the standard python
> shell uses, and I decided long ago to follow suit.
>
> > polynomials, having pretty printed entries looks pretty ugly with the
> > newlines and all -- try it with Poly1d. I was also thinking that someone
> > might want to provide a better display at some point, drawing on a
> canvas,
> > for instance. And what happens when the degree gets up over 100, which is
> > quite reasonable with the Cheybshev polynomials?
>
> sympy has pretty remarkable pretty-printing support, perhaps some of
> that could  be reused.  Just a thought.
>

Curious: how is sympy at deducing recursion relations and/or index
functions?  Reason: my first thought about Chuck's high-degree issue was
that in such cases perhaps PrettyPoly (or __pretty__) could attempt to use
summation notation (of course, this would only be useful when the
coefficients are formulaic functions of the index, but hey, it's something).

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100213/8dc069dc/attachment.html>


More information about the NumPy-Discussion mailing list