Question: Nested loop is not executed, at least nothing is returned

Seems that I don't know how to organize a nested loop.

Simple example:

for i by 2 to 19 do

for k from 2 to 26 do

A := i*k

end do

end do

Nothing is returned here (when I expected a list of different values for A).

___________________

And program in which I encountered this problem (and for which I am seeking for a solution of the problem) is below. Thanks for help!

for a from .5 by .3 to 2 do

for m from -1 by .5 to 1 do

for n from -5 by 2.5 to 5 do

ODE := diff(diff(x(t), t), t)+.2*(diff(x(t), t))-x(t) = a*sin(t);

k[1] := 0; ics[1] := x(k[1]) = 0, (D(x))(k[1]) = 0;

for i to 3 do

X[i] := dsolve({ODE, ics[i]});

u[i] := rhs(X[i]);

v[i] := diff(rhs(X[i]), t);

S1[i] := RootFinding:-NextZero(unapply(rhs(X[i])-1, t), k[i]+0.1e-3);

S2[i] := RootFinding:-NextZero(unapply(rhs(X[i])+1, t), k[i]+0.1e-3);

k[i+1] := min(select(type, [S1[i], S2[i]], numeric));

p[i] := evalf(subs(t = k[i+1], u[i]));

q[i] := evalf(subs(t = k[i+1], v[i]));

ics[i+1] := x(k[i+1]) = p[i], (D(x))(k[i+1]) = -q[i];

plot([u[i](t), v[i](t), t = k[i] .. k[i+1]]);

plo[i] := plot([u[i](t), v[i](t), t = k[i] .. k[i+1]]);

end do;

end do;

end do;

end do;

Please Wait...