[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)

Anne Archibald peridot.faceted at gmail.com
Tue Oct 13 12:12:14 EDT 2009


2009/10/13 Charles R Harris <charlesr.harris at gmail.com>:
>
> On Tue, Oct 13, 2009 at 8:14 AM, Pauli Virtanen <pav+sp at iki.fi> wrote:
[snip]
>> Anyway, you write the code, you call the shots :)
>>
>
> Heh. I am looking for feedback before taking the plunge.

Wow, lots of ideas! But I think before we can evaluate them we need to
figure out what our requirements are. Here's a suggested list:

(1) Simple. Simple to understand, simple to add new representations,
even for users outside scipy.
(2) Possible for users to subclass polynomials to provide polynomial
objects with more features.
(3) Polynomial objects should be able to detect and prevent operations
between polynomials in different bases when appropriate (for example,
you can substitute any kind of polynomial into a power-basis
polynomial, or a Lagrange basis polynomial into anything).
(4) Polynomial operations available as functions that operate on
coefficient arrays rather than polynomial objects.
(5) Possibly substantial data and methods attached to bases -
orthogonal polynomial roots and weights, lists of points for Lagrange
polynomials.

Any others? Are all these really requirements?

Here are some key questions:

* Do we want the information about what representation a polynomial is
in stored in the polynomial's class, in an explicit basis object the
polynomial contains, or both?
* How should a user obtain a polynomial object?


My current implementation fails only (4), and could be modified by
moving the code back into basis objects to satisfy (4). Then
polynomials of all current representations could be of class
Polynomial, with the basis information stored as an explicit basis
object. Users obtain polynomials as
"mybasis.polynomial(coefficients)"; the Polynomial constructor is also
possible but raises an exception if misused. I'm not sure how best to
discourage its use.


Anne



More information about the SciPy-Dev mailing list