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:

        List @@ Roots[x τ (-1 + τ^2) (-1 + 
\!\(\*SubsuperscriptBox[\(b\), \(1\), \(2\)]\)) (-1 + τ^2 
\!\(\*SubsuperscriptBox[\(b\), \(1\), \(2\)]\)) (Subscript[b, 1] - 
      Subscript[c, 1]) (τ^2 Subscript[b, 1] - Subscript[c, 
      1]) (-1 + 
      Subscript[b, 1] Subscript[c, 1]) (-1 + τ^2 Subscript[b, 1]
        Subscript[c, 1]) (x τ - Subscript[c, 
      2]) (τ^2 Subscript[b, 1] - x Subscript[c, 2]) (-1 + 
      x τ Subscript[c, 2]) (-x + τ^2 Subscript[b, 1]
        Subscript[c, 2]) (x τ - Subscript[c, 
      3]) (τ^2 Subscript[b, 1] - x Subscript[c, 3]) (-1 + 
      x τ Subscript[c, 3]) (-x + τ^2 Subscript[b, 1]
        Subscript[c, 3]) == 0, x]   

gives

    {x == 0, x == Subscript[c, 2]/τ, 
 x == (τ^2 Subscript[b, 1])/Subscript[c, 2], 
 x == 1/(τ Subscript[c, 2]), 
 x == τ^2 Subscript[b, 1] Subscript[c, 2], 
 x == Subscript[c, 3]/τ, 
 x == (τ^2 Subscript[b, 1])/Subscript[c, 3], 
 x == 1/(τ Subscript[c, 3]), 
 x == τ^2 Subscript[b, 1] Subscript[c, 3]}.

I would like to have a list of the roots without the x== in each entry. How can I remove this?

share|improve this question

marked as duplicate by Mr.Wizard Jul 19 '13 at 0:58

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.

3  
Calling your list lst use e.g. lst[[All, 2]]. –  Artes Jul 18 '13 at 20:01
    
Thanks! That exactly answered my question. –  Tyrone Jul 18 '13 at 20:03

1 Answer 1

up vote 4 down vote accepted

I think Artes will not elaborate and since questions should have answers posted as such, I will volunteer to try to write one.

Let's call your result lst. In Mathematica all things, however rendered, are functions wrapped in functions. Those equality signs? Actually a function called Equal.

To extract some part of an output it helps to know exactly how the expression we're dealing with looks and for this purpose we have FullForm.

lst // FullForm

Gives

List[Equal[x,0],Equal[x,Times[Power[\[Tau],-1],Subscript[c,2]]],Equal[x,Times[Power[\[Tau],2],Subscript[b,1],Power[Subscript[c,2],-1]]],Equal[x,Times[Power[\[Tau],-1],Power[Subscript[c,2],-1]]],Equal[x,Times[Power[\[Tau],2],Subscript[b,1],Subscript[c,2]]],Equal[x,Times[Power[\[Tau],-1],Subscript[c,3]]],Equal[x,Times[Power[\[Tau],2],Subscript[b,1],Power[Subscript[c,3],-1]]],Equal[x,Times[Power[\[Tau],-1],Power[Subscript[c,3],-1]]],Equal[x,Times[Power[\[Tau],2],Subscript[b,1],Subscript[c,3]]]]

Artes retrieved all elements on the first level and the second element on the second level using Part (lst[[All, 2]]). We can easily see from the FullForm that this is possible. Your list is just a list of Equal elements and the relevant part is the second argument to those list elements.

Most of all, peaking at the expression with FullForm often makes it very easy to find patterns that match what you want to extract, you could do

lst /. Equal[__, x__] -> x

and you would get the same thing.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.