evala - Maple Programming 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.

 > alias(sqrt2=RootOf(x^2-2),sqrt3=RootOf(x^2-3),sqrt6=RootOf(x^2-6)):
 > evala(sqrt2^2);
 ${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-sqrt2;
 ${a}{≔}{{x}}^{{2}}{-}{x}{+}{3}$
 ${b}{≔}{x}{-}{\mathrm{sqrt2}}$ (2)
 > q := evala(Quo(a,b,x));
 ${q}{≔}{\mathrm{sqrt2}}{+}{x}{-}{1}$ (3)
 > r := evala(Rem(a,b,x));
 ${r}{≔}{-}{\mathrm{sqrt2}}{+}{5}$ (4)
 > evala(a-b*q-r);
 ${0}$ (5)

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

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

An example of dependent algebraic functions

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

Norms of algebraic numbers and algebraic functions

 > evala(Norm(sqrt2));
 ${-2}$ (12)
 > evala(Norm(sqrt2+sqrt3));
 ${1}$ (13)
 > n := (sqrt(2)+sqrt(3))*(sqrt(2)-sqrt(3))*      (-sqrt(2)+sqrt(3))*(-sqrt(2)-sqrt(3));
 ${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)
 > expand(n);
 ${1}$ (15)
 > evala(Norm(u+sqrtu));
 ${{u}}^{{2}}{-}{u}$ (16)
 > evala(Primfield({sqrt2,sqrt3}));
 $\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 := sqrt2+sqrt3;
 ${z}{≔}{\mathrm{sqrt2}}{+}{\mathrm{sqrt3}}$ (18)
 > evala(z^4-10*z^2+1);
 ${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-RootOf(x^2-x);
 ${b}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}\right)$ (20)
 > c := x^2-2*x+1;
 ${c}{≔}{{x}}^{{2}}{-}{2}{}{x}{+}{1}$ (21)
 > evala(Gcd(b, c));
 > evala(Gcd(b, c), 'independent');
 ${1}$ (22)
 > b1 := x^2-RootOf(x^2-x,index=1);
 ${\mathrm{b1}}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{,}{\mathrm{index}}{=}{1}\right)$ (23)
 > evala(Gcd(b1, c));
 ${1}$ (24)
 > b2 := x^2-RootOf(x^2-x,index=2);
 ${\mathrm{b2}}{≔}{{x}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{,}{\mathrm{index}}{=}{2}\right)$ (25)
 > evala(Gcd(b2, c));
 ${x}{-}{1}$ (26)
 > d := x^2+x;
 ${d}{≔}{{x}}^{{2}}{+}{x}$ (27)
 > evala(Gcd(b, d));
 ${x}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}\right)$ (28)
 > evala(Gcd(b, d), 'independent');
 ${1}$ (29)