size - Maple Help

simplify/size

simplify the size of mathematical expressions by appropriately collecting subexpressions

 Calling Sequence simplify(expr, size, evaluate_known_functions = eval_boolean) simplify(expr, size = false) simplify(expr, size = false, ...)

Parameters

 expr - expression size - literal name; size evaluate_known_functions = eval_boolean - (optional) equation; left-hand side is the literal evaluate_known_functions and the right-hand side eval_boolean is true or false. This equation controls whether functions are re-evaluated after simplification ... - arguments for any other calling sequence for simplify

Description

 • The simplify(expr, size) calling sequence is used to attempt simplifying the expression size, performing only collections and simple decomposition of fractional powers in the coefficients - sometimes taking advantage of linear factors when they exist. No other mathematical simplifications of the expression or its subexpressions is performed. These operations, while simple and with low computational cost, may remarkably structure the expression and reduce its size.
 • The concept of size used by these routines is close to the concept of length, but function calls and radicals are considered of bigger size than mathematically simpler objects of the same length. In this framework size partly includes the idea of mathematical complexity (for advanced users, see the routines simplify/size/size and simplify/size/size/object).
 • The approach used consists of collecting subexpressions using an ordering based on size, then searching for possible fractional decompositions or linear factors that lead to coefficients of smaller size. Functions are handled by first simplifying in size their arguments, followed by re-evaluating the function when the simplification leads to simpler arguments. To avoid re-evaluating the functions, use the optional argument evaluate_known_functions=false.
 • Expressions given as a ratio between two subexpressions have the numerator and denominator simplified in size separately, and the returned result constructed by dividing the expressions obtained (whenever this result is simpler than the given expression).
 • The simplification of the expression size is performed automatically by the simplify command, as part of its default operation, for all calling sequences. To perform only simplification of the expression size, and no other simplifications, invoke the routines by calling simplify with the extra argument size. Alternatively, the simplification of size is an option in the context menu (Simplify > Size).
 • To disable simplification of the expression size, you can pass the option size = false to the simplify command. The option size = false can be included with any simplify calling sequence. Other simplifications cannot be turned off in the same way: this feature is exclusive to simplification with respect to size.

Examples

 > $\mathrm{e1}≔\frac{1}{4}\mathrm{exp}\left(-\frac{1}{4}{x}^{2}\right){2}^{\frac{1}{4}}{x}^{\frac{3}{2}}+\frac{1}{8}\mathrm{exp}\left(\frac{1}{4}{x}^{2}\right){2}^{\frac{3}{4}}\mathrm{sqrt}\left(x\right)\mathrm{sqrt}\left(\mathrm{\pi }\right)\mathrm{erf}\left(\frac{1}{2}\mathrm{sqrt}\left(2\right)x\right)+\frac{1}{8}\mathrm{exp}\left(\frac{1}{4}{x}^{2}\right){2}^{\frac{3}{4}}{x}^{\frac{5}{2}}\mathrm{sqrt}\left(\mathrm{\pi }\right)\mathrm{erf}\left(\frac{1}{2}\mathrm{sqrt}\left(2\right)x\right):$

A call to simplify simplifies the expression considerably.

 > $\mathrm{simplify}\left(\mathrm{e1}\right)$
 $\frac{\sqrt{{x}}{}{{2}}^{{1}}{{4}}}{}\left(\sqrt{{2}}{}\sqrt{{\mathrm{\pi }}}{}{\mathrm{erf}}{}\left(\frac{\sqrt{{2}}{}{x}}{{2}}\right){}\left({{x}}^{{2}}{+}{1}\right){}{{ⅇ}}^{\frac{{{x}}^{{2}}}{{4}}}{+}{2}{}{x}{}{{ⅇ}}^{{-}\frac{{{x}}^{{2}}}{{4}}}\right)}{{8}}$ (1)

This simplification comes entirely from the manipulations by the simplify/size routines.

 > $\mathrm{simplify}\left(\mathrm{e1},\mathrm{size}\right)$
 $\frac{\sqrt{{x}}{}{{2}}^{{1}}{{4}}}{}\left(\sqrt{{2}}{}\sqrt{{\mathrm{\pi }}}{}{\mathrm{erf}}{}\left(\frac{\sqrt{{2}}{}{x}}{{2}}\right){}\left({{x}}^{{2}}{+}{1}\right){}{{ⅇ}}^{\frac{{{x}}^{{2}}}{{4}}}{+}{2}{}{x}{}{{ⅇ}}^{{-}\frac{{{x}}^{{2}}}{{4}}}\right)}{{8}}$ (2)

