Ask Your Question
0

solve: Possible bug?

asked 2020-06-11 12:16:47 -0500

curios_mind gravatar image

updated 2020-06-11 13:35:56 -0500

Hello,

This question is relevant to Question #2 in the topic "desolve: wrong solution?!". If desolve is using solve internally when initial conditions are invoked to find the constants after obtaining the general solution, perhaps this is where the problem lies.

Consider the following expression

a=var('a')
f=-1/2*(I*sqrt(3)*2^(1/3) - 2^(1/3))/(-2*a - 1)^(1/3)
sol=solve(f==-2,a);show(sol)

sol is [a == (-5/8)]

Now, if we plug that back in f,

check=f.subs(sol).n();print(check`)

this gives 1.00000000000000 - 1.73205080756888*I, where it ought to give -2 (if there is a solution)

And I tried this with Mathematica also

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

It returns an empty list {} for this, indicating that there is no solution.

What is wrong with Sage's solve function here?

Update: I tried solve with "sympy" agorithm. It agreed with Mathematica. It looks like there is a problem with Maxima

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-06-12 00:40:04 -0500

dsejas gravatar image

Hello, @curios_mind!

I think you found an interesting problem. My appreciation is that $a=-5/8$ is the correct answer (up to complex representation). Let me explain...

Observe the numerator of your expression $f$ can be written as $$\sqrt[3]{2}\left(\frac{1}{2}-i\frac{\sqrt{3}}{2}\right)=\sqrt[3]{2}\bigl(\cos(\pi/3)-i\sin(\pi/3)\bigr)$$ which is nothing more than one of the possible solutions of the equation $x^3=-2$, or alternatively, this is one of the possible values of $\sqrt[3]{-2}$ in the complex plain.

Now, consider the denominator for $a=-5/8$: $$\left(-2\left(\frac{-5}{8}\right)-1\right)^{1/3}=\sqrt[3]{\frac{1}{4}}=\sqrt[3]{\frac{1}{2^2}}$$

So, what $f$ is for $a=-5/8$ turns out to be $$\frac{\sqrt[3]{-2}}{\sqrt[3]{\frac{1}{2^2}}}=\sqrt[3]{-2}\sqrt[3]{2^2}=\sqrt[3]{-2^3}=-2$$ So the original equation is satisfied.

If you want to be more formal, $$\frac{\sqrt[3]{-2}}{\sqrt[3]{\frac{1}{2^2}}}=\sqrt[3]{-2}\sqrt[3]{4}=\sqrt[3]{2}\bigl(\cos(\pi/3)-i\sin(\pi/3)\bigr)\sqrt[3]{4}\bigl(\cos(\pi/3)+i\sin(\pi/3)\bigr)=\sqrt[3]{8}(\cos^2(\pi/3)+\sin^2(\pi/3))=\sqrt[3]{8}=2$$

Of course, as you can see, this depends on you choosing the correct representation of complex numbers like $\sqrt[3]{-4}$. If you choose wrongly, for example, $\sqrt[3]{-4}=\sqrt[3]{4}\bigl(\cos(\pi/3)-i\sin(\pi/3)\bigr)$, you won't get the answer, but other possible value for $f$ in the complex plain. That is what happened when you subs $a=-5/8$: Sage didn't choose the correct complex representations of some cube roots.

In summary, the problem is that you have a complex equation with ambiguous numbers like cube roots. Sage and Maxima did what they could, which is to give you a correct answer, up to complex representation. In this case, it is up to you to decide if this is what you wanted or not. If this is not the solution you expected, or you want an alternative solution, I recommend you to rewrite the cube roots explicitly as one of their possible complex number values.

I hope this helps!

edit flag offensive delete link more

Comments

Thanks. I see. After you, I did it by hand also. I calculated all 3 roots of the numerator, and all 3 roots of the denominator. I checked combinations that reveal real valued results and 3 combination gave -2. So, a=-5/8 is in fact a solution.

It looks that then Mathematica has a problem :)

curios_mind gravatar imagecurios_mind ( 2020-06-14 16:38:02 -0500 )edit

Hello, @curios_mind! If there is indeed a problem with Mathematica, it is unfortunate that we can't fix it ourselves or even see what the problem actually is, due to the closed source nature of that software.

My personal vision is that there are adequate tools for every type of work. In this case, SageMath shined and Mathematica failed us, but perhaps there is some other situation where Mathematica shines and Sage is not up to the challenge.

However, there is one thing we can be sure of: The fact of Sage being open-source is one of its best features, while Mathematica being closed-source is one of its biggest drawbacks. For example, if there is something Sage can't do, you can write your own code to implement that functionality; in Mathematica is not always possible,

dsejas gravatar imagedsejas ( 2020-06-22 11:52:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-06-11 12:16:47 -0500

Seen: 88 times

Last updated: Jun 12