On Mon, Jan 2, 2012 at 10:46 PM, <josef.pktd@gmail.com> wrote:
On Mon, Jan 2, 2012 at 9:44 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
> Hi All,
>
> I've made a pull request for a  rather large update of the polynomial
> package. The new features are
>
> 1) Bug fixes
> 2) Improved documentation in the numpy reference
> 3) Preliminary support for multi-dimensional coefficient arrays
> 4) Support for NA in the fitting routines
> 5) Improved testing and test coverage
> 6) Gauss quadrature
> 7) Weight functions
> 8) (Mostly) Symmetrized companion matrices
> 9) Add cast and basis as static functions of convenience classes
> 10) Remove deprecated import from package init.py
>
> If anyone has an interest in that package, please take some time and review
> it here.

(Since I'm not setup for compiling numpy I cannot try it out. Just
some spotty reading of the code.)

The two things I'm most interested in are the 2d, 3d enhancements and
the quadrature.

What's the return of the 2d vander functions?

If I read it correctly, it's:

>>> xyn = np.array([['x^%d*y^%d'%(px,py) for py in range(5)] for px in range(3)])
>>> xyn
array([['x^0*y^0', 'x^0*y^1', 'x^0*y^2', 'x^0*y^3', 'x^0*y^4'],
      ['x^1*y^0', 'x^1*y^1', 'x^1*y^2', 'x^1*y^3', 'x^1*y^4'],
      ['x^2*y^0', 'x^2*y^1', 'x^2*y^2', 'x^2*y^3', 'x^2*y^4']],
     dtype='|S7')
>>> xyn.ravel()
array(['x^0*y^0', 'x^0*y^1', 'x^0*y^2', 'x^0*y^3', 'x^0*y^4', 'x^1*y^0',
      'x^1*y^1', 'x^1*y^2', 'x^1*y^3', 'x^1*y^4', 'x^2*y^0', 'x^2*y^1',
      'x^2*y^2', 'x^2*y^3', 'x^2*y^4'],
     dtype='|S7')


Yes, that's right.
 
Are the normalization constants available in explicit form to get an
orthonormal basis?

No, not at the moment. I haven't quite figured out how I want to expose them but I agree that they should be available.
 
The test_100 look like good recipes for getting the normalization and
the integration constants.


Yes, that works. There are also explicit formulas, but I don't know that they
would work better. Some of the factors get very large, for Laguerre of degree
100 the can be up in the 10^100 range
 
Are the quads weights and points the same as in scipy.special (up to
floating point differences)?


Yes, but more accurate. For instance, the scipy.special values for Gauss-Laguerre integration die at around degree 40.
 
Looks very useful and I'm looking forward to trying it out, and I will
borrow some code like test_100 as recipes.
(For densities, I still need mostly orthonormal basis and integration
normalized to 1.)


Let me know what would be useful and I'll try to put it in.

Chuck