RootOf - Maple Programming Help

RootOf

a representation for roots of equations

 Calling Sequence RootOf(expr) RootOf(expr, x) RootOf(expr, x, c) RootOf(expr, x, a..b) RootOf(expr, x, index=i) RootOf(expr, x, label=e)

Parameters

 expr - algebraic expression or equation x - (optional) variable name c - (optional) number; specify a root selector a...b - (optional) complex numbers; specify a bounding box index=i - (optional) index where i is an integer label=e - (optional) label where e is anything: a name, an expression, a list, or an integer

Description

 • The function RootOf is a placeholder for representing all the roots of an equation in one variable.  In particular, it is the standard representation for Maple algebraic numbers, algebraic functions (see evala), and finite fields $\mathrm{GF}\left({p}^{k}\right),p\mathrm{prime},k>1$ (see mod).
 • Maple automatically generates RootOfs to express the solutions to polynomial equations and systems of equations (see solve), eigenvalues of matrices (see LinearAlgebra[Eigenvalues]), and rational function integrals (see int). Maple can apply diff, series, evalf, and simplify to RootOf expressions.
 • If x is not specified, then expr must be either a univariate expression or an expression in _Z.  In this case, the RootOf represents the roots of expr with respect to its single variable or _Z, respectively.  If the first argument is not an equation, then the equation $\mathrm{expr}=0$ is assumed.
 • The RootOf function checks the validity of its arguments and solves it for polynomials of degree one. The RootOf is expressed in a single-argument canonical form, obtained by making the argument primitive and expressing the RootOf in terms of the global variable $\mathrm{_Z}$.
 • The alias function is often used with RootOfs to obtain a more compact notation.
 Notes: (1) Maple allows nested RootOfs, but an alias cannot be defined in terms of another alias. (2) The function alias is an interactive tool and should not be used in a Maple procedure.
 • If expr is an irreducible polynomial over a field $F$, then alpha = RootOf(expr) represents an algebraic extension field $K$ over $F$ of degree $\mathrm{degree}\left(\mathrm{expr},x\right)$ where elements of $K$ are represented as polynomials in alpha.
 • Evaluation in the context of evala uses the RootOf notation for the representation of algebraic numbers and algebraic functions.
 • Evaluation in the context of the mod operator uses the RootOf notation for the representation of finite fields.  The elements of the finite field $\mathrm{GF}\left({p}^{k}\right)$ are represented as polynomials in RootOf(expr) where expr is an irreducible polynomial of degree $k\mathbf{mod}p$, that is, an algebraic extension over the integers $\mathbf{mod}p$.
 • RootOfs are not restricted to algebraic extensions. They can be used to represent the solutions of transcendental equations, for example RootOf(cos(x)=x, x).
 • The third (optional) argument is a root selector. Selectors are meant to specify a particular root of an equation or a subset of the roots. They can also be used for working with several (not necessarily specified) roots of the same polynomial. The RootOf function supports the following selectors:
 – A numerical approximation c; if the polynomial is univariate with rational coefficients, the c will select among all the roots of the polynomial the closest one to c. If the approximation is ambiguous, an error will be raised by evalf or convert.
 – A bounding box defined by two complex numbers a and b. The numbers should be given in the order of the lower-left corner of the box to the upper-right corner of the box (or left and right endpoints, in the case of a real interval), otherwise, an error will be raised. Moreover, if there is no root contained in the range, an error will be raised.
 – An index i, using the syntax index=i where i is an integer. The RootOf represents the i-th root of the equation in an order described in the help page RootOf/indexed. This option should be used only when the roots of the equation can be numbered. See RootOf/indexed.
 – A label e, using the syntax label=e. Essentially, labels are meant to distinguish several unspecified roots of the same equation. If the root is an algebraic number, an index selector should be used instead.
 • When a selector is present, especially when expr is a univariate polynomial with rational coefficients, the user should choose a selector specific enough to encode only one number to avoid errors in later computation such as evalf or evala.
 • If $r$ is a RootOf of a polynomial, the allvalues command returns a sequence of formulae (in terms of radicals) for the roots. The convert/radical command returns a formula for the root selected (the principal root if none is selected).

