Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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

Browse other questions tagged or ask your own question.