1
$\begingroup$

I am a new user. I know, that my question was already asked billion times before, for example here, but I still cannot adopt these answers to my problem. In my problem I am solving the equation and a result I get some number of roots:

sol=Solve[x^2-5*x+6==0,x]

As a result, I get:

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

Now, I want to create a vector with these solution, without x->. I tried to do what was written in the above link, like

sol=sol[[All,1,2]]

I tried to change the above action. Still I cannot avoid x-> in my variable sol. Once again, the answer here gives a solution to my problem if I solved two equations simultaneously. But I have to solve only one.

Thanks in advance,

Mikhail

$\endgroup$
4
  • 1
    $\begingroup$ Map[x /. # &, sol] $\endgroup$
    – Bill
    Oct 21, 2015 at 21:33
  • 2
    $\begingroup$ @Bill, the Map[] isn't actually needed: x /. sol. $\endgroup$ Oct 21, 2015 at 21:47
  • $\begingroup$ Oh, thanks. That's so easy $\endgroup$ Oct 21, 2015 at 21:51
  • $\begingroup$ Might I suggest looking at the tutorial? The business of using /. with Solve[] is discussed there, among other things. $\endgroup$ Oct 21, 2015 at 21:58

0

Browse other questions tagged or ask your own question.