HOW TO MAKE THAT AN INEQUALITY BECOME AN ASSUMPTION?
8 views (last 30 days)
Show older comments
idriskameni
on 5 Mar 2019
Commented: Walter Roberson
on 5 Mar 2019
Hi,
I am interested in checking if a huge formula is positive or negative.
Let's say, for example, which sign have
for certain values
of
. Hence, I would like to know how I can do assumptions
in the values of the variables.
I know, that I can do things like
assume(x>0)
assume(x,'integer')
But I would like to assume things like
assume(a+b-c>0)
assume(b+2c<0)
assume(a>0)
All of that at the same time. Do you know how can I do something like that?
Thank you very much in advance.
0 Comments
Accepted Answer
Walter Roberson
on 5 Mar 2019
Edited: Walter Roberson
on 5 Mar 2019
Yes. Just be careful because once an assumption exists on a variable, using assume() for the same variable can delete the previous assumption. It is safer to use assumeAlso()
assume(x>0)
assumeAlso(x, 'integer')
assumeAlso(a+b-c>0)
assumeAlso(b+2*c<0)
assumeAlso(a>0)
You can also chain together assumptions in the form of relations:
assume(x, 'integer')
assumeAlso( x>0 & a+b-c<0 & b+2*c<0 & a>0)
However, the assumption system is not necessarily going to be robust enough for your purposes.
isAlways() might help you.
2 Comments
Walter Roberson
on 5 Mar 2019
The symbolic engine sometimes ignores assumptions. And sometimes it just does not work through all the implications of assumptions, so it can miss something that a human can prove.
With regards to isAlways(): you cannot directly test the truth of a symbolic expression. For example if you had the above assumptions then you might expect to be able to ask
if a+b-c>0; disp('yes'); end
since there is an assumption that states that as a truth. However, this will fail with failure to convert sym to logical. You can take sign() of a symbolic expression, sign() will not necessarily resolve all assumptions so you can have trouble if you compare the output of sign() to something -- or you can simply get misleading results. You might need to test isAlways() of the expression, which does return a logical value.
More Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!