Hello all, my first post here.
 
I am moving from using scilab to Pylab, can anyone tell me why the two
following snippets of code produce very different results? BTW. The scilab
code produces the expected result.
 
Scilab:
Lx=1;
Ly=1;
n=2;
m=2;
f=100;
w=2*%pi*f;
t=1;
A=2;
Kx=n*%pi/Lx;
Ky=m*%pi/Ly;
x=linspace(0,100);
y=linspace(0,100);
z=zeros(100,100);
for i = 1:100
 for j = 1:100
  z(i,j) = A * sin(Kx*x(i)) * sin(Ky*y(j)) * %e^(%i*w*t);
    end
end
contour(z)
 
 
Pylab:
from pylab import *
Lx=1
Ly=1
n=2
m=2
f=100
w=2*pi*f
t=1 
A=2
Kx=n*pi/Lx
Ky=m*pi/Ly
x=arange(0,100)
y=arange(0,100)
z=empty((100,100))
for i in range(1,100):
    for j in range(1,100):
        z[i, j] = A * sin(Kx*x[i]) * sin(Ky*y[j]) * e**(1j*w*t)
contourf(z)
show()
 
Cheers,
Pete.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to