[SciPy-user] summation of array elements

Horst Horstsen horstess2001 at yahoo.de
Wed Jun 30 13:41:53 CDT 2004

Hi Scipy-Experts,

I've got a question concerning the summation of elements in an array. The 
following small sample programm illustrates the problem:

from scipy.xplt import *
from RandomArray import *


def gen_lattice(nx,ny,c):
     return (x<c)

print sum(x)
print sum(ravel(x))

One would expect an output of ten 100s and a 1000 but instead of the 1000 
it prints 232. Does anybody have a idea whats wrong?

To anticipate corresponding questions, normally I also want to vary c 
between 0..1   ;-)

Thank you for your help!
Ciao by Philipp

More information about the SciPy-user mailing list