# How can I select element of a list containing (a,b) where both a and b ara rational numbers and not integers?

I have a list of equations and I solve them

list = {x^2 - 2 x - 3 == 0, 2 x^2 + 3 x + 1 == 0, x^2 - 2 == 0,
6 x^2 - 5 x + 1 == 0};
mytab = Table[Solve[list[[i]]], {i, 1, Length[list]}]


{{{x -> -1}, {x -> 3}}, {{x -> -1}, {x -> -(1/2)}}, {{x -> -Sqrt[2]}, {x -> Sqrt[ 2]}}, {{x -> 1/3}, {x -> 1/2}}}

I would like to select the element {{x -> 1/3}, {x -> 1/2}}, because 1/3, 1/2 are rational numbers and not integer numbers. How can I select them?

One possibility out of many

list={x^2 - 2  x - 3 == 0, 2  x^2 + 3  x + 1 == 0, x^2 - 2==0, 6 x^2 - 5  x + 1== 0};
Cases[Solve /@ list, {{x -> _Rational}, {x -> _Rational}}]


Note: You do not need to type

mytab = Table[Solve[list[[i]]], {i, 1, Length[list]}]


You can just type Solve /@ list instead.

Cases[{{_ -> _Rational} ..}] @ mytab

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

Select[FreeQ[_Integer]] @ mytab

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

Select[mytab, AllTrue[MatchQ[_Rational]]@*Values@*Flatten]

l = {x^2 - 2 x - 3 == 0, 2 x^2 + 3 x + 1 == 0, x^2 - 2 == 0, 6 x^2 - 5 x + 1 == 0};


Using Map instead of Table:

Last@(Solve[# && NotElement[x, Integers], x, Rationals] & /@ l)

(*{{x -> 1/3}, {x -> 1/2}}*)

Pick[mytab,mytab[[All,All,1,2]]/.{{_Rational,_Rational}->True,
{_,_}->False}]//Catenate

(* {{x->1/3},{x->1/2}} *)


(To be pedantic, the OP is asking that both values have the Head 'Rational')

{Element[#,Rationals],Element[#,Rationals]}&/@mytab[[All,All,1,2]]

(* {{True,True},{True,True},{False,False},{True,True}}  *)

list = {
{{x -> -1}, {x -> 3}},
{{x -> -1}, {x -> -(1/2)}},
{{x -> -Sqrt[2]}, {x -> Sqrt[ 2]}},
{{x -> 1/3}, {x -> 1/2}}}


A variant of kglr's first answer using SequenceCases

First /@ SequenceCases[list, {{{_ -> _Rational} ..}}]


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

Using SequencePosition

p = First /@ SequencePosition[list, {{{_ -> _Rational} ..}}]


{4}

Extract[list, p]


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