Examples

 > $\mathrm{RootOf}\left({x}^{2}+1=0\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{1}\right)$ (1)
 > $\mathrm{RootOf}\left({x}^{2}-y,x\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{y}\right)$ (2)
 > $\mathrm{RootOf}\left({x}^{3}=\frac{1}{2},x\right)$
 ${\mathrm{RootOf}}{}\left({2}{}{{\mathrm{_Z}}}^{{3}}{-}{1}\right)$ (3)
 > $\mathrm{RootOf}\left(ax+b,x\right)$
 ${-}\frac{{b}}{{a}}$ (4)
 > $\mathrm{alias}\left(a=\mathrm{RootOf}\left({z}^{4}-{z}^{2}+1\right)\right)$
 ${a}$ (5)
 > ${a}^{4}$
 ${{a}}^{{4}}$ (6)
 > $\mathrm{evala}\left({a}^{4}\right)$
 ${{a}}^{{2}}{-}{1}$ (7)
 > $\mathrm{evala}\left({a}^{6}\right)$
 ${-1}$ (8)
 > $\mathrm{evala}\left(\frac{1}{a}\right)$
 ${-}{{a}}^{{3}}{+}{a}$ (9)

Find the values of all roots.

 > $\mathrm{allvalues}\left(a\right)$
 $\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}{,}\frac{{I}}{{2}}{-}\frac{\sqrt{{3}}}{{2}}{,}{-}\frac{\sqrt{{3}}}{{2}}{-}\frac{{I}}{{2}}{,}{-}\frac{{I}}{{2}}{+}\frac{\sqrt{{3}}}{{2}}$ (10)

Some functions use only the principal root.

 > $\mathrm{convert}\left(a,\mathrm{radical}\right)$
 $\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}$ (11)
 > $\mathrm{evalf}\left(a\right)$
 ${0.8660254038}{+}{0.5000000000}{}{I}$ (12)

Factor ${x}^{4}-{x}^{2}+1$ over $\mathrm{ℚ}$ and over $\mathrm{ℚ}\left(a\right)=\mathrm{ℚ}\left[z\right]/⟨{z}^{4}-{z}^{2}+1⟩$.

 > $\mathrm{factor}\left({x}^{4}-{x}^{2}+1\right)$
 ${{x}}^{{4}}{-}{{x}}^{{2}}{+}{1}$ (13)
 > $\mathrm{factor}\left({x}^{4}-{x}^{2}+1,a\right)$
 $\left({{a}}^{{3}}{-}{a}{-}{x}\right){}\left({{a}}^{{3}}{-}{a}{+}{x}\right){}\left({x}{+}{a}\right){}\left({-}{x}{+}{a}\right)$ (14)

Selected RootOfs:

Numerical approximation:

 > $\mathrm{r1}≔\mathrm{RootOf}\left({x}^{3}-2,x,1.26\right)$
 ${\mathrm{r1}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{2}{,}{1.26}\right)$ (15)
 > $\mathrm{evalf}\left(\mathrm{r1}\right)$
 ${1.259921050}$ (16)
 > $\mathrm{evalf}\left(\mathrm{RootOf}\left({x}^{2}-x-1,\frac{1}{2}\right)\right)$
 > $\mathrm{allvalues}\left(\mathrm{RootOf}\left({x}^{2}-x-1,\frac{1}{2}\right)\right)$
 ${-}\frac{\sqrt{{5}}}{{2}}{+}\frac{{1}}{{2}}{,}\frac{\sqrt{{5}}}{{2}}{+}\frac{{1}}{{2}}$ (17)

Bounding box:

 > $\mathrm{r2}≔\mathrm{RootOf}\left({x}^{3}-2,x,-0.7-1.1I..-0.6-1.0I\right)$
 ${\mathrm{r2}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{2}{,}{-0.7}{-}{1.1}{}{I}{..}{-0.6}{-}{I}\right)$ (18)
 > $\mathrm{evalf}\left(\mathrm{r2}\right)$
 ${-0.6299605249}{-}{1.091123636}{}{I}$ (19)
 > $\mathrm{evala}\left(\mathrm{r1}-\mathrm{r2}\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{2}{,}{1.26}\right){-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{2}{,}{-0.7}{-}{1.1}{}{I}{..}{-0.6}{-}{I}\right)$ (20)
 > $\mathrm{RootOf}\left({x}^{2}-x-1,2..3\right)$

Index selector:

Define an alias for the principal root.

 > $\mathrm{alias}\left(a=\mathrm{RootOf}\left({z}^{3}+1,\mathrm{index}=1\right)\right):$

Define an alias for the real root.

 > $\mathrm{alias}\left(b=\mathrm{RootOf}\left({z}^{3}+1,\mathrm{index}=2\right)\right):$
 > $\mathrm{convert}\left(a,\mathrm{radical}\right)$
 ${\left({-1}\right)}^{{1}}{{3}}}$ (21)
 > $\mathrm{convert}\left(b,\mathrm{radical}\right)$
 ${-1}$ (22)
 > $\mathrm{evalf}\left(a-b\right)$
 ${1.500000000}{+}{0.8660254038}{}{I}$ (23)

