Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# assuming, _assuming

Set temporary assumption

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

calculation assuming condition
calculation assuming (expr, set)
_assuming(calculation, condition)
_assuming(calculation, (expr, set))

## Description

calculation assuming condition evaluates calculation under the assumption that condition is true for that calculation.

calculation assuming(expr, set) temporarily attaches the property set to the identifier or expression expr and evaluates calculation. This call ignores all previous assumptions containing identifiers used in expr.

calculation assuming condition is equivalent to _assuming(calculation, condition).

calculation assuming (expr, set) is equivalent to _assuming(calculation, (expr, set)).

assuming sets temporary assumptions. Temporary assumptions hold true only while the argument calculation is evaluated. After this evaluation, MuPAD® removes these assumptions. Therefore, they do not affect further computations. MuPAD also removes temporary assumptions if the evaluation stops with an error.

assuming temporarily overwrites existing assumptions. If you have permanent assumptions, MuPAD ignores them while evaluating calculation. Instead, it uses temporary assumptions set by assumimg.

If assumptions contain linear equations with one variable, assuming solves these equations. Then the command inserts the solutions into calculation and evaluates the result. See Example 6.

If expr is a list, vector, or matrix, use the syntaxes calculation assuming(expr, set) and _assuming(calculation, (expr, set)). Here, set is specified as one of C_, R_, Q_, Z_, N_, or an expression constructed with the set operations, such as union, intersect, or minus. set also can be a function of the Type library, for example, Type::Real, Type::Integer, Type::PosInt, and so on.

Do not use the syntaxes calculation assuming (expr in set) (or its equivalent _assuming(calculation, expr in set)) and calculation assuming condition (or its equivalent _assuming(calculation, condition)) for nonscalar expr.

## Examples

### Example 1

Find the sign of the expression x^2 + 1 assuming that the identifier x represents a real number:

sign(x^2+1) assuming (x, Type::Real)

### Example 2

Simplify this sine function assuming that n is an integer:

simplify(sin(n*PI)) assuming n in Z_

### Example 3

Additional assumptions let you simplify some expressions. For example, compute the right limit of xp:

limit(x^p, x = 0, Right)

Compute the right limit of the same expression for negative, positive, and zero values of p:

limit(x^p, x = 0, Right) assuming p < 0

limit(x^p, x = 0, Right) assuming p > 0

limit(x^p, x = 0, Right) assuming p = 0

### Example 4

Assumptions set by assuming are temporary. They do not affect any previous or future computations:

getprop(a);
getprop(a) assuming a > 0;
getprop(a)

### Example 5

If you already use a permanent assumption and want to add a temporary assumption on the same object, do not use assuming. It temporarily overwrites the permanent assumption:

assume(x in Z_):
solve(x^3 - (44*x^2)/3 + (148*x)/3 - 80/3 = 0, x) assuming x < 5

Instead, use assumingAlso:

solve(x^3 - (44*x^2)/3 + (148*x)/3 - 80/3 = 0, x) assumingAlso x < 5

### Example 6

If assumptions contain linear equations with one variable, assuming solves the equations, inserts the solutions into the expression, and then evaluates the expression:

a^2 + 1 assuming a - 2 = 1;

assume and assumeAlso do not solve equations:

assume(a - 2 = 1) ;
a^2 + 1

## Parameters

 calculation Any MuPAD command or expression that you want to evaluate under the temporary assumption. condition Equality, inequality, element of relation, or Boolean combination (with the operators and or or). expr Identifier, mathematical expression, list, vector, or matrix containing identifiers. If expr is a list, vector, or matrix, then only the syntaxes calculation assuming(expr, set) and _assuming(calculation, (expr, set)) are valid. set Property representing a set of numbers or a set returned by solve. For example, this set can be an element of Dom::Interval, Dom::ImageSet, piecewise, or one of C_, R_, Q_, Z_, N_. It also can be an expression constructed with the set operations, such as union, intersect or minus. For more examples, see Properties.

## Return Values

assuming returns the result of evaluating calculation.

## Related Examples

Was this topic helpful?