# How to convert the form of a solution from solve {x -> 1, y -> 1, z -> Sqrt[2]} into a list form {1, 1, Sqrt[2]}? [closed]

How to convert the form of a solution from solve as follows:

 {x -> 1, y -> 1, z -> Sqrt[2]}

into a list form

{1, 1, Sqrt[2]}?

• The canonical way is {x, y, z} /. {x -> 1, y -> 1, z -> Sqrt[2]}. Apr 20 at 17:36
• (-1) After asking 247 undeleted questions, you still don't learn anything about the usage of /., not to mention basic list manipulation. Apr 21 at 2:01

sol = {x -> 1, y -> 1, z -> Sqrt[2]};


Some other possibilities

Using Cases

Cases[(_ -> v_) :> v] @ sol


Using ReplaceAll

sol /. Rule[_, v_] :> v


Using Query

Query[All, 2] @ sol


Using Map

Map[Last] @ sol


All produce

{1, 1, Sqrt[2]}

Try

{x -> 1, y -> 1, z -> Sqrt[2]}[[All, 2]]


or

{x -> 1, y -> 1, z -> Sqrt[2]} // Values


If you used Solve to get these solutions, you can avoid the need for post-processing the result by using SolveValues instead.

Adding to what eldo said, I really like manual pattern matching even for very annoying cases. For your case:

sol = {x -> 1, y -> 1, z -> Sqrt[2]};
Replace[sol, {x -> a_, y -> b_, z -> c_} :> {a, b, c}]


But let's say something very annoying that needs counting levels or trial and error, I just copy the original list and paste in the second argument of Replace and replace the parts I want with variables:

annoyingsol = {{{{{x -> 1}}}}, y -> 1, z -> Sqrt[2]};
Replace[annoyingsol, {{{{{x -> a_}}}}, y -> b_, z -> c_} :> {a, b, c}]