When to Use Assumptions

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.

By default, MuPAD® assumes that all symbolic parameters and variables represent complex numbers. If you perform computations that involve unknowns with natural restrictions, you can set assumptions on these unknowns. For example, when solving an equation where one of the parameters represents real numbers, request the solver to consider this parameter as a real number. Use assumptions to limit the number of solutions to those necessary and to improve code performance.

When solving an equation, inequality, or a system, you can use assumptions on parameters of the equation and assumptions on the variables you solve for. Setting assumptions on parameters and variables affects performance of the solver in different ways:

  • Assumptions on parameters tend to narrow the area in which the solver tries to find the solutions, thereby improving performance of the solver. If you can identify mathematical properties of the parameters in your equation, inequality, or system, use these properties to set as many assumptions on parameters as possible.

  • Assumptions on variables can narrow the returned results. MuPAD applies assumptions on variables after the solver finds the solutions. The solver verifies the results against the assumptions and returns only those solutions that agree with the assumptions. Adding this extra task can slow down the solver. Use assumptions on variables sparsely.

Alternatively, you can simplify already returned complicated results by using assumptions. See Using Assumptions.

There are two types of assumptions you can set:

  • Permanent assumptions hold true for all calculations MuPAD performs after you set the assumptions. If you want MuPAD to stop using a permanent assumption, you must explicitly delete the assumption. Permanent assumptions serve best when you know that an object holds its property throughout the solution process. For more information see Using Permanent Assumptions.

  • Temporary assumptions hold true only for the particular evaluation where you set them. For example, if you use a temporary assumption while solving a single equation, the solver applies this assumption only to solve this particular equation. Using temporary assumptions to solve problems works best when an object holds its property only during particular calculations. Temporary assumptions also help you to keep the object name free and reuse it during the solution process. For more information see Using Temporary Assumptions.