Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica: Getting rid of the "x ->" in FindInstance results

Suppose I have the following results:

a=FindInstance[2*b^2 + b^3 == b^4 + t && t < 10 && t > -1, {b, t}, 
  Integers, 20]
{{b -> -1, t -> 0}, {b -> 0, t -> 0}, {b -> 1, t -> 2}, {b -> 2, 
  t -> 0}}

How can I get rid of the "b->" and just get the array of b answers? I can get halfway there with:

a[[All,1]]
{b -> -1, b -> 0, b -> 1, b -> 2}

but how can I get to just:

{-1, 0, 1, 2}

Thanks

like image 678
Dan Avatar asked Oct 23 '09 21:10

Dan


1 Answers

I might be missing something from dreeves' answer, but the way I always believed you do this was simply by writing:

b /. a

There is an example of this in the "Basic Examples" section of the documentation for the Solve function, which uses the same output style.

like image 63
Will Robertson Avatar answered Sep 25 '22 21:09

Will Robertson