assumingAlso, _assumingAlso

Add temporary assumption

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


calculation assumingAlso condition
calculation assumingAlso (expr, set)
_assumingAlso(calculation, condition)
_assumingAlso(calculation, (expr, set))


calculation assumingAlso condition evaluates calculation under all existing assumptions along with the new assumption that condition is true for that calculation.

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

calculation assumingAlso condition is equivalent to _assumingAlso(calculation, condition).

calculation assumingAlso (expr, set) is equivalent to _assumingAlso(calculation, (expr, set)).

assumingAlso sets temporary assumptions in addition to existing permanent assumptions. Here, condition holds true only while the argument calculation is evaluated. After this evaluation, condition is removed. Therefore, it does not affect further computations. condition is also removed if the evaluation stops with an error.

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

If expr is a list, vector, or matrix, use the syntaxes calculation assumingAlso(expr, set) and _assumingAlso(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 assumingAlso (expr in set) (or its equivalent _assumingAlso(calculation, expr in set)) and calculation assumingAlso condition (or its equivalent _assumingAlso(calculation, condition)) for nonscalar expr.


Example 1

Solve this equation without any assumptions on the variable x:

solve(x^5 - x, x)

Suppose your computations deal with real numbers only. In this case, use the assume function to set the permanent assumption that x is real:

assume(x in R_)

If you solve the same equation now, you will get three real solutions:

solve(x^5 - x, x)

To get only nonzero solutions for this particular equation, use assumingAlso to temporarily add the corresponding assumption:

solve(x^5 - x, x) assumingAlso x <> 0

After solving this equation, MuPAD® discards the temporary assumption, but keeps the permanent one:


Example 2

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 3

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

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

assume and assumeAlso do not solve equations:

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



Any MuPAD command or expression that you want to evaluate under the temporary assumption.


Equality, inequality, element of relation, or Boolean combination (with the operators and or or).


Identifier, mathematical expression, list, vector, or matrix containing identifiers.

If expr is a list, vector, or matrix, then only the syntaxes calculation assumingAlso(expr, set) and _assumingAlso(calculation, (expr, set)) are valid.


Property representing a set of numbers or a set returned by solve. 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

assumingAlso returns the result of evaluating calculation.