frontend - Maple Programming Help

frontend

process general expression into a rational expression

 Calling Sequence frontend(p, x, f, arg1,..., argn)

Parameters

 p - procedure x - list of arguments to p f - (optional) list of two sets: first, a set of type names not to be frozen; second, a set of expressions not to be frozen (default is [{+,*},{}]) argi - (optional) further arguments to p; these arguments are not to be frozen

Description

 • The purpose of frontend is to extend the domain of computation for many of the functions in Maple.
 • For example, the procedure used by the Maple normal function is defined to work over the domain of rational functions.  Thus, to handle more general expressions such as expressions involving $\mathrm{sin}\left(x\right)$ or $\sqrt{x}$ reasonably, frontend is used to temporarily freeze'' all occurrences of such expressions for unique names.  This is always valid.
 • However, it is important to understand that the zero equivalence property of the normal function is only guaranteed if the subexpressions that are frozen are algebraically independent.
 • Each item in the list x is frozen''. The order in which the freezing'' occurs is as follows.
 • The following are not frozen: integers; rationals; floats that are of type numeric; strings; and names that are not of type constant.
 • If the argument is of type +, *, or ^ and the exponent is an integer, then freezing is applied recursively.
 • If the argument has any subexpression in the set of expressions, then freezing is applied recursively.
 • If the argument is one of the types in the set of type names, freezing is applied recursively.
 • Otherwise, the expression is substituted for a unique name.
 • The procedure p is then evaluated with the frozen'' argument(s). Any frozen names occurring in the result are substituted back for their original subexpressions.
 • The frontend function does not work with functions that assign a value to the function argument(s). For example, gcdex works but not if you specify the optional arguments.

 • The frontend command is thread-safe as of Maple 15.

Examples

 > $a≔\mathrm{sin}\left(x\right)+{x}^{2}$
 ${a}{:=}{\mathrm{sin}}{}\left({x}\right){+}{{x}}^{{2}}$ (1)
 > $\mathrm{degree}\left(a,x\right)$
 ${\mathrm{FAIL}}$ (2)
 > $\mathrm{frontend}\left(\mathrm{degree},\left[a,x\right]\right)$
 ${2}$ (3)
 > $b≔{\left(\mathrm{sin}\left(x+y\right)+\mathrm{sin}\left(x-y\right)\right)}^{2}$
 ${b}{:=}{\left({\mathrm{sin}}{}\left({x}{+}{y}\right){+}{\mathrm{sin}}{}\left({x}{-}{y}\right)\right)}^{{2}}$ (4)
 > $\mathrm{expand}\left(b\right)$
 ${4}{}{{\mathrm{sin}}{}\left({x}\right)}^{{2}}{}{{\mathrm{cos}}{}\left({y}\right)}^{{2}}$ (5)
 > $\mathrm{frontend}\left(\mathrm{expand},\left[b\right]\right)$
 ${{\mathrm{sin}}{}\left({x}{+}{y}\right)}^{{2}}{+}{2}{}{\mathrm{sin}}{}\left({x}{+}{y}\right){}{\mathrm{sin}}{}\left({x}{-}{y}\right){+}{{\mathrm{sin}}{}\left({x}{-}{y}\right)}^{{2}}$ (6)
 > $c≔\sqrt{x}+\mathrm{sin}\left(y\right)+\mathrm{cos}\left(1\right)$
 ${c}{:=}\sqrt{{x}}{+}{\mathrm{sin}}{}\left({y}\right){+}{\mathrm{cos}}{}\left({1}\right)$ (7)
 > $\mathrm{indets}\left(c\right)$
 $\left\{{x}{,}{y}{,}\sqrt{{x}}{,}{\mathrm{sin}}{}\left({y}\right)\right\}$ (8)
 > $\mathrm{frontend}\left(\mathrm{indets},\left[c\right]\right)$
 $\left\{\sqrt{{x}}{,}{\mathrm{cos}}{}\left({1}\right){,}{\mathrm{sin}}{}\left({y}\right)\right\}$ (9)
 > $\mathrm{frontend}\left(\mathrm{indets},\left[c\right],\left[\left\{\mathrm{+},\mathrm{*},\mathrm{radical}\right\}\right]\right)$
 $\left\{{x}{,}\sqrt{{x}}{,}{\mathrm{cos}}{}\left({1}\right){,}{\mathrm{sin}}{}\left({y}\right)\right\}$ (10)
 > $\mathrm{frontend}\left(\mathrm{indets},\left[c\right],\left[\left\{\mathrm{+},\mathrm{*}\right\},\left\{\mathrm{cos}\left(1\right)\right\}\right]\right)$
 $\left\{\sqrt{{x}}{,}{\mathrm{sin}}{}\left({y}\right)\right\}$ (11)