In article <[EMAIL PROTECTED]>,
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> def f(x,y):
> return math.sin(x*y) + 8 * x
> I have code like this:
>
> def main():
> n = 2000
> a = zeros((n,n), Float)
> xcoor = arange(0,1,1/float(n))
> ycoor = arange(0,1,1/float(n))
>
>
> for i in range(n):
> for j in range(n):
> a[i,j] = f(xcoor[i], ycoor[j]) # f(x,y) = sin(x*y) + 8*x
>
> print a[1000,1000]
> pass
>
> if __name__ == '__main__':
> main()
I would guess that you are spending most of your time calculating
sin(x*y). To find out, just replace f(x,y) with 1, which will produce
wrong results really fast, and see what that does to your execution time.
________________________________________________________________________
TonyN.:' [EMAIL PROTECTED]
' <http://www.georgeanelson.com/>
--
http://mail.python.org/mailman/listinfo/python-list