 evala - Maple Help

evala

evaluate in an algebraic number (or function) field Calling Sequence evala(expr) evala(expr, opts) Parameters

 expr - expression or an unevaluated function call opts - (optional) name or a set of names Description

 • If expr is an unevaluated function call, such as Gcd(u,v), the function is performed in the smallest algebraic number (or function) field possible. Otherwise, evala(Normal(expr)) is computed.
 • The following placeholders are accepted by evala and described in the documentation.  For example, to find further help on the Gcd command see evala/Gcd.

 • The algebraic numbers and functions must be represented with the RootOf notation.   For example, the algebraic number $\sqrt{2}$ is represented by $\mathrm{RootOf}\left({z}^{2}-2,z\right)$ and the algebraic function $\sqrt{x}$ is represented by $\mathrm{RootOf}\left({z}^{2}-y,z\right)$.
 • If the function is Gcd or the underlying process involves gcd computations, a case discussion and combination is attempted in case of reducible RootOfs (see evala/Gcd).
 • The evala command supports a second argument opts, which is an option or a set of options to be passed to the appropriate function. The help pages for the placeholders describe the options that are currently accepted.
 • In some cases, evala checks that the RootOfs are independent. If relations are found, an error may occur. The relations are accessible through the variable lasterror. The independence checking is performed if the function is one of the following:

 Gcd Primfield Primpart Content Factor Factors AFactor AFactors Sqrfree

 • You can instruct evala to skip this independence checking by adding the option 'independent' to the option set opts. However, the result may be incorrect if the option 'independent' is used but the RootOfs are not actually independent.
 • Information about the execution of the function can be displayed by setting infolevel[evala] to a positive integer. Likewise, assigning a positive integer to infolevel[function], where function is one of the placeholders, causes Maple to print selected information about computations involving function. Examples

Define aliases for the examples.

 > $\mathrm{alias}\left(\mathrm{sqrt2}=\mathrm{RootOf}\left({x}^{2}-2\right),\mathrm{sqrt3}=\mathrm{RootOf}\left({x}^{2}-3\right),\mathrm{sqrt6}=\mathrm{RootOf}\left({x}^{2}-6\right)\right):$
 > $\mathrm{evala}\left({\mathrm{sqrt2}}^{2}\right)$
 ${2}$ (1)

Compute the quotient q and remainder r of a divided by b such that $a=\mathrm{bq}+r$.

 > $a≔{x}^{2}-x+3;$$b≔x-\mathrm{sqrt2}$
 ${a}{≔}{{x}}^{{2}}{-}{x}{+}{3}$
 ${b}{≔}{x}{-}{\mathrm{sqrt2}}$ (2)
 > $q≔\mathrm{evala}\left(\mathrm{Quo}\left(a,b,x\right)\right)$
 ${q}{≔}{\mathrm{sqrt2}}{+}{x}{-}{1}$ (3)
 > $r≔\mathrm{evala}\left(\mathrm{Rem}\left(a,b,x\right)\right)$
 ${r}{≔}{-}{\mathrm{sqrt2}}{+}{5}$ (4)
 > $\mathrm{evala}\left(a-bq-r\right)$
 ${0}$ (5)

Polynomial multiplication and factorization over $Q\left(\sqrt{2},\sqrt{3}\right)$

 > $f≔\left(\mathrm{sqrt2}x+\mathrm{sqrt3}\right)\left(\mathrm{sqrt3}x+\mathrm{sqrt2}\right)$
 ${f}{≔}\left({\mathrm{sqrt2}}{}{x}{+}{\mathrm{sqrt3}}\right){}\left({\mathrm{sqrt3}}{}{x}{+}{\mathrm{sqrt2}}\right)$ (6)
 > $\mathrm{evala}\left(\mathrm{Normal}\left(f\right)\right)$
 $\frac{{\mathrm{sqrt2}}{}\left({\mathrm{sqrt2}}{}{\mathrm{sqrt3}}{+}{2}{}{x}\right){}{\mathrm{sqrt3}}{}\left({\mathrm{sqrt2}}{}{\mathrm{sqrt3}}{+}{3}{}{x}\right)}{{6}}$ (7)
 > $g≔\mathrm{evala}\left(\mathrm{Expand}\left(f\right)\right)$
 ${g}{≔}{\mathrm{sqrt3}}{}{\mathrm{sqrt2}}{}{{x}}^{{2}}{+}{\mathrm{sqrt2}}{}{\mathrm{sqrt3}}{+}{5}{}{x}$ (8)
 > $\mathrm{evala}\left(\mathrm{Factor}\left(g\right)\right)$
 ${\mathrm{sqrt2}}{}{\mathrm{sqrt3}}{}\left({x}{+}\frac{{\mathrm{sqrt2}}{}{\mathrm{sqrt3}}}{{3}}\right){}\left(\frac{{\mathrm{sqrt2}}{}{\mathrm{sqrt3}}}{{2}}{+}{x}\right)$ (9)