Label selector:

 > $\mathrm{alias}\left(a=\mathrm{RootOf}\left({z}^{3}+1,\mathrm{label}=1\right)\right):$
 > $\mathrm{alias}\left(b=\mathrm{RootOf}\left({z}^{3}+1,\mathrm{label}=2\right)\right):$
 > $\mathrm{evala}\left(a-b\right)$
 ${a}{-}{b}$ (24)
 > $\mathrm{evala}\left({a}^{3}-{b}^{3}\right)$
 ${0}$ (25)

Functions and Nested RootOfs:

 > $\mathrm{alias}\left(\mathrm{β}=\mathrm{RootOf}\left({y}^{3}-{x}^{2}+1,y\right)\right):$
 > $f≔\frac{\partial }{\partial x}\left(\mathrm{β}+\frac{{\mathrm{β}}^{2}}{x-1}\right)$
 ${f}{≔}\frac{{2}{}{x}}{{3}{}{{\mathrm{\beta }}}^{{2}}}{+}\frac{{4}{}{x}}{{3}{}{\mathrm{\beta }}{}\left({x}{-}{1}\right)}{-}\frac{{{\mathrm{\beta }}}^{{2}}}{{\left({x}{-}{1}\right)}^{{2}}}$ (26)
 > $∫f\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$
 ${\mathrm{\beta }}{+}\frac{{{\mathrm{\beta }}}^{{2}}}{{x}{-}{1}}$ (27)
 > $r≔\mathrm{RootOf}\left(y{ⅇ}^{y}-x,y\right)$
 ${r}{≔}{\mathrm{RootOf}}{}\left({\mathrm{_Z}}{}{{ⅇ}}^{{\mathrm{_Z}}}{-}{x}\right)$ (28)
 > $\mathrm{series}\left(r,x\right)$
 ${x}{-}{{x}}^{{2}}{+}\frac{{3}}{{2}}{}{{x}}^{{3}}{-}\frac{{8}}{{3}}{}{{x}}^{{4}}{+}\frac{{125}}{{24}}{}{{x}}^{{5}}{+}{O}{}\left({{x}}^{{6}}\right)$ (29)
 > $\mathrm{asympt}\left(r,x\right)$
 ${\mathrm{LambertW}}{}\left({x}\right)$ (30)
 > $f≔\mathrm{RootOf}\left(\mathrm{cos}\left(x\right)-z,x\right)$
 ${f}{≔}{\mathrm{RootOf}}{}\left({-}{\mathrm{cos}}{}\left({\mathrm{_Z}}\right){+}{z}\right)$ (31)
 > $\mathrm{series}\left(f,z\right)$
 $\frac{{1}}{{2}}{}{\mathrm{\pi }}{+}{\mathrm{\pi }}{}{\mathrm{_Z1~}}{-}\frac{{1}}{{\left({-1}\right)}^{{\mathrm{_Z1~}}}}{}{z}{-}\frac{{1}}{{6}}{}\frac{{1}}{{\left({\left({-1}\right)}^{{\mathrm{_Z1~}}}\right)}^{{3}}}{}{{z}}^{{3}}{-}\frac{{3}}{{40}}{}\frac{{1}}{{\left({\left({-1}\right)}^{{\mathrm{_Z1~}}}\right)}^{{5}}}{}{{z}}^{{5}}{+}{O}{}\left({{z}}^{{6}}\right)$ (32)
 > $\mathrm{r1}≔\mathrm{RootOf}\left({x}^{2}-2\right)$
 ${\mathrm{r1}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right)$ (33)
 > $\mathrm{r2}≔\mathrm{RootOf}\left({y}^{2}-\mathrm{r1}-1,y\right)$
 ${\mathrm{r2}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right){-}{1}\right)$ (34)
 > $\mathrm{convert}\left(\mathrm{r2},\mathrm{radical}\right)$
 $\sqrt{{1}{+}\sqrt{{2}}}$ (35)
 > $\mathrm{alias}\left(\mathrm{α}=\mathrm{r1},\mathrm{β}=\mathrm{r2}\right):$
 > $\mathrm{evala}\left({\mathrm{r2}}^{3}\right)$
 ${\mathrm{\beta }}{}{\mathrm{\alpha }}{+}{\mathrm{\beta }}$ (36)
 > $\mathrm{evala}\left(\frac{1}{\mathrm{r2}}\right)$
 ${\mathrm{\beta }}{}{\mathrm{\alpha }}{-}{\mathrm{\beta }}$ (37)

Compatibility

 • The RootOf command was updated in Maple 18.

 Applications