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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by