Maximize answer of second order Polynomial inequality
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Luuk Spin
le 2 Déc 2021
Modifié(e) : David Goodmanson
le 13 Déc 2021
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 commentaires
Réponse acceptée
David Goodmanson
le 3 Déc 2021
Modifié(e) : David Goodmanson
le 13 Déc 2021
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear Algebra dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!