relatively new to Mathematica, but couldn’t find an answer online for how to do this more cleanly.
I am solving these equations in six variables that give me a number of solutions, which are given as a list of rules, e.g.,
solution = {{x1 -> 0, x2 -> 0, x3 -> 0, x4 -> 2, x5 -> 1, x6 -> 0},
{x1 -> 0, x2 -> 0, x3 -> 1, x4 -> 1, x5 -> 0, x6 -> 1},
{x1 -> 0, x2 -> 1, x3 -> 0, x4 -> 1, x5 -> 1, x6 -> 1},
{x1 -> 0, x2 -> 1, x3 -> 1, x4 -> 0, x5 -> 0, x6 -> 2}}
My next step is I need to calculate $y_1,y_2,y_3,y_4,y_5,y_6$ for each of these solutions, which are some (unchanging) linear combination of these values. I am currently doing this by defining (above everything), e.g.,
y1=x1-x3+x5
y2=x3+x4+x5
etc, and then running
xypairs = Table({{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}, {x5, y5}, {x6, y6}} /.
solution((j)), {j, 1, Length(solution)})
which gives me a list of lists, where each sublist contains each of the xy pairs for that solution. However, I need to do a bunch of manipulation on these values afterwards, and as I try to write it as is, I get really messy stuff involving dozens of lines like:
xypairs((t))((2))((2)) + xypairs((t))((4))((2)) - xypairs((t))((3))((2))
I feel there has to be a better way to do this. I want to first calculate the $y_i$ for each solution, and then somehow iterate through each of the solutions so that when I am iterating, I can access the $x_i$ and $y_i$ by some means that is simpler than using a triple index. Please let me know what the best way to approach this is.
Thank you in advance!