Re: [Numpy-discussion] Integer cast problems

2009-02-13 Thread Ralph Kube
Thanks alot people, my problem is gone now. Keith Goodman skrev: On Thu, Feb 12, 2009 at 9:21 AM, Ralph Kube ralphk...@googlemail.com wrote: The same happens on the ipython prompt: 0.145 * 0.005 = 28.996 N.int32(0.145 * 0.005) = 28 Any ideas how to deal with this? Do you

[Numpy-discussion] Integer cast problems

2009-02-12 Thread Ralph Kube
Hi there, I have a little problem here with array indexing, hope you see the problem. I use the following loop to calculate some integrals import numpy as N from scipy.integrate import quad T = 1 dt = 0.005 L = 3 n = 2 ints = N.zeros([T/dt]) for t in N.arange(0, T, dt): a = quad(lambda

Re: [Numpy-discussion] Integer cast problems

2009-02-12 Thread Ryan May
On Thu, Feb 12, 2009 at 11:21 AM, Ralph Kube ralphk...@googlemail.comwrote: Hi there, I have a little problem here with array indexing, hope you see the problem. I use the following loop to calculate some integrals import numpy as N from scipy.integrate import quad T = 1 dt = 0.005 L = 3

Re: [Numpy-discussion] Integer cast problems

2009-02-12 Thread Gregor Thalhammer
Ralph Kube schrieb: Hi there, I have a little problem here with array indexing, hope you see the problem. I use the following loop to calculate some integrals ... 0.145 * 0.005 = 28.996 N.int32(0.145 * 0.005) = 28 conversion to int truncates, it doesn't round. Try N.int32(0.145

Re: [Numpy-discussion] Integer cast problems

2009-02-12 Thread Keith Goodman
On Thu, Feb 12, 2009 at 9:21 AM, Ralph Kube ralphk...@googlemail.com wrote: The same happens on the ipython prompt: 0.145 * 0.005 = 28.996 N.int32(0.145 * 0.005) = 28 Any ideas how to deal with this? Do you want the answer to be 29? N.int32 truncates. If you want to round