Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Not well-formed equation" using Mathematica's Solve

First time using stackOverflow. :)

I'm trying to use mathematica to solve some simply polynomial equations (let's say in one variable) with constraints on the variable, e.g |x| < 1.

When I try something like:

Solve[x^2 == 4 && x^2 < 1, x]

I get an error stating that "x > 0 is not a well-formed equation".

The mathematica solve page even suggests this syntax on its second to last example, so I'm quite confused. (If it's relevant, I have version 7.) Any help would be appreciated.

Thanks!

like image 545
Ben Avatar asked Jun 08 '11 16:06

Ben


2 Answers

Solve is not supposed to solve inequalities (M7). You can use Reduce to do that:

In[2]:= Reduce[x^2 == 4 && x^2 < 1, x]

Out[2]= False

Here is an example with Solve:

In[4]:= Solve[x^2 == 4 && x^4 == 16, x]

Out[4]= {{x -> -2}, {x -> 2}}
like image 182
Leonid Shifrin Avatar answered Sep 30 '22 14:09

Leonid Shifrin


In Mma v 8:

{Solve[x^2 == 4 && x^2 < 1, x],
 Solve[x^2 == 4 && (-1 < x < 1), x]} 

(* 
->{{},{}}
*)
like image 24
Dr. belisarius Avatar answered Sep 30 '22 12:09

Dr. belisarius