a = x == 4
b = x == y^2
Solve[a && b, {x, y}]
has solution {{x → 4, y → -2}, {x → 4, y → 2}}
How can I store {4,-2} and {4,2} into a list?
Thanks.
a = x == 4
b = x == y^2
Solve[a && b, {x, y}]
has solution {{x → 4, y → -2}, {x → 4, y → 2}}
How can I store {4,-2} and {4,2} into a list?
Thanks.
Try
mylist = {x, y} /. Solve[a && b, {x, y}]
or
mylist = ReplaceAll[{x, y}, Solve[a && b, {x, y}]]
Perhaps unfortunately, the help/documentation page for ReplaceAll or /. don’t show an example like this and assume the new user will be able to discover this.
Hi Steve
Take a look at this example
eqn = Solve[4 x + 2 y == 28 && x > 0 && y > 0, {x, y},
Integers]; p = {x, y} /. eqn
In[817]:= eqn
Out[817]= {{x -> 1, y -> 12}, {x -> 2, y -> 10}, {x -> 3,
y -> 8}, {x -> 4, y -> 6}, {x -> 5, y -> 4}, {x -> 6, y -> 2}}
In[818]:= p
Out[818]= {{1, 12}, {2, 10}, {3, 8}, {4, 6}, {5, 4}, {6, 2}}