Group Abstract Group Abstract

Message Boards Message Boards

0
|
12.1K Views
|
13 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Solve function cannot find the solution, but it exists

Posted 5 years ago

Hello,

Consider the following expression

f=(I Sqrt[3] 2^(1/3) + 2^(1/3))/(2(-2 a-1)^(1/3))
s=Solve[f==-2,a]

Mathematica returns an empty list {}. However a=-5/8 is a solution.

What is wrong with Solve?

POSTED BY: Yeso Alde
13 Replies
Posted 5 years ago
POSTED BY: Yeso Alde

It isn't really the machinery of Solve that's in question.

f == 0 /. a -> -5/8
(* False *)

-5/8 isn't a root of your equation. Mathematica consistently treats x^(1/3) and CubeRoot[x] as different things, defined differently. If Solve were to violate that, it would represent a bug.

POSTED BY: John Doty
Posted 5 years ago

Dear John,

I failed to understand your test. The way I defined f in the first post never meant to be equal to 0 for a=-5/8. There is no surprise that you got False.

Secondly, let's look at the correctly defined case

FullSimplify@f/.a->-5/8
(* 2(-1)^(1/3) *)

Even if you had used the original condition, you would still get False when you test it against -2 since Mathematica returns the principle root of 2(-1)^(1/3) which is 1.+1.73205I

2(-1)^(1/3)//N
(* 1.+1.73205*I *)

For a second, let's forget about how Mathematica evaluates an expression.

The expression 2(-1)^(1/3) has 3 roots. The roots are

2Exp[I Pi/3], 2Exp[I 5Pi/3], 2Exp[I Pi] 

2Exp[I Pi/3] is the principle root which Mathematica returns and its value is 1.+1.73205I. The real root is 2Exp[I Pi] which is returned by CubeRoot function and its value is -2 and finally the other root 2Exp[I 5Pi/2] whose value is 1.-1.73205I

The way I looked at Solve function initially was that I thought it was trying all these roots to find a, but it wasn't, as cleared out by Daniel.

If I am asked to check whether f==-2 for a=-5/8, I would consider all the roots. Not just the principle root which obviously doesn't satisfy the condition, but the root 2Exp[I Pi] does!

Back to Mathematica, you may consider the equations corresponding to each root as separate equations. Mathematica may choose to do that for any reason-- consistency is a very valid reason. Then you may say a=-5/8 does not satisfy the condition for my equation corresponding to the "principle root", which you are correct. But for another root, it satisfies.

I think you should now see the source of my initial objection (or say, confusion) which is related to the "machinery" of Solve. I'll get my head wrapped around the way Mathematica operates in the future.

POSTED BY: Yeso Alde
Posted 5 years ago

Mathematica never assumes that it can choose the branch of a multi-valued function to match your imagination. It always uses the principal branch, or at least tries to (for definite integration, it sometimes gets lost in the complex plane). If you want to give it that choice, you must state your problem in terms that allow it. Perhaps like this:

Solve[{
  (I Sqrt[3] + 1) cr2/(2 crax) == -2, 
  cr2^3 == 2, 
  crax^3 == -2 a - 1},
   {a, cr2, crax}]

yielding

{{a -> -(5/8), cr2 -> -(-2)^(1/3), crax -> 1/4 ((-2)^(1/3) + I (-2)^(1/3) Sqrt[3])}, 
 {a -> -(5/8), cr2 -> 2^(1/3), crax -> 1/4 (-2^(1/3) - I 2^(1/3) Sqrt[3])}, 
 {a -> -(5/8), cr2 -> (-1)^(2/3) 2^(1/3), 
     crax -> 1/4 (-(-1)^(2/3) 2^(1/3) + (-1)^(1/6) 2^(1/3) Sqrt[3])}}

So, it even finds three choices of branches to get your result.

POSTED BY: Updating Name
Posted 5 years ago
POSTED BY: Yeso Alde
Posted 5 years ago

Any potential bugs and suggested improvements should be reported to Wolfram Tech Support at

https://www.wolfram.com/support/contact/email/?topic=Feedback
POSTED BY: Jim Baldwin

