allvalues - Maple Programming Help

allvalues

compute all possible values of expressions involving RootOfs

 Calling Sequence allvalues(expr) allvalues(expr, opt1, opt2, ...)

Parameters

 expr - algebraic expression, Matrix, Vector, list, or set of expressions opt1, opt2, ... - (optional) sequence of options

Description

 • Typically, a RootOf represents more than one value. Thus, expressions involving RootOfs generally evaluate to more than one value or expression. The allvalues command returns, in an expression sequence, all such values (or expressions) generated by the combinations of different values of the RootOfs.
 • The allvalues command attempts to find symbolic representations of the roots using solve.  If in calling solve it returns only a partial set of roots and sets _SolutionsMayBeLost to true, then allvalues sets the global variable _ValuesMayBeLost to true and continues to work with set of partial solutions.
 - For roots of polynomials, allvalues attempts to return representations in terms of radicals, unless option 'implicit' is specified (see below). If no such expression is found, then indexed RootOfs are used.
 - For roots of expressions that are not polynomials, symbolic representations may or may not be available:
 When symbolic solutions are found, note that some solutions may be missing. In some cases, the solution set is parameterized by names with the following prefix: _Z is for integer values, _NN for non-negative integer values, _B for boolean values (0 or 1). See also solve.
 If solve cannot find symbolic representations of the roots, then fsolve is used to search for numerical approximations. If numerical approximations are found, RootOfs with a numerical selector are returned.  If it cannot be determined that fsolve has found all the roots, then the global variable _ValuesMayBeLost will be set to true.
 If no symbolic representation nor numerical approximations are found, the RootOf is not expanded. However, if Maple can prove that there is no complex solutions to the equation corresponding to the RootOf, NULL is returned.
 • The following options are supported:
 - The name 'independent' or 'dependent': If the option 'dependent' is given, then a particular $\mathrm{RootOf}\left(p\right)$ represents the same root at each occurrence within expr. This is the default. In contrast, if the option is 'independent', then each occurrence of $\mathrm{RootOf}\left(p\right)$ is to be treated independently. This option has no effect on RootOfs containing a selector that makes them single-valued.
 - The name 'explicit' or 'implicit': If the option 'explicit' is given, then allvalues tries to find radical expressions for roots of polynomials. This is the default unless _EnvExplicit has a numerical value. In the latter case only the input of length smaller than that value will be made explicit. If the option 'implicit' is given, then indexed RootOfs are used.
 - A RootOf or a set of RootOfs: The RootOfs specified is not expanded by allvalues and remains inert.
 • The allvalues command takes selectors of RootOf into account:
 - If the selector is a numerical approximation, then the RootOf is considered as a single-valued object, namely the closest root to the selector.
 - If the selector is a range, then the roots are sought in this range.
 - If the selector is an index of the form $\mathrm{index}=\mathrm{expr1}$, then the RootOf is considered as a single-valued object, except when expr1 is a set or a range.
 - If the selector is a label of the form $\mathrm{label}=\mathrm{expr2}$, then the RootOf is viewed as a multi-valued object.
 • Nested RootOfs are supported by allvalues.

