Hello,
Evaluating a func
is a bit time consuming, and doing it at each grid point is not the best you can do. The more standard way is to use macro
, that does literal replacement at compile time.
This gives
macro Ax(t) (exp((t)-y)*sin(pi*x))//EOM
macro Ay(t) (exp((t)-x)*sin(2.*pi*y))//EOM
macro psi(t) (exp(-(t))*cos(2.*pi*x)+1i*exp(-(t))*cos(pi*y))//EOM
macro H(t) (-exp((t)-x)*sin(2.*pi*y)+exp((t)-y)*sin(pi*x))//EOM
[Ao1x,Ao1y] = [Ax(0.),Ay(0.)];
psio1 = psi(0.);
w = H(0.);