mathwolfram-mathematicaabsoluteequationmathematica-8

How to Solve absolute value in Mathematica without Wolfram Alpha?


I have this equation that I can't insert in Mathematica Abs[x-1]+Abs[x+2]=3. I tried solve [Abs[x-1]+Abs[x+2]==3] but it gives no answer.

I tried NSolve and DSolve and Evaluate but nothing worked. I can get the answer by hand -2 <= x <= 1 but I need to solve in Mathematica without Wolfram Alpha.


Solution

  • Reduce[Abs[x - 1] + Abs[x + 2] == 3, x, Reals]
    

    -2 <= x <= 1