This question already has an answer here:

Consider matrix equation

m = {{1, 2}, {3, 4}}
l = {{1}, {0}}
p = {{p1}, {p2}}
eq = m.p == l

Output is

{{p1 -> -2, p2 -> 3/2}}

But p1 and p2 do not have these values in worksheet :-(

How to refer to each solution as p1 and p2?


marked as duplicate by Mr.Wizard Jul 4 '17 at 4:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

sol = Solve[eq]

enter image description here

Set @@@ sol[[1]];

{p1, p2}

enter image description here

This assignment has the disadvantage that it changes your original definitions of p and eq

If you want to assign to other variables:

{v1, v2} = sol[[1, All, 2]];

{v1, v2}

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.