I have the following Mathematica code
Clear["Global`*"];
Off[Solve::"ratnz"]
V = 1/2*(ω1^2*x^2 + ω2^2*y^2) - \[Epsilon]*x^2*y^2;
rad2 = (2*h*(ω1^2 + ω2^2))/(ω1^2*ω2^2);
ω1 = 0.4; ω2 = 0.4;
\[Epsilon] = 1;
hmin = 0.0064;
hmax = 0.03;
For[h = hmin, h <= hmax, h++,
data = {};
sol = Solve[{V == h, x^2 + y^2 == rad2}, {x, y}];
xL = Abs[x /. sol[[1]]];
yL = Abs[y /. sol[[2]]];
P1 = {xL, yL};
P2 = {yL, xL};
dist = Sqrt[(xL^2 - yL^2)^2 + (yL^2 - xL^2)^2];
AppendTo[data, {h, dist}];
]
However, even if it should be an iterative process (loop) it computes the value of dist only for the first value of h which is 0.0064. So, the list data contains only one pair of numbers. I cannot find where is the mistake in the code which prevents the loop. Moreover, how can I adjust the step of the loop, I mean the step between the successive values of h. Many thanks in advance.


hmin +1 = 1.0064which is greater thanhmax– image_doctor Jan 16 at 11:47h+=0.0001if you want to keep theFor– Pinguin Dirk Jan 16 at 11:52For[start,test,increment,body]. – image_doctor Jan 16 at 11:52Map, short form/@, andRangeas inmyF[#]&/@Range[start,end,step]. – image_doctor Jan 16 at 12:35