Maximize answer of second order Polynomial inequality

조회 수: 6 (최근 30일)
Luuk Spin
Luuk Spin 2021년 12월 2일
편집: David Goodmanson 2021년 12월 13일
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.

채택된 답변

David Goodmanson
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개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by