MATLAB: Symbolic expression bounds

formal verificationsymbolicSymbolic Math Toolboxuser input

I have a symbolic expression (the real expression can be anything the Symbolic Toolbox supports) but for example we can use the following:
expr = sym('a + b')
Also, I know that a and b are integers and that their "legal" values go from 1 to 7.
I would like to figure out what are the bounds of expr. In this case, the min value would be 2 and the max value would be 14.
Is there any way to do this type of analysis?
Thanks Joan

Best Answer

Unfortunately there is no theoretical way to do that for arbitrary expressions.
For the special case of linear operations, you can use the linear minimizer or maximizer: see http://www.mathworks.com/help/toolbox/mupad/linopt/index.html
More generally for expressions in one variable, you would differentiate the expression, find the zeros of that, differentiate the expression again, evaluate at the zeros to determine whether you are looking at a min, max, or saddle point. Solving for the zeros might be difficult or impossible though...
For expressions in multiple variables, the question of the range becomes equivalent to the question of finding the global extrema. It is known that there is no general algorithm for that, but there are some classes of expressions that it can be solved for.