# A While loop with two different steps/iteration

I'd like to know if there is a possibility to solve an equation in a While loop with 2 different steps. I want the step to be small at the beginning and bigger after a certain value of sigma (sigma is the parameter that changes). I don't have an exemple and didn't find anything near it here. It would look like:

If[sigma<0.5,iteration=0.05
Then[While[Solve[hat==0, x],
Else[While[Solve[hat==0, x], with iteration 0.1]]]


hat is a system of equations (long to obtain and I can't copy everything). I want to know if it is possible, otherwise I'll just put the results together on a plot.

Yes. E.g.:

   iteration = 0.1; j = 0; sigma = 1;
While[j < 0.3,
j = j + iteration;
If[j > .1, sigma = 0];
Print[j];
If[sigma < 0.5, iteration = 0.05, iteration = 0.1]];

• Yes! Seems like it! Thank you very much! – May Mar 29 '13 at 14:49
• Is , iteration 0.1 doing anything here? – Mr.Wizard Mar 29 '13 at 19:26
• sure, I meant iteration = 0.1. And all that is of course a quick schematic sketch. Just excercising quick understanding and answering. – Rolf Mertig Mar 29 '13 at 21:48

Actually, I didn't need the first "If" and j, because the second gives the condition if sigma<0.5 : iteration = 0.1, else sigma>0.5 : iteration = 0.05 :

    iteration = 0.1; σ = 0; While[σ <1,
σ = σ + iteration; Print[σ];
If[σ < 0.5, iteration = 0.05, iteration = 0.1]];