check for an algebraic number in radical or RootOf notation

Parameters

 expr - any expression

Description

 • The call type(expr, radalgnum) checks if expr is an algebraic number in RootOf or radical notation.
 • An algebraic number is defined as either a rational number, a root of a univariate polynomial with algebraic number coefficients, specified by a RootOf, or an n-th root of an algebraic number. A sum, product, or quotient of these is also an algebraic number.
 • For example, both $\sqrt{2}$  and RootOf(z^2-2, z) are of type radalgnum.

Examples

 > $\mathrm{type}\left(\frac{2}{3},\mathrm{radalgnum}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(\mathrm{RootOf}\left({z}^{2}+1,z\right),\mathrm{radalgnum}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{r1}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{5}+\mathrm{_Z}+{2}^{\frac{1}{2}}\right)$
 ${\mathrm{r1}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{+}{\mathrm{_Z}}{+}\sqrt{{2}}\right)$ (3)
 > $\mathrm{type}\left(\mathrm{r1},\mathrm{radalgnum}\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{type}\left(\mathrm{r1},\mathrm{algnum}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{r2}≔{\left(2+\mathrm{RootOf}\left({\mathrm{_Z}}^{5}+\mathrm{_Z}+3\right)\right)}^{\frac{2}{3}}$
 ${\mathrm{r2}}{≔}{\left({2}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{+}{\mathrm{_Z}}{+}{3}\right)\right)}^{{2}}{{3}}}$ (6)
 > $\mathrm{type}\left(\mathrm{r2},\mathrm{radalgnum}\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{type}\left(\mathrm{r2},\mathrm{radnum}\right)$
 ${\mathrm{false}}$ (8)
 > $\mathrm{type}\left(\mathrm{RootOf}\left({\mathrm{_Z}}^{\frac{1}{2}}+2\right),\mathrm{radalgnum}\right)$
 ${\mathrm{false}}$ (9)
 > $\mathrm{type}\left(\mathrm{ln}\left(2\right),\mathrm{radalgnum}\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{type}\left(\frac{5}{\mathrm{RootOf}\left({z}^{2}-2,z\right)},\mathrm{radalgnum}\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{type}\left(\mathrm{RootOf}\left({z}^{2}+y,z\right),\mathrm{radalgnum}\right)$
 ${\mathrm{false}}$ (12)