Solving Inequalities with Matlab

152 visualizaciones (últimos 30 días)
Dimitrios Anagnostou
Dimitrios Anagnostou el 27 de Mzo. de 2023
Comentada: Walter Roberson el 27 de Mzo. de 2023
I guess this is a frequent question here but the answers I have seen did not help me.
I want to solve the following inequality: |x-2| > 2|x+1|.
Manually, we get
In Mathematica there is the built-in function Reduce.
In[58]:= Reduce[Abs[x - 2] > 2 Abs[x + 1], x, Reals]
Out[58]= -4 < x < 0
With Matlab I get
>> version
ans =
'9.13.0.2105380 (R2022b) Update 2'
>> syms x real
>> solve(abs(x-2) > 2*abs(x+1), x)
ans =
-2
There is this answer here that uses Mupad's Solve function but apparently it does not work anymore.
Is there a way to use a Matlab function, not necessarily solve to get the correct domain? Thank you very much.

Respuesta aceptada

Dyuman Joshi
Dyuman Joshi el 27 de Mzo. de 2023
You need to use 'ReturnConditions' as true to obtain the conditions on the solution
syms x real
sol=solve(abs(x-2) > 2*abs(x+1), x,'ReturnConditions',true)
sol = struct with fields:
x: x parameters: x conditions: x < 0 & -4 < x
  4 comentarios
Steven Lord
Steven Lord el 27 de Mzo. de 2023
Yes, on the documentation page for the solve function. This documentation page also includes an example, "Solve Inequalities", that shows its use.

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by