Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Evaluating an inequality symbolically

I am trying to verify an inequality using the symbolic solver in Matlab. Matlab is able to tell me that the first inequality below is true, however, the second one fails. Am I doing something wrong here, or is the second expression to complex for Matlab?

syms mu sigma rho lambdaP

assume(mu>0)
assume(sigma>0)
assume(rho>0)
assume(lambdaP>0)
assume(rho>mu)

b=(mu-0.5*sigma^2);
isAlways(sqrt(b^2+2*sigma^2)>=0)
isAlways(sqrt(b^2+2*sigma^2*(rho+lambdaP))>=0)
like image 431
larsinho Avatar asked Feb 18 '26 01:02

larsinho


1 Answers

For the second assumption on the variables rho and mu, you should use assumeAlso instead of assume. Calling assume again on a symbolic variable removes the first assumption. You can also remove all the separate assume lines, by adding the assumption to the declaration of the symbolic variables

syms mu sigma rho lambdaP positive

assumeAlso(rho>mu)

b=(mu-0.5*sigma^2);
isAlways(sqrt(b^2+2*sigma^2)>=0)
isAlways(sqrt(b^2+2*sigma^2*(rho+lambdaP))>=0)

This will return true for both expressions.

You can check the assumptions per variable by typing e.g. assumptions(rho). If you do not use assumeAlso, you will see that the > 0 assumption is gone.

like image 170
rinkert Avatar answered Feb 19 '26 15:02

rinkert