Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-30 Thread Nicolas Bigaouette
2010/7/2 Charles R Harris > > > On Fri, Jul 2, 2010 at 12:15 PM, Nicolas Bigaouette > wrote: > >> Hi all, >> >> I don't really know where to ask, so here it is. >> >> I was able to vectorize the normalization calculation in quantum >> mechanics: . Basically it's a volume integral of a scalar fie

Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-02 Thread Geoffrey Ely
On Jul 2, 2010, at 11:33 AM, Benjamin Root wrote: > I want to do the same for the calculation of the kinetic energy: > /2m. There is a laplacian in the volume integral which > complicates things: > K = 0.0 > for i in numpy.arange(len(dx)-1): > for j in numpy.arange(len(dy)-1): > for k

Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-02 Thread Bruce Southey
On 07/02/2010 01:45 PM, Keith Goodman wrote: > On Fri, Jul 2, 2010 at 11:33 AM, Benjamin Root wrote: > >> I am moving this over to numpy-discussion maillist... >> >> I don't have a firm answer for you, but I did notice one issue in your >> code. You call arange(len(dx) - 1) for your loops, bu

Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-02 Thread Keith Goodman
On Fri, Jul 2, 2010 at 11:45 AM, Keith Goodman wrote: > On Fri, Jul 2, 2010 at 11:33 AM, Benjamin Root wrote: >> I am moving this over to numpy-discussion maillist... >> >> I don't have a firm answer for you, but I did notice one issue in your >> code.  You call arange(len(dx) - 1) for your loops

Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-02 Thread Keith Goodman
On Fri, Jul 2, 2010 at 11:33 AM, Benjamin Root wrote: > I am moving this over to numpy-discussion maillist... > > I don't have a firm answer for you, but I did notice one issue in your > code.  You call arange(len(dx) - 1) for your loops, but you probably really > need arange(1, len(dx) - 1) becau

Re: [Numpy-discussion] [Matplotlib-users] Vectorization

2010-07-02 Thread Benjamin Root
I am moving this over to numpy-discussion maillist... I don't have a firm answer for you, but I did notice one issue in your code. You call arange(len(dx) - 1) for your loops, but you probably really need arange(1, len(dx) - 1) because you are accessing elements both after *and* before the curren