Enable or disable warnings

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.




intlib::printWarnings lets you enable or disable warnings.

By default, MuPAD® does not display warnings during integration. To enable warnings, use the intlib::printWarnings(TRUE) function call. If later you want to disable warnings, use the intlib::printWarnings(FALSE) function call. See Example 1.

The intlib::printWarnings() function call shows whether warnings are enabled or disabled. See Example 1.

The output of intlib::printWarnings displays the previous setting. You can save this previous setting and switch to a new setting in a single function call. See Example 2.


Example 1

Enable the warnings by setting the value of intlib::printWarnings to TRUE:


Compute the integral of |x| under the assumption that x is an integer. MuPAD cannot integrate the expression over a discrete subset of the real numbers. The system issues a warning and integrates over the set of real numbers:

int(abs(x), x) assuming x in Z_
Warning: Unable to integrate when 'x' has property 'Z_'. Using assumption 'x' has property 'R_' for integration. [intlib::int]

If you evaluate the same integral again, MuPAD does not recalculate the integral. The system remembers the previous result and returns it, skipping the warning:

int(abs(x), x) assuming x in Z_

To check whether the warnings are enabled or disabled, use the intlib::printWarnings() function call:


Disable the warnings for further computations:


Example 2

Enable the warnings and save the previous setting in a single function call:

old := intlib::printWarnings(TRUE):

Assume that x is positive. Then, integrate x over the interval [- 2, 1]. In this case, the system issues a warning, temporarily disregards the assumption x > 0, and integrates over the interval [- 2, 1]:

assume(x > 0):
int(x, x = -2..1)
Warning: Using assumption 'x' has property 'Dom::Interval([-2], [1])' for integration instead of the given property 'Dom::Interval(0, infinity)'. [int]

Restore the setting of intlib::printWarnings:


The warnings are disabled now:


For further computations, clear the assumption on the variable x:


Return Values

Previously set value TRUE or FALSE

See Also

MuPAD Functions