I have some solve results stored in the ptes variable:
ptes = Solve[{x1, y1} \[Element]
lin[alpha0, p1x0] && {x1, y1} \[Element] rec1, {x1, y1}]
{{x1 -> -80.0104, y1 -> -7.}, {x1 -> 0, y1 -> 0}}
I would like to store those 4 numbers into 4 different variables. I have been trying to access them in the following manner:
p1tes = Part[ptes, 1];
p2tes = Part[ptes, 2];
and then the single values
p1xtes = p1tes[[1]]
p1ytes = p1tes[[2]]
p2xtes = p2tes[[1]]
p2ytes = p2tes[[2]]
however now in these variables is stored something like
x1 -> -80.0104
I don't know how to store only the value, which I would need to perform some calculation afterward. I have tried reading some similar questions here, but for some reason they do not apply to my case
Thanks
sol = {x1,y1} /. ptes
and then extract numbers fromsol
, for example with{p1x,p1y,p2x,p2y}=Flatten[sol]
. See also mathematica.stackexchange.com/a/18706/26598 $\endgroup$Values@Solve[(y^2 + x^2) == 25 && x + y == 7, {x, y}]
UseFlatten
if you need. $\endgroup$