Hello,
I have two similar programs, but their execution time is so different. This one executes very fast:
n(N_go)=ninf;n(N_go-1)=ninf-epsi;for m=(N_go-1):-1:2 n(m-1)=h^2/D*(B*n(m)^2-G)+2*n(m)-n(m+1);end;
And this one takes very very long:
n(1)=n0;n(2)=C/(2*D)*n(1)*h+n(1);for m=2:1:N_go n(m+1)=h^2/D*(B*n(m)^2-G)+2*n(m)-n(m-1);end;
N_go=10000000 in both cases. Other parameters are also equal. Can someone explain to me, why second code is taking so long to execute?
Best Answer