assuming - Maple Programming Help

Home : Support : Online Help : Mathematics : Evaluation : assume : assuming : assuming

assuming

compute the value of an expression under assumptions, or represent that computation using the inert form '%assuming'

 Calling Sequence expression assuming property expression %assuming property

Parameters

 expression - expression or input to be evaluated property - name; property

Description

 • The expression assuming property calling sequence evaluates the expression under the assumption property on all names in expression.
 • The expression %assuming property is the inert form of assuming and returns unevaluated, with the expression and the related assumptions encapsulated within the %assuming structure. This permits, for instance, to compute with different conditions on the same variable or expression, all appearing within the same worksheet, each of them represented by %assuming structures with different conditions. All of is, coulditbe, simplify, diff and int commands know about these %assuming structures, that can be activated when desired using the value command.
 • The property parameter can be a type, inequation, or other property to be assumed on a name or expression involving names.
 Note: Computations performed using assuming do not affect computations performed before or after calling assuming.
 An assuming clause can be included in the condition of an if, elif, while, or until clause. In the latter case, to avoid a syntactic ambiguity, the entire condition, including the assuming clause, must be enclosed in parentheses.

Examples

Find the square root of ${a}^{2}$ under the assumption that $a$ is a positive, real constant.

 > $\sqrt{{a}^{2}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}0
 ${a}$ (1)
 > $\sqrt{{a}^{2}}$
 $\sqrt{{{a}}^{{2}}}$ (2)

You can determine the value of an expression under the assumption that all its variables are real.

 > $\mathrm{e1}≔\mathrm{ln}\left({ⅇ}^{-{k}_{1}t}\right)$
 ${\mathrm{e1}}{≔}{\mathrm{ln}}{}\left({{ⅇ}}^{{-}{{k}}_{{1}}{}{t}}\right)$ (3)
 > $\mathrm{e1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{real}$
 ${-}{{k}}_{{1}}{}{t}$ (4)

Using the assuming command does not update $\mathrm{e1}$.

 > $\mathrm{e1}$
 ${\mathrm{ln}}{}\left({{ⅇ}}^{{-}{{k}}_{{1}}{}{t}}\right)$ (5)

The assumptions are valid only during the computation of one input statement, and no assumptions are placed on the variables.

 > $\mathrm{e2}≔\mathrm{ln}\left(\frac{y}{x}\right)-\mathrm{ln}\left(y\right)+\mathrm{ln}\left(x\right)$
 ${\mathrm{e2}}{≔}{\mathrm{ln}}{}\left(\frac{{y}}{{x}}\right){-}{\mathrm{ln}}{}\left({y}\right){+}{\mathrm{ln}}{}\left({x}\right)$ (6)
 > $\mathrm{simplify}\left(\mathrm{e2}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}x::\mathrm{positive}$
 ${0}$ (7)
 > $\mathrm{simplify}\left(\mathrm{e2}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}y::\mathrm{positive}$
 ${\mathrm{ln}}{}\left(\frac{{1}}{{x}}\right){+}{\mathrm{ln}}{}\left({x}\right)$ (8)
 > $\mathrm{simplify}\left(\mathrm{subs}\left(x=-x,\mathrm{e2}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}x::\mathrm{posint},y::\mathrm{posint}$
 ${2}{}{I}{}{\mathrm{\pi }}$ (9)
 > $\mathrm{about}\left(x\right):$
 > $\mathrm{about}\left(y\right)$

Using the value command, you can evaluate an inert integral. This evaluation can be performed under assumptions.

 > $\mathrm{e3}≔{{∫}}_{0}^{\mathrm{∞}}{ⅇ}^{-ux}{x}^{\frac{1}{3}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}x$
 ${\mathrm{e3}}{≔}{{\int }}_{{0}}^{{\mathrm{\infty }}}{{ⅇ}}^{{-}{u}{}{x}}{}{{x}}^{{1}}{{3}}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (10)
 > $\mathrm{value}\left(\mathrm{e3}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}0\le u$
 $\frac{{2}{}{\mathrm{\pi }}{}\sqrt{{3}}}{{9}{}{\mathrm{\Gamma }}{}\left(\frac{{2}}{{3}}\right){}{{u}}^{{4}}{{3}}}}$ (11)
 > $\mathrm{value}\left(\mathrm{e3}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}u<0$
 ${\mathrm{\infty }}$ (12)

It is sometimes useful to place an assumption on a variable or expression, encapsulated, independent of the rest of the computations on the worksheet. One example of that is when the value of expressions depend on where are some variables being evaluated. For this purpose you can use the inert form %assuming. For example,

 > $\mathrm{%assuming}\left(\left[\sqrt{{a}^{2}}\right],\left[0
 ${?}$ (13)
 > $\mathrm{value}\left(\right)$
 ${a}$ (14)

When using %assuming attention should be given to the order of precedence of operations: assuming and %assuming have higher precedence than the arithmetic operators.

 > $\mathrm{%assuming}\left(\left[\sqrt{{a}^{2}}\right],\left[0
 $\left({?}\right){+}\left({?}\right)$ (15)
 > $\mathrm{value}\left(\right)$
 ${0}$ (16)

The variable a is inside the body of f; the assumption that a > 0 is not effectively used when computing f(1).

 > $f≔x→\sqrt{{a}^{2}}+x$
 ${f}{≔}{x}{↦}\sqrt{{{a}}^{{2}}}{+}{x}$ (17)
 > $f\left(1\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}0
 $\sqrt{{{a}}^{{2}}}{+}{1}$ (18)

For these purposes, you can use the Physics:-Setup command with its assuminguseseAssume keyword, or use assume itself. For example

 > $\mathrm{Physics}:-\mathrm{Setup}\left(\mathrm{assumingusesAssume}=\mathrm{true}\right)$
 $\left[{\mathrm{assumingusesAssume}}{=}{\mathrm{true}}\right]$ (19)
 > $f\left(1\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}0
 ${a}{+}{1}$ (20)

Alternatively,

 > $\mathrm{Physics}:-\mathrm{Setup}\left(\mathrm{assumingusesAssume}=\mathrm{false}\right)$
 $\left[{\mathrm{assumingusesAssume}}{=}{\mathrm{false}}\right]$ (21)
 > $f\left(1\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}0
 $\sqrt{{{a}}^{{2}}}{+}{1}$ (22)
 > $\mathrm{assume}\left(0
 > $f\left(1\right)$
 ${\mathrm{a~}}{+}{1}$ (23)

Details

 For detailed information including:
 • How to evaluate expressions under assumptions applied to specific variables
 • Detailed information on how the assuming command computes under assumptions
 • How to use the assuming command in conjunction with the assume command
 see the assuming/details help page.

Compatibility

 • The assuming command was updated in Maple 2017.