0

This is probably a simple question, but i couldn't find a solid answer. So i have an equation

Solve[{F[x, y] == 0, G[x, y] == 0}, {x, y}]

but i want to use the solutions as part of another function. However the solutions are in the form

(* {{x -> 0., y -> 4.}, {x -> 1., y -> 1.}, {x -> 1.5, y -> 0.}, {x -> 0., y -> 0.}} *)

Can I convert the solution to an array or otherwise store the solutions as a variable?

bbgodfrey
  • 61,439
  • 17
  • 89
  • 156

1 Answers1

1

If you just want the $x$ values:

x/. {{x -> 0., y -> 4.}, {x -> 1., y -> 1.}, {x -> 1.5, y -> 0.}, {x -> 0., y -> 0.}}

(0., 1., 1.5, 0}

and likewise for the $y$ values, which of course can be named, or:

mySols = {x, y} /. {{x -> 0., y -> 4.}, {x -> 1., y -> 1.}, {x -> 1.5, y -> 0.}, {x -> 0., y -> 0.}}

(* {{0., 4.}, {1., 1.}, {1.5, 0.}, {0., 0.}} *)

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
  • Thanks. How would I access the points in the mySols variable? – hijodelsol14 Apr 23 '15 at 01:46
  • @hijodelsol14 I sense you're really new to Mathematica. Nevertheless, you get the $n$th data point as mySols[[n]], so the third data point is mySols[[3]]. Have I solved your question? Care to upvote or accept my answer? (Just click on the uparrow to the left of my answer.) – David G. Stork Apr 23 '15 at 02:17