Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to solve the following system of equations:

$$\begin{cases} 1+\sqrt{2 x+y+1}=4 (2 x+y)^2+\sqrt{6 x+3 y},\\ (x+1) \sqrt{2 x^2-x+4}+8 x^2+4 x y=4. \end{cases}$$ I tried

Reduce[{    1 + Sqrt[2 x + y + 1] == 4 (2 x + y)^2 + Sqrt[6 x + 3 y],
        (x + 1) Sqrt[2 x^2 - x + 4] + 8 x^2 + 4 x  y == 4 },    
        {x, y}, Reals]

I also tried with Solve and NSolve, but the evaluation exhausted my patience. I know the given system has $\left(\frac{1}{2};-\frac{1}{2}\right)$ as the only real solution. How do I tell Mathematica to get that solution ?

share|improve this question
1  
Did you try it in a new session? I get the result instantly –  rm -rf Mar 16 '13 at 16:07
    
@rm-rf I think the problem is only visible in version < 9. –  Jens Mar 16 '13 at 16:11
    
In earlier versions one can do NSolve[system,vars] and postprocess to remove the complex-valued solutions. –  Daniel Lichtblau Mar 16 '13 at 20:49
add comment

3 Answers

up vote 8 down vote accepted

This is something that differs dramatically between Mathematica version 8 and 9. In 8, it is indeed impossibly slow. In version 9, the result is returned instantly.

If you know there's only one solution you need, then it's often a good idea to not use Reduce because it will try to find all solutions and therefore spend a lot of time looking for a proof that it found them all. Instead, just do this:

FindInstance[{1 + Sqrt[2 x + y + 1] == 
   4 (2 x + y)^2 + Sqrt[6 x + 3 y], (x + 1) Sqrt[2 x^2 - x + 4] + 
    8 x^2 + 4 x y == 4}, {x, y}, Reals]

(* ==> {{x -> 1/2, y -> -(1/2)}} *)

This is usually much faster than Reduce or Solve.

share|improve this answer
add comment

Confirming that Mathematica 9 can easily solve this system unlike ver. 7 & 8 I'm going to suggest how to deal with it in earlier versions.

  1. there are many many complex solutions so the restriction of the domain to Reals is important to get the only one real solution.
  2. since the system appears to be difficult for Mathematica 7 & 8 one should consider a simple transformation of the original variables.

There are terms 2 x + y, 6 x + 3 y, 8 x^2 + 4 x y so one can conclude it should be a good idea to introduce a new variable z == 2x + y, now we have :

system1 = { 1 + Sqrt[2 x + y + 1] == 4 (2 x + y)^2 + Sqrt[6 x + 3 y],
           (x + 1) Sqrt[2 x^2 - x + 4] + 8 x^2 + 4 x y == 4} /. {y -> z - 2 x}//Simplify
 { 1 + Sqrt[1 + z] == Sqrt[3] Sqrt[z] + 4 z^2, 
   8 x^2 + (1 + x) Sqrt[4 - x + 2 x^2] + 4 x (-2 x + z) == 4}

and this system appears to be much easier to solve :

Reduce[system1, {x}, Reals]
z == 1/2 && x == 1/2

We can use as well Reduce[system1, {z, x}, Reals] to get the solutions instantly unlike in this case Reduce[system1, {x, z}, Reals] i.e. when the specified variables to be found are in the reversed order.

We can use also Solve eliminating one variable :

Solve[system1, {x}, {z}, Reals]
Solve[system1, {z}, {x}, Reals]
{{x -> 1/2}}
{{z -> 1/2}} 
share|improve this answer
add comment
  {eq1, eq2} = {1 + Sqrt[2 x + y + 1] ==  4 (2 x + y)^2 + Sqrt[6 x + 3 y],
     (x + 1) Sqrt[2 x^2 - x + 4] + 8 x^2 + 4 x y == 4};

Select[y /. (Join @@ Solve[# == 0] & /@ 
     GroebnerBasis[Subtract @@@ {eq1, eq2}, {x, y}]), # == Re[#] &] // Union
Solve[eq1 /. y -> -1/2, x, Reals]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.