Maximize answer of second order Polynomial inequality
5 次查看(过去 30 天)
显示 更早的评论
Dear matlab user,
I would like to solve a second order polynomial inequality as follows:
Where I would like to maximize the value of x when a>0 ofcourse. I use the following example
syms x
ineq = 0.99*x^2-99<0;
x_num = solve(ineq, x);
The value it returns gives: x_num = 0. Which satisfies the constraint ofcourse. However I would like to find the maximum value for x (which would be 10-eps). How do I specify the maximization criteria with the solve command.
0 个评论
采纳的回答
David Goodmanson
2021-12-3
编辑:David Goodmanson
2021-12-13
Hi Luuk
It makes more sense to find the boundaries of the inequality:
syms x
eqn1 = 0.99*x^2-99==0;
x_num = solve(eqn1, x)
if isreal(x_num) % if the roots are complex there is no solution
a = max(x_num) % upper bound
end
a = 10
Since the values that satisfy the inequality form an open set, the set has a supremum x = 10 that is not a member of the set. So there is no 'largest number' that satisfies the inequality. As a demo you can subrtact off eps or anything that seems small enough, for example
a - 1e-20
ans = 999999999999999999999/100000000000000000000
and if that answer seems clumsy there is
vpa(a - 1e-20,25)
ans = 9.99999999999999999999
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!