An example of dependent algebraic functions

 > $\mathrm{alias}\left(\mathrm{sqrtu}=\mathrm{RootOf}\left({x}^{2}-u,x\right),\mathrm{sqrtv}=\mathrm{RootOf}\left({x}^{2}-v,x\right),\mathrm{sqrtuv}=\mathrm{RootOf}\left({x}^{2}-uv,x\right)\right):$
 > $a≔\mathrm{sqrtu}\mathrm{sqrtv}\mathrm{sqrtuv}$
 ${a}{≔}{\mathrm{sqrtu}}{}{\mathrm{sqrtv}}{}{\mathrm{sqrtuv}}$ (10)
 > $\mathrm{evala}\left(\mathrm{Normal}\left(\frac{1}{a}\right)\right)$
 $\frac{{\mathrm{sqrtu}}{}{\mathrm{sqrtv}}{}{\mathrm{sqrtuv}}}{{{u}}^{{2}}{}{{v}}^{{2}}}$ (11)

Norms of algebraic numbers and algebraic functions

 > $\mathrm{evala}\left(\mathrm{Norm}\left(\mathrm{sqrt2}\right)\right)$
 ${-2}$ (12)
 > $\mathrm{evala}\left(\mathrm{Norm}\left(\mathrm{sqrt2}+\mathrm{sqrt3}\right)\right)$
 ${1}$ (13)
 > $n≔\left(\mathrm{sqrt}\left(2\right)+\mathrm{sqrt}\left(3\right)\right)\left(\mathrm{sqrt}\left(2\right)-\mathrm{sqrt}\left(3\right)\right)\left(-\mathrm{sqrt}\left(2\right)+\mathrm{sqrt}\left(3\right)\right)\left(-\mathrm{sqrt}\left(2\right)-\mathrm{sqrt}\left(3\right)\right)$
 ${n}{≔}\left(\sqrt{{2}}{+}\sqrt{{3}}\right){}\left(\sqrt{{2}}{-}\sqrt{{3}}\right){}\left({-}\sqrt{{2}}{+}\sqrt{{3}}\right){}\left({-}\sqrt{{2}}{-}\sqrt{{3}}\right)$ (14)
 > $\mathrm{expand}\left(n\right)$
 ${1}$ (15)
 > $\mathrm{evala}\left(\mathrm{Norm}\left(u+\mathrm{sqrtu}\right)\right)$
 ${{u}}^{{2}}{-}{u}$ (16)
 > $\mathrm{evala}\left(\mathrm{Primfield}\left(\left\{\mathrm{sqrt2},\mathrm{sqrt3}\right\}\right)\right)$
 $\left[\left[{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{10}{}{{\mathrm{_Z}}}^{{2}}{+}{1}\right){=}{\mathrm{sqrt2}}{+}{\mathrm{sqrt3}}\right]{,}\left[{\mathrm{sqrt2}}{=}\frac{{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{10}{}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}^{{3}}}{{2}}{-}\frac{{9}{}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{10}{}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}{{2}}{,}{\mathrm{sqrt3}}{=}\frac{{11}{}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{10}{}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}{{2}}{-}\frac{{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{10}{}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}^{{3}}}{{2}}\right]\right]$ (17)
 > $z≔\mathrm{sqrt2}+\mathrm{sqrt3}$
 ${z}{≔}{\mathrm{sqrt2}}{+}{\mathrm{sqrt3}}$ (18)
 > $\mathrm{evala}\left({z}^{4}-10{z}^{2}+1\right)$
 ${0}$ (19)

The following examples demonstrate that the result by using the option 'independent' for actually dependent algebraic functions may not be correct.

 > $b≔{x}^{2}-\mathrm{RootOf}\left({x}^{2}-x\right)$
 ${b}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}\right)$ (20)
 > $c≔{x}^{2}-2x+1$
 ${c}{≔}{{x}}^{{2}}{-}{2}{}{x}{+}{1}$ (21)
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(b,c\right)\right)$
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(b,c\right),'\mathrm{independent}'\right)$
 ${1}$ (22)
 > $\mathrm{b1}≔{x}^{2}-\mathrm{RootOf}\left({x}^{2}-x,\mathrm{index}=1\right)$
 ${\mathrm{b1}}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{,}{\mathrm{index}}{=}{1}\right)$ (23)
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(\mathrm{b1},c\right)\right)$
 ${1}$ (24)
 > $\mathrm{b2}≔{x}^{2}-\mathrm{RootOf}\left({x}^{2}-x,\mathrm{index}=2\right)$
 ${\mathrm{b2}}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{,}{\mathrm{index}}{=}{2}\right)$ (25)
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(\mathrm{b2},c\right)\right)$
 ${x}{-}{1}$ (26)
 > $d≔{x}^{2}+x$
 ${d}{≔}{{x}}^{{2}}{+}{x}$ (27)
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(b,d\right)\right)$
 ${x}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}\right)$ (28)
 > $\mathrm{evala}\left(\mathrm{Gcd}\left(b,d\right),'\mathrm{independent}'\right)$
 ${1}$ (29)