[Numpy-discussion] vander() docstring
Charles R Harris
charlesr.harris@gmail....
Wed Mar 26 19:37:47 CDT 2008
On Wed, Mar 26, 2008 at 5:22 PM, Andreas Klöckner <lists@informa.tiker.net>
wrote:
> Hi all,
>
> The docstring for vander() seems to contradict what the function does. In
> particular, the columns in the vander() output seem reversed wrt its
> docstring. I feel like one of the two needs to be fixed, or is there
> something I'm not seeing?
>
> This here is fresh from the Numpy examples page:
>
> 8< docstring -----------------------------------------------
> X = vander(x,N=None)
>
> The Vandermonde matrix of vector x. The i-th column of X is the
> the i-th power of x. N is the maximum power to compute; if N is
> None it defaults to len(x).
>
> 8< Example -------------------------------------------------
> >>> from numpy import *
> >>> x = array([1,2,3,5])
> >>> N=3
> >>> vander(x,N) # Vandermonde matrix of the vector x
> array([[ 1, 1, 1],
> [ 4, 2, 1],
> [ 9, 3, 1],
> [25, 5, 1]])
> 8< ---------------------------------------------------------
>
The docstring is incorrect. The Vandermonde matrix produced is compatible
with numpy polynomials that also go from high to low powers. I would have
done it the other way round, so index matched power, but that isn't how it
is.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080326/31db583f/attachment.html
More information about the Numpy-discussion
mailing list