Search code examples
matlabsolversymbolic-mathsymbolic-computation

Unexpected result on solving some inequality in Matlab symbolic computation


Please consider this example. I would like to solve x^3 - 2x > 0. I try the following commands:

syms x;
f = @(x) x^3-2*x;
solve(f(x)>0,x)

and Matlab returns this

ans = solve([0.0 < x^3 - 2.0*x], [x])

which is not what I expect. Therefore I use

solve(f(x)+x>x,x)

which returns

ans = Dom::Interval(2^(1/2), Inf) Dom::Interval(-2^(1/2), 0)

Can someone explain that why solve works successfully only in the second case?


Solution

  • Try adding the Real option to solve:

    solve(f(x)>0,x,'Real',1)
    
    ans =
    
     Dom::Interval(2^(1/2), Inf)
     Dom::Interval(-2^(1/2), 0)