In the following example, the full set of applicable simplifications (including simplifying with respect to size) leads to the same result as just simplification with respect to size.

 > $\mathrm{e2}≔-3{\mathrm{sin}\left(x\right)}^{\frac{1}{2}}{\mathrm{cos}\left(x\right)}^{2}{\mathrm{sin}\left(x\right)}^{m}+3{\mathrm{sin}\left(x\right)}^{\frac{1}{2}}{\mathrm{cos}\left(x\right)}^{2}{\mathrm{cos}\left(x\right)}^{n}+4{\mathrm{sin}\left(x\right)}^{\frac{1}{2}}{\mathrm{cos}\left(x\right)}^{4}{\mathrm{sin}\left(x\right)}^{m}-4{\mathrm{sin}\left(x\right)}^{\frac{1}{2}}{\mathrm{cos}\left(x\right)}^{4}{\mathrm{cos}\left(x\right)}^{n}$
 ${\mathrm{e2}}{≔}{-}{3}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{}{{\mathrm{sin}}{}\left({x}\right)}^{{m}}{+}{3}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{}{{\mathrm{cos}}{}\left({x}\right)}^{{n}}{+}{4}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}{{\mathrm{cos}}{}\left({x}\right)}^{{4}}{}{{\mathrm{sin}}{}\left({x}\right)}^{{m}}{-}{4}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}{{\mathrm{cos}}{}\left({x}\right)}^{{4}}{}{{\mathrm{cos}}{}\left({x}\right)}^{{n}}$ (3)
 > $\mathrm{simplify}\left(\mathrm{e2}\right)$
 ${-}{4}{}\left({-}{{\mathrm{sin}}{}\left({x}\right)}^{{m}}{+}{{\mathrm{cos}}{}\left({x}\right)}^{{n}}\right){}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}\left({{\mathrm{cos}}{}\left({x}\right)}^{{2}}{-}\frac{{3}}{{4}}\right)$ (4)
 > $\mathrm{simplify}\left(\mathrm{e2},\mathrm{size}\right)$
 ${-}{4}{}\left({-}{{\mathrm{sin}}{}\left({x}\right)}^{{m}}{+}{{\mathrm{cos}}{}\left({x}\right)}^{{n}}\right){}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{}\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}\left({{\mathrm{cos}}{}\left({x}\right)}^{{2}}{-}\frac{{3}}{{4}}\right)$ (5)

Disabling the simplification with respect to size leads to a slightly different result.

 > $\mathrm{simplify}\left(\mathrm{e2},\mathrm{size}=\mathrm{false}\right)$
 $\sqrt{{\mathrm{sin}}{}\left({x}\right)}{}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{}\left({4}{}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}{-}{3}\right){}\left({{\mathrm{sin}}{}\left({x}\right)}^{{m}}{-}{{\mathrm{cos}}{}\left({x}\right)}^{{n}}\right)$ (6)

Exclusively performing simplification with respect to size will miss some types of simplification that would be found otherwise.

 > $\mathrm{e3}≔{\mathrm{sin}\left(x\right)}^{2}+{\mathrm{cos}\left(x\right)}^{2}$
 ${\mathrm{e3}}{≔}{{\mathrm{sin}}{}\left({x}\right)}^{{2}}{+}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}$ (7)
 > $\mathrm{simplify}\left(\mathrm{e3}\right)$
 ${1}$ (8)
 > $\mathrm{simplify}\left(\mathrm{e3},\mathrm{size}\right)$
 ${{\mathrm{sin}}{}\left({x}\right)}^{{2}}{+}{{\mathrm{cos}}{}\left({x}\right)}^{{2}}$ (9)

In this case, we could skip simplifying with respect to size. For large expressions, this may be a bit more efficient.

 > $\mathrm{simplify}\left(\mathrm{e3},\mathrm{size}=\mathrm{false}\right)$
 ${1}$ (10)

An example using the optional argument evaluate_known_functions.

 > $\mathrm{one}≔\mathrm{exp}\left(xa-a-\left(x-1\right)a\right)$
 ${\mathrm{one}}{≔}{{ⅇ}}^{{x}{}{a}{-}{a}{-}\left({x}{-}{1}\right){}{a}}$ (11)
 > $\mathrm{one}=\mathrm{simplify}\left(\mathrm{one},\mathrm{size}\right)$
 ${{ⅇ}}^{{x}{}{a}{-}{a}{-}\left({x}{-}{1}\right){}{a}}{=}{1}$ (12)
 > $\mathrm{one}=\mathrm{simplify}\left(\mathrm{one},\mathrm{size},\mathrm{evaluate_known_functions}=\mathrm{false}\right)$
 ${{ⅇ}}^{{x}{}{a}{-}{a}{-}\left({x}{-}{1}\right){}{a}}{=}{{ⅇ}}^{{0}}$ (13)
 > 
 ${{ⅇ}}^{{x}{}{a}{-}{a}{-}\left({x}{-}{1}\right){}{a}}{=}{1}$ (14)