Examples

 > $\mathrm{e1}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right)+\frac{1}{{\mathrm{RootOf}\left({\mathrm{_Z}}^{4}-1\right)}^{2}}$
 ${\mathrm{e1}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}\right){+}\frac{{1}}{{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{1}\right)}^{{2}}}$ (1)
 > $\mathrm{allvalues}\left(\mathrm{e1}\right)$
 ${2}{,}{0}{,}{0}{,}{-}{2}{,}{2}{,}{0}{,}{0}{,}{-}{2}$ (2)
 > $\mathrm{e2}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-1\right)$
 ${\mathrm{e2}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{1}\right)$ (3)
 > $\mathrm{allvalues}\left(\mathrm{e2}\right)$
 ${1}{,}{-}\frac{{1}}{{2}}{+}\frac{{1}}{{2}}{}{I}{}\sqrt{{3}}{,}{-}\frac{{1}}{{2}}{-}\frac{{1}}{{2}}{}{I}{}\sqrt{{3}}$ (4)
 > $\mathrm{allvalues}\left(\mathrm{e2},'\mathrm{implicit}'\right)$
 ${1}{,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{2}\right)$ (5)
 > $\mathrm{f1}≔\mathrm{RootOf}\left(\left(x-1\right)\left(\mathrm{cos}\left(x\right)-x\right)\right)$
 ${\mathrm{f1}}{≔}{\mathrm{RootOf}}{}\left(\left({\mathrm{_Z}}{-}{1}\right){}\left({\mathrm{cos}}{}\left({\mathrm{_Z}}\right){-}{\mathrm{_Z}}\right)\right)$ (6)
 > $\mathrm{allvalues}\left(\mathrm{f1}\right)$
 ${1}{,}{\mathrm{RootOf}}{}\left({\mathrm{_Z}}{-}{\mathrm{cos}}{}\left({\mathrm{_Z}}\right){,}{0.7390851332}\right)$ (7)
 > $\mathrm{f2}≔\mathrm{RootOf}\left(\left(x+1\right)\left(\mathrm{cos}\left(x\right)-x\right),1\right)$
 ${\mathrm{f2}}{≔}{\mathrm{RootOf}}{}\left(\left({\mathrm{_Z}}{+}{1}\right){}\left({\mathrm{cos}}{}\left({\mathrm{_Z}}\right){-}{\mathrm{_Z}}\right){,}{1}\right)$ (8)
 > $\mathrm{allvalues}\left(\mathrm{f2}\right)$
 ${\mathrm{RootOf}}{}\left({\mathrm{_Z}}{-}{\mathrm{cos}}{}\left({\mathrm{_Z}}\right){,}{1}\right)$ (9)
 > $\mathrm{allvalues}\left(\mathrm{sin}\left(\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-{a}^{2}\right)\right)\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right)\right)$
 ${\mathrm{sin}}{}\left(\sqrt{{{a}}^{{2}}}\right){,}{-}{\mathrm{sin}}{}\left(\sqrt{{{a}}^{{2}}}\right){,}{-}{\mathrm{sin}}{}\left(\sqrt{{{a}}^{{2}}}\right){,}{\mathrm{sin}}{}\left(\sqrt{{{a}}^{{2}}}\right)$ (10)
 > $\mathrm{e3}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right)\right)$
 ${\mathrm{e3}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right)\right)$ (11)
 > $\mathrm{allvalues}\left(\mathrm{e3},\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right)\right)$
 $\sqrt{{1}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right)}{,}{-}\sqrt{{1}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right)}$ (12)
 > $\mathrm{allvalues}\left(\mathrm{e3},\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right),\mathrm{implicit}\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right){,}{\mathrm{index}}{=}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right){,}{\mathrm{index}}{=}{2}\right)$ (13)
 > $\mathrm{allvalues}\left(\mathrm{e3},\mathrm{e3}\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}\sqrt{{2}}{-}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}\sqrt{{2}}{-}{1}\right)$ (14)
 > $\mathrm{allvalues}\left(\mathrm{e3},\left\{\mathrm{e3},\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right)\right\}\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right)\right)$ (15)
 > $\mathrm{e4}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right)-\frac{1}{\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right)}$
 ${\mathrm{e4}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}\right){-}\frac{{1}}{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}\right)}$ (16)
 > $\mathrm{allvalues}\left(\mathrm{e4}\right)$
 ${0}{,}{0}$ (17)
 > $\mathrm{allvalues}\left(\mathrm{e4},'\mathrm{independent}'\right)$
 ${0}{,}{-}{2}{,}{2}{,}{0}$ (18)
 > $\mathrm{e5}≔\left\{\mathrm{allvalues}\left(\mathrm{RootOf}\left({\mathrm{_Z}}^{5}-\mathrm{_Z}+1\right)\right)\right\}$
 ${\mathrm{e5}}{≔}\left\{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{-}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{-}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{2}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{-}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{3}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{-}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{4}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{5}}{-}{\mathrm{_Z}}{+}{1}{,}{\mathrm{index}}{=}{5}\right)\right\}$ (19)
 > $\mathrm{evalf}\left(\mathrm{e5}\right)$
 $\left\{{-}{1.167303978}{,}{-}{0.1812324445}{-}{1.083954101}{}{I}{,}{-}{0.1812324445}{+}{1.083954101}{}{I}{,}{0.7648844336}{-}{0.3524715460}{}{I}{,}{0.7648844336}{+}{0.3524715460}{}{I}\right\}$ (20)
 > $\mathrm{e6}≔\mathrm{RootOf}\left({x}^{2}-2\right)+\mathrm{RootOf}\left({x}^{2}-2,\mathrm{index}=1\right)$
 ${\mathrm{e6}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}\right){+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{index}}{=}{1}\right)$ (21)
 > $\mathrm{allvalues}\left(\mathrm{e6}\right)$
 ${2}{}\sqrt{{2}}{,}{0}$ (22)
 > $\mathrm{allvalues}\left(\mathrm{e6},\mathrm{implicit}\right)$
 ${2}{}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{index}}{=}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{index}}{=}{2}\right){+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{index}}{=}{1}\right)$ (23)
 > $\mathrm{e7}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2,\mathrm{label}=1\right)+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2,\mathrm{label}=2\right)$
 ${\mathrm{e7}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{label}}{=}{1}\right){+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{2}{,}{\mathrm{label}}{=}{2}\right)$ (24)
 > $\mathrm{allvalues}\left(\mathrm{e7}\right)$
 ${2}{}\sqrt{{2}}{,}{0}{,}{0}{,}{-}{2}{}\sqrt{{2}}$ (25)
 > $\mathrm{e8}≔\mathrm{RootOf}\left(\mathrm{sin}\left(\mathrm{_Z}\right)\right)$
 ${\mathrm{e8}}{≔}{\mathrm{RootOf}}{}\left({\mathrm{sin}}{}\left({\mathrm{_Z}}\right)\right)$ (26)
 > $\mathrm{allvalues}\left(\mathrm{e8}\right)$
 ${\mathrm{π}}{}{\mathrm{_Z3~}}$ (27)
 > $\mathrm{e9}≔\mathrm{RootOf}\left({ⅇ}^{\mathrm{_Z}}\right)$
 ${\mathrm{e9}}{≔}{\mathrm{RootOf}}{}\left({{ⅇ}}^{{\mathrm{_Z}}}\right)$ (28)
 > $\mathrm{allvalues}\left(\mathrm{e9}\right)$
 > $\mathrm{e10}≔\mathrm{solve}\left(\left\{{x}^{2}+{y}^{2}-3,{\left(y+1\right)}^{2}-x-1\right\}\right)$
 ${\mathrm{e10}}{≔}\left\{{x}{=}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{3}{}{\mathrm{_Z}}{+}{3}\right){-}{3}{,}{y}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{3}{}{\mathrm{_Z}}{+}{3}\right)\right\}{,}\left\{{x}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{\mathrm{_Z}}{-}{1}\right){+}{1}{,}{y}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{\mathrm{_Z}}{-}{1}\right)\right\}$ (29)
 > $\mathrm{map}\left(\mathrm{evalf}@\mathrm{allvalues},\left[\mathrm{e10}\right]\right)$
 $\left[\left\{{x}{=}{-}{1.500000000}{-}{0.8660254040}{}{I}{,}{y}{=}{-}{1.500000000}{+}{0.8660254040}{}{I}\right\}{,}\left\{{x}{=}{-}{1.500000000}{+}{0.8660254040}{}{I}{,}{y}{=}{-}{1.500000000}{-}{0.8660254040}{}{I}\right\}{,}\left\{{x}{=}{1.618033988}{,}{y}{=}{0.6180339880}\right\}{,}\left\{{x}{=}{-}{0.6180339880}{,}{y}{=}{-}{1.618033988}\right\}\right]$ (30)