assumeAlso
Add permanent 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.
assumeAlso(condition
) assumeAlso(expr
,set
)
assumeAlso(condition)
adds the assumption
that condition
is true for all further calculations.
It does not remove previous assumptions containing identifiers used
in condition
.
assumeAlso(expr, set)
attaches the property set
to
the identifier or expression x
. It does not remove
previous assumptions containing identifiers used in expr
.
Assumptions are mathematical conditions that are assumed to
hold true for all calculations. By default, all MuPAD^{®} identifiers
are independent of each other and can take any value in the complex
plane. For example, sign(1 + x^2)
cannot be simplified
any more because x
MuPAD assumes that x
is
a complex number. If you set an assumption that x
is
a real number, then MuPAD can simplify sign(1 + x^2)
to 1
.
For this reason, many MuPAD functions return very general
or piecewisedefined results depending on further conditions. For
example, solve
or int
can return piecewise
results.
Many mathematical theorems hold only under certain conditions.
For example, x^b*y^b=(x*y)^b
holds if b
is
an integer. But this equation is not true for all combinations of x
, y
,
and b
. For example, it is not true if x
= y = 1, b = 1/2
. In such cases, you can use assumptions
to get more specific results.
If you use assumeAlso
inside a function or
procedure, MuPAD uses that assumption only inside the function
or procedure. After the function or procedure call, MuPAD removes
that assumption and only keeps the assumptions that were set before
the function or procedure call.
If condition
is a relation (for example, x
< y
), then MuPAD implicitly assumes that both sides
of the relation are real. See Example 4.
To delete assumptions previously set on x
,
use unassume(x)
or delete x
.
When assigning a value to an identifier with assumptions, the assigned value can be inconsistent with existing assumptions. Assignments overwrite all assumptions previously set on an identifier. See Example 5.
assumeAlso
accepts any condition
and
Boolean combinations of condition
s. See Example 7.
If expr
is a list, vector, or matrix, use
the syntax assumeAlso(expr, set)
. Here, set
must
be 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 assumeAlso(expr in set)
and assumeAlso(condition)
for
nonscalar expr
.
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)
If you also want to get only nonzero solutions, use assumeAlso
to
add the corresponding assumption:
assumeAlso(x <> 0); solve(x^5  x, x)
MuPAD keeps both assumptions for further computations:
getprop(x)
For further computations, delete the identifier x
:
delete x
When you use assumeAlso
, MuPAD does
not remove existing assumptions. Instead, it combines them with new
assumptions. For example, assume that n
is an integer:
assume(n, Type::Integer): getprop(n);
Add the assumption that n
is positive:
assumeAlso(n, Type::Positive): getprop(n);
For further computations, delete the identifier n
:
delete n
Alternatively, set multiple assumptions in one function call
using the Boolean operator and
:
assume(n, Type::Integer and Type::Positive): getprop(n);
For further computations, delete the identifier n
:
delete n
You can set separate assumptions on the real and imaginary parts of an identifier:
assume(Re(z) > 0); assumeAlso(Im(z) < 0):
abs(Re(z)); sign(Im(z))
For further computations, delete the identifier z
:
delete z
Using assume
,
set the assumption x > y
. Assumptions set as
relations affect the properties of both identifiers.
assume(x > y)
To see the assumptions set on identifiers, use getprop
:
getprop(x); getprop(y);
To keep an existing assumption on y
and add
a new one, use assumeAlso
. For example, add the
new assumption that y
is greater than 0
while keeping the assumption that y
is less than x
:
assumeAlso(y > 0)
is(x^2 >= y^2)
Relations, such as x > y
, imply that the
involved identifiers are real:
is(x, Type::Real), is(y, Type::Real)
delete x, y:
You also can add a relational assumption where one side is not an identifier, but an expression:
assumeAlso(x > 1/y)
getprop(x); getprop(y)
For further computations, delete the identifiers x
and y
:
delete x, y
_assign
and :=
do
not check if an identifier has any assumptions. The assignment operation
overwrites all assumptions:
assume(a > 0): a := 2: a, getprop(a)
For further computations, delete the identifier a
:
delete a
Use assume
to
set the assumption that the identifier a
is positive:
assume(a > 0)
Now, add two new assumptions using one call to assumeAlso
.
To combine the assumptions, use the Boolean operator and
:
assumeAlso(a in Z_ and a < 5): is(a = 0); is(a = 1/2); is(a = 2); is(a = 6);

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

Property representing a set of numbers or a set returned by 

Equality, inequality, element of relation, or Boolean combination
(with the operators 
Void object null()
of type DOM_NULL
.
assume
 assuming
 assumingAlso
 getprop
 is
 property::hasprop
 property::showprops
 unassume