4.4 How to select terms with sqrt or radical

Given

\[ 3+x +\sqrt {-4 a c +b^{2}}+\sin \left (y \right )+x^{3} \sqrt {39}+\sqrt {\cos }x \]
Find terms that are sqrt. Use indets
restart; 
expr_with_radical:= 3+x+sqrt(b^2-4*a*c)+sin(y)+x^3*sqrt(39)+sqrt(cos(x));| 
indets(expr_with_radical, algebraic^fraction)
 

\( \{ \sqrt {39}, \sqrt {-4 a c +b^{2}}, \sqrt {\cos }x \} \)

Alternative is to use type radical

restart; 
expr_with_radical:= 3+x+sqrt(b^2-4*a*c)+sin(y)+x^3*sqrt(39)+sqrt(cos(x));| 
indets(expr_with_radical, radical)
 

\( \{ \sqrt {39}, \sqrt {-4 a c +b^{2}}, \sqrt {\cos }x \} \)