Can I check if an inequality is true, and if not, get the conditions where the inequality could be true?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am pretty new to Matlab. I have to check if an expression is positive, given some conditions. This is my code right now:
%general conditions
assume(0<beta & beta<alpha & alpha<1)
assumeAlso(b > 0 & p > 0 & c > 0 & f1 > 0 & f2 > 0 & f3 > 0 & f4 > 0)
%additional conditions
assumeAlso(f1 > f3)
assumeAlso(f1 > f3)
assumeAlso(alpha > 1/2)
assumeAlso(beta*f2 < f3)
assumeAlso(f4 < beta*(f1-f3))
isAlways((alpha*b*f3 + 2*b*beta*f1 - 2*b*beta*f3 - alpha*b*beta*f1 + alpha*b*beta*f3)/(alpha*f3 + beta*f1 - beta*f3) - (((b - 2*alpha*b)/alpha - alpha*(b/alpha + (f3 - beta*f2)/(alpha*beta)))/(alpha*f3 + beta*f1 - beta*f3) + (f4 - beta*f1 + beta*f3)/(alpha*f3 + beta*f1 - beta*f3))*(alpha*f3 + beta*f1 - beta*f3) > 0)
This is giving me a warning:
Warning: Unable to prove '0 < (alpha*b*f3 + 2*b*beta*f1 - 2*b*beta*f3 - alpha*b*beta*f1 +
alpha*b*beta*f3)/(alpha*f3 + beta*f1 - beta*f3) - (((b - 2*alpha*b)/alpha - alpha*(b/alpha + (f3 -
beta*f2)/(alpha*beta)))/(alpha*f3 + beta*f1 - beta*f3) + (f4 - beta*f1 + beta*f3)/(alpha*f3 + beta*f1 -
beta*f3))*(alpha*f3 + beta*f1 - beta*f3)'
Which I understand because there might be additional conditions which are needed for my expression to be positive.
Is there another method I can use instead of isAlways that can return me the conditions where this statement is true?
0 个评论
回答(1 个)
Vidhathri LNU
2020-6-30
You can use the 'solve' function by setting the parameter 'ReurnConditions' to 'true' to get the conditions on the solution.
Please refer to the Solve inequalities section of the documentation for further understanding.
Hope this answers your query.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!