Maximize answer of second order Polynomial inequality

4 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

David Goodmanson
David Goodmanson el 3 de Dic. de 2021
Editada: David Goodmanson el 13 de Dic. de 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

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by