I am trying to scan a parameter space of varying numbers of parameters subject to some constraints (I am interested in any number of constraints just out of curiosity, but in reality no more than 2 constraints in the actual). So it would look something like :
TestScan[c1,...,cm,{list1,....listn}]
Where the ci are constraints and the list_i's take the form
{x_i,x_i_initial, x_i_final, x_i_increment}
that will be fed to a Do loop.
The problem is that I want to change the actual value of the x_i so that the c_j's (which are a function of x_i) know that x_i has changed value.
For example I might have a constraint like
x^2+y^2+z^2=1,
I want to scan over values of y and z, solve for the corresponding values of x, then store all the possible solutions in a list. By putting the variables I want to scan over in an array it seems easier since then I can have Mathematica see the size of the array, and run the proper number of loops.
Obviously if I just put the variables in a function like
TestScan[c1,...,cm,x_i,x_i_initial, x_i_final, x_i_increment,....]
and then I would call it like
TestScan[c[x1,x2],x1,x1initial, x1final, x1increment,x2,x2initial, x2final, x2increment]
it works since know Mathematica knows that the argument of c is that same thing as the x1 that appears elsewhere, but I would have to change the code every time I change the number of variables in the constraints. My naive straightforward generalization of the just above does't work when I try to pass all
{x_i,x_i_initial, x_i_final, x_i_increment}
in a list. In this case mathematica might replace the 1 element in the list with something else, but I need to be able to change the value of x_i itself.

Doloop is often considered bad practice in Mathematica. – David Mar 21 '12 at 15:32