I am trying to solve a system of three equations with Mathematica's NSolve
, for some functions which depend on six parameters, however, three of them are fixed so only the other three will be my solutions. The program seems to work, and I get the three solutions for some values of the fixed parameters, but, the solutions are printed in a different order than the one written in NSolve
function. More precisely: ```
NSolve[EnergyBand[level1, SpinBand[level1][[state1]], x, y, z, [Theta]] == ExperimentalBand[level1][[state1]] && EnergyBand[level2, SpinBand[level2][[state2]], x, y, z, [Theta]] ==ExperimentalBand[level2][[state2]] && EnergyBand[level3, SpinBand[level3][[state3]], x, y, z, [Theta]]== ExperimentalBand[level3][[state3]], {x, y, z}, Reals];
` The functions
EnergyBandand
ExperimentalBandare not relevant here since they just return numbers, and
level1,2,3with
state1,2,3` are known integers. If i print the solutions for some values of \Theta (the number starting from -147, this is what Mathematica shows me: ```
-147
{{z->1.80464,y->0.0250839,x->0.0540758}}
-146
{{z->1.41809,y->0.0239437,x->0.0518834}}
-145
{{z->1.0827,y->0.0228379,x->0.0497059},{z->1.0827,y->0.0228379,x->0.0497059}}
-144
{{z->0.797314,y->0.0217725,x->0.0475389},{z->0.797314,y->0.0217725,x->0.0475389}}
-143
{{z->0.560211,y->0.0207584,x->0.045374}}
```
Basically the solutions are printed as {z,y,x}
instead of {x,y,z}
It is important for me that the values should always have the same order as {x,y,z}
. Can I somehow change that in the NSolve
procedure? The reason why I need a consistent order of the solutions is that at some point in my code I have to access them (like Values@NSolve[...][[k,1]]
or Values@NSolve[...][[k,2]]
and I need to be 100% sure that those values are x
or y
respectively.
So, my question is how can I impose a specific order on the solutions the program spits out? Or how can I know which will be the order of the solutions at runtime?
Thanks in advance!