How do I create a symbolic integer in the Symbolic Math Toolbox?

I would like to know how to create a symbolic variable in the Symbolic Toolbox such that it is assumed to take only integer values.

 Accepted Answer

If you are using the MuPad symbolic engine from Symbolic Toolbox (R2008b) or higher, you can use the ASSUME function from MuPad as follows:
syms x
evalin(symengine,'assume(x,Type::Integer)')
To remove assumptions from the variable x, you can use the following command:
syms x clear
If you are using Symbolic Toolbox (R2008a) or before, you will also need the Extended Symbolic Toolbox to do this. The Maple function ASSUME allows you to add assumptions to a symbolic variable. The following example demostrates the creation of a symbolic integer variable:
syms x
maple('assume(x,integer)');

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!