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))
>
>
>
<[EMAIL PROTECTED]> wrote:
> hello,
>
> I found that scipy only works with python 2.3 or?
You can use Numeric instead of scipy if you need/want to:
from Numeric import arange,reshape,sin
def computeMatrix(n):
xcoor = arange(0,1,1/float(n))
ycoor = reshape(xcoor, (n,1))
return sin(xc
hello,
I found that scipy only works with python 2.3 or?
I don't know if the logic is correct:
1. loop inside loop uses a lot of resources
2. Numeric or Numpy can make program faster
3. It use kind of Array/Matrix analysis style
4. We have to change our algorithms so that Numeric or Numpy can hel
[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):
>
It looks like you're using Numeric for your arrays, but you are then
pulling sin from the math module and calculating one point at a time.
Instead try using sin(whole array) where sin is a ufunc from the
Numeric module. Also, it's usually not good practice to "import
Numeric as *". Instead try im
[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):
>
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) =