# Solve function cannot find the solution, but it exists

Posted 4 months ago
1148 Views
|
13 Replies
|
7 Total Likes
|
 Hello,Consider the following expression f=(I Sqrt 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? Answer
13 Replies
Sort By:
Posted 4 months ago
 Are you sure that a=-5/8 is a solution? f = (I Sqrt 2^(1/3) + 2^(1/3))/(2 (-2 a - 1)^(1/3)); f /. a -> -5/8 // FullSimplify (* 1 + I Sqrt *) Note that Solve[f == 2, a] (* {{a -> -(3/8)}} *) Answer
Posted 4 months 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 when you plug a=-5/8 in is because Mathematica is only returning the primary root. Answer
Posted 4 months ago
 Someone with better mathematics knowledge than I have will need to answer. To show my ignorance level I would argue that x==2 means that x==2 only. Analogous to your cubing of both sides x^2==4 is a different equation that results in x==2 and x==-2. Answer
Posted 4 months ago
 If the expression is simplified/rewritten then Solve will find the expected solution -5/8 f = (I Sqrt 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 Answer
Posted 4 months ago
 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. Answer
Posted 4 months ago
 John, did I say "bug"? Answer
Posted 4 months ago
 Hi Hans,This is a nice work around. But, this makes me believe that Solve has a deeper problem than I thought. After simplifying to (-2)^(1/3)/(-1-2 a)^(1/3) Solve still cannot solve it unless you explicitly tell Solve that those 1/3 powers are cube roots! This means that Solve cannot properly recognize branching points if powers are given as rational fractions. I think the reason it worked with CubeRoot is because branching points are hardcoded in the function. But for any arbitrary rational fraction, Solve may fail again, which makes me worry. I don't know how Wolfram programmed Solve, but I would expect Solve to try out the work around you suggested internally and give me the result. The problem I posted here is actually a part of another problem I encountered with DSolve. DSolve correctly found the 3 roots of the general solution of a differential equation I gave it to solve, but when I asked Mathematica to solve the differential equation with a boundary condition, 2 out 3 solutions failed. I then manually applied the B.C. to the general solution Mathematica found with Solve, but I failed (as it is the topic of this thread). However, when I found a solution by hand, I realized that Solve has some issues and perhaps DSolve suffers from this as well. I reserve the problem I had with DSolve to another thread, so that we can focus on the problem Solve has.In my opinion, this is a bug. To me, (-2)^(1/3)/(-1-2 a)^(1/3)==-2 is a very simplified expression and Solve cannot solve it without an unnecessary replacement of 1/3 powers with CubeRoot. Answer
Posted 4 months ago
 Any potential bugs and suggested improvements should be reported to Wolfram Tech Support at https://www.wolfram.com/support/contact/email/?topic=Feedback Answer
Posted 4 months ago
 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 2^(1/3) + 2^(1/3))/(2 (-2 a - 1)^(1/3)); In:= InternalMakePolynomial[f] (* Out= {{(SolveParmVar[2^(1/3)] + SolveParmVar[I] SolveParmVar[2^(1/3)] SolveParmVar[Sqrt[ 3]]) SolveRecipVar[1/ SolveRadVar[(-1 - 2 SolveSolvVar[a])^(1/3)]], 1 + SolveParmVar[I]^2 == 0, -2 + SolveParmVar[2^(1/3)]^3 == 0, -3 + SolveParmVar[Sqrt]^2 == 0, 1 + SolveRadVar[(-1 - 2 SolveSolvVar[a])^(1/3)]^3 + 2 SolveSolvVar[a] == 0, -1 + SolveRadVar[(-1 - 2 SolveSolvVar[a])^( 1/3)] SolveRecipVar[1/ SolveRadVar[(-1 - 2 SolveSolvVar[a])^(1/3)]] == 0}, {SolveRecipVar[1/ SolveRadVar[(-1 - 2 SolveSolvVar[a])^(1/3)]], SolveRadVar[(-1 - 2 SolveSolvVar[a])^(1/3)], SolveSolvVar[a], SolveParmVar[I], SolveParmVar[Sqrt], SolveParmVar[2^(1/3)]}} *) Answer
Posted 4 months ago
 Oh! I think I see the source my confusion now; When (-2)^(1/3)//N is executed I realize that Mathematica returns the principle root. However, when this expression is given in Solve I thought that Solve was looking out for all the branches internally. So it would start with one of the roots (presumably the principle root) and check if the condition was satisfied, if not, then it would rotate the point by 2Pi/3 in the complex domain to see if the other root satisfied the condition, and again if that didn't satisfy it, Solve would rotate it one more time. Obviously the roots with non zero components along the imaginary axis can never satisfy the condition, but one root lies purely on the real axis which gives the result a=-5/8. When Solve gave me the empty list, I was confused like hell because I knew that the real root satisfied the condition. And also that's why I called the rewrite of the expression with CubeRoot offered by Hans "unnecessary" because I thought Solve was internally trying that branch too, but in reality it wasn't. It is only looking at the principle root unless otherwise stated either by CubeRoot or Surd functions. Now this clears out why CubeRoot solution offered by Hans works. I hope my understanding of the working of Solve is correct now. I appreciate your help, Thanks all! Answer
Posted 4 months ago
 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. Answer
Posted 4 months 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. Answer
Posted 4 months 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 + 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)}, {a -> -(5/8), cr2 -> 2^(1/3), crax -> 1/4 (-2^(1/3) - I 2^(1/3) Sqrt)}, {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)}} `So, it even finds three choices of branches to get your result. Answer