# How to I convert the following into a list of numbers?

I have the following expression

K == 2.7536 || K == 4.6917 || K == 6.3913 || K == 8.3237


That I would like to convert into a table or list of numbers that look like the following.

{2.7536, 4.6917, 6.3913, 8.3237}


Is it possible and how can I do it?

expr = K == 2.7536 || K == 4.6917 || K == 6.3913 || K == 8.3237

K /. {ToRules[expr]}


Be aware that K is a built-in symbol and avoid assigning values to it (otherwise obscure things will get broken).

test = k == 2.7536 || k == 4.6917 || k == 6.3913 || k == 8.3237
Cases[test, _ == x_Real -> x]

• Cases[ test, x_Real, 2] also work – Alucard Oct 3 '17 at 14:16

extractor[arg_] := arg[[All, 2]][[#]] & /@ Range@Length@arg


with usage

extractor[K == 2.7536 || K == 4.6917 || K == 6.3913 || K == 8.3237]

• Thanks that solved it! – Turbotanten Oct 3 '17 at 13:25

Here's a variation that indexes into the list and then Applies List:

stuff = K == 2.7536 || K == 4.6917 || K == 6.3913 || K == 8.3237;
List @@ stuff[[All, 2]]

{2.7536, 4.6917, 6.3913, 8.3237}