Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

If I enter


then the answer comes up as

{{x -> 2}, {x -> -2}}

I want to make two variables sol1 and sol2, and sol1=2 and sol2=-2.

I don't mean I want to make sol1 and sol2 from {{x -> 2}, {x -> -2}}

I want to make them directly before anything such as {{x -> 2}, {x -> -2}} comes up.

As long as I get sol1 and sol2, I don't need such answers like {{x -> 2}, {x -> -2}}

I know it's possible because a year ago I could manage to do it after hours of trial-and-error.

But I don't remember now.

share|improve this question

marked as duplicate by m_goldberg, Sjoerd C. de Vries, Artes, Michael E2, Kuba Dec 7 '13 at 15:52

This question was marked as an exact duplicate of an existing question.

{sol1, sol2} = x /. Solve[(x - 2) (x - 2) == 0, x] ? – Kuba Dec 7 '13 at 9:57
@Kuba Thank you very much! :) – iso Dec 7 '13 at 9:59
Specifically this section of the "pitfalls" question: Using the result of functions that return replacement rules – Michael E2 Dec 7 '13 at 13:46