The following expression allows me to extract the value of x
and y
:
{x, y, u, v} /. #2 & @@
List[Minimize[{x - 2 y^2, 1500 >= x >= y >= 0}, {x, y}],
List[FindRoot[{v - Sin[u] == 0, v + u == 30}, {u, 0}, {v, 20}]]]~
Flatten~1
On the other hand, this expression allows me to extract the value of u
and v
{x, y, u, v} /. #3 & @@
List[Minimize[{x - 2 y^2, 1500 >= x >= y >= 0}, {x, y}],
List[FindRoot[{v - Sin[u] == 0, v + u == 30}, {u, 0}, {v, 20}]]]~
Flatten~1
I want to extract the 4 values at once modifing the code, you know {x,y,u,v} = {1500, 1500, 30.675, -0.674984}
Does anyone know how to do it? thanks!
Answer
input = Flatten[List[Minimize[{x - 2 y^2, 1500 >= x >= y >= 0}, {x, y}],
List[FindRoot[{v - Sin[u] == 0, v + u == 30}, {u, 0}, {v, 20}]]],
1];
{x, y, u, v} /. Join @@ Rest @ input
(* {1500, 1500, 30.675, -0.674984} *)
or
{x, y, u, v} /. Join@##2 & @@ input
(* {1500, 1500, 30.675, -0.674984} *)
or
{x, y, u, v} /. #2 /. #3 & @@ input
(* {1500, 1500, 30.675, -0.674984} *)
Comments
Post a Comment