This is not a bug. 5/8 is simply not a solution to the given equation (others have pointed that out). Solve is working exactly as designed in this example.

To clarify, radicals give principal branches of roots. Parametrized radicals will of course only be able to do that when numeric values are substituted for the parameters.

As for Solve, when encountering a parametrized radical it creates a new variable and a new equation. For example, the expression (-1-2 a)^(1/3) would become something along the lines radicalVariable[(-1-2 a)^(1/3)] with the defining equation radicalVariable[(-1-2 a)^(1/3)]^3==(-1-2 a). The actual internals can be see below.

f = (I Sqrt[3] 2^(1/3) + 2^(1/3))/(2 (-2 a - 1)^(1/3));
In[3]:= Internal`MakePolynomial[f]

(* Out[3]= {{(Solve`ParmVar[2^(1/3)] + 
     Solve`ParmVar[I] Solve`ParmVar[2^(1/3)] Solve`ParmVar[Sqrt[
       3]]) Solve`RecipVar[1/
    Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(1/3)]], 
  1 + Solve`ParmVar[I]^2 == 0, -2 + Solve`ParmVar[2^(1/3)]^3 == 
   0, -3 + Solve`ParmVar[Sqrt[3]]^2 == 0, 
  1 + Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(1/3)]^3 + 
    2 Solve`SolvVar[a] == 
   0, -1 + Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(
      1/3)] Solve`RecipVar[1/
      Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(1/3)]] == 
   0}, {Solve`RecipVar[1/
   Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(1/3)]], 
  Solve`RadVar[(-1 - 2 Solve`SolvVar[a])^(1/3)], Solve`SolvVar[a], 
  Solve`ParmVar[I], Solve`ParmVar[Sqrt[3]], Solve`ParmVar[2^(1/3)]}} *)
POSTED BY: Daniel Lichtblau
Posted 5 years ago

If the expression is simplified/rewritten then Solve will find the expected solution -5/8

f = (I Sqrt[3] 2^(1/3)+2^(1/3))/(2 (-2 a-1)^(1/3))

Use FullSimplify to get rid of the imaginary unit:

g = FullSimplify@f
(* (-2)^(1/3)/(-1-2 a)^(1/3) *)

Then rewrite using CubeRoot:

h = CubeRoot[-2]/CubeRoot[-1-2 a]

Solve[h == -2, a]
(* {{a -> -(5/8)}} *)

Note that f and h will not evaluate to the same when a is less than -1/2

POSTED BY: Hans Milton

This is not a bug.

Your rewrite using CubeRoot changes the meaning of the expression, because

(-2)^(1/3) == CubeRoot[-2]
(* False *)

or if you like

{(-2)^(1/3), CubeRoot[-2]} // N
{0.629961 + 1.09112 I, -1.25992}

In general, x^(1/3) refers to the principal branch of the complex cube root. Use CubeRoot or Surd for real roots.

POSTED BY: John Doty
Posted 5 years ago

John, did I say "bug"?

POSTED BY: Hans Milton
Posted 5 years ago
POSTED BY: Jim Baldwin
Posted 5 years ago

Yes, a=-5/8 is a solution.

Very short way to check it would be to cube both sides. With a=-5/8, f^3 gives -8 and one of its cube root is the real number -2.

The long way to check it, after substituting a=-5/8, is to find the cube root of the numerator and the denominator separately. Each has 3 roots (complex roots). And then try out the ratios of those roots (numerator to denominator) which reveal a real number. After some investigation, some ratios give the real root -2 for a=-5/8.

a=-3/8 would be the solution if f== +2, not iff== -2`.

I think the reason you are getting 1+Sqrt[3] when you plug a=-5/8 in is because Mathematica is only returning the primary root.

POSTED BY: Yeso Alde
Posted 5 years ago

Are you sure that a=-5/8 is a solution?

f = (I Sqrt[3] 2^(1/3) + 2^(1/3))/(2 (-2 a - 1)^(1/3));
f /. a -> -5/8 // FullSimplify
(* 1 + I Sqrt[3] *)

Note that

Solve[f == 2, a]
(* {{a -> -(3/8)}} *)
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard