2

Consider matrix equation

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

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?

Nigel1
  • 773
  • 4
  • 10

1 Answers1

1
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

eldo
  • 67,911
  • 5
  • 60
  • 168