HOW TO MAKE THAT AN INEQUALITY BECOME AN ASSUMPTION?

5 visualizaciones (últimos 30 días)
idriskameni
idriskameni el 5 de Mzo. de 2019
Comentada: Walter Roberson el 5 de Mzo. de 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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Mzo. de 2019
Editada: Walter Roberson el 5 de Mzo. de 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 comentarios
idriskameni
idriskameni el 5 de Mzo. de 2019
Thank you very much. What do you mean by not robust enough?
And how isAlways() could help me improving it?
Walter Roberson
Walter Roberson el 5 de Mzo. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by