[Numpy-discussion] Adding the new polynomial/chebyshev modules.
Charles R Harris
Mon Nov 16 16:31:58 CST 2009
On Mon, Nov 16, 2009 at 3:06 PM, Anne Archibald
> 2009/11/16 Christopher Barker <Chris.Barker@noaa.gov>:
> > Charles R Harris wrote:
> >> I would like some advise on the best way to add the new functions. I've
> >> added a new package polynomial, and that package contains four new
> >> modules: chebyshev, polynomial, polytemplate, polyutils.
> > This seems to belong more in scipy than numpy, but I'll leave that to
> > others to decide.
> >> whether or not to include all of the functions in these packages in the
> >> __init__.py, or to just import the modules.
> > Are any of them compiled code? I've been very frustrated when I can't
> > use some pure python stuff in scipy because broken compiled fortran
> > extensions are getting imported that I don't even need.
> > If that isn't an issue, and the polynomial package would end up with
> > only a handful of names, then I say import them all. Another way to ask
> > this: would there by ANY names in the polynomial package if you don't
> > import the modules?
> > If there is compiled code, the import could fail gracefully, and then
> > you could still pull it all in.
> > OTOH, what this does is bring stuff into memory unnecessarily, and also
> > brings it into stand-alone bundles (py2exe, py2app, etc). So if these
> > modules are not small, then it's probably better to have to import them
> > explicitly.
> > Also -- do you foresee many more polynomial types in the future? I know
> > I'd like to see Hermite.
> I have kind of gone silent on this issue, in part because I have been
> busy with other things. I think that Charles Harris' framework for
> working with polynomials is perfectly sufficient for adding Chebyshev
> polynomials, and since they're finished and working and fill a
> concrete need, they should probably go into numpy or scipy as is. But
> if you want to start introducing other types of polynomials - Hermite,
> Lagrange interpolation based, Bernstein based, or other - I think we
> would need to revive the discussion about how to unify all these
> different types.
Yes, that still needs thinking about. The recursion for the Chebyshev
polynomials (and powers) has constant coefficients apart from the x, and
that makes a lot of simplifications possible. In particular, the resulting
polynomials can be represented as constant combinations of powers of the two
roots of the recursion relation. That simplifies a lot of things that can be
difficult in the more general case. And that isn't even getting started on
non-graded things like the Bernstein and Lagrange interpolation based
There is a lot of interesting combinatorial work going on in the polynomial
business that I am not familiar with. Some of that may be of use to us in
looking for a framework.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion