Processing math: 100%
Ask Your Question
0

solve: Possible bug?

asked 4 years ago

curios_mind gravatar image

updated 4 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

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 32(12i32)=32(cos(π/3)isin(π/3)) which is nothing more than one of the possible solutions of the equation x3=2, or alternatively, this is one of the possible values of 32 in the complex plain.

Now, consider the denominator for a=5/8: (2(58)1)1/3=314=3122

So, what f is for a=5/8 turns out to be 323122=32322=323=2 So the original equation is satisfied.

If you want to be more formal, 323122=3234=32(cos(π/3)isin(π/3))34(cos(π/3)+isin(π/3))=38(cos2(π/3)+sin2(π/3))=38=2

Of course, as you can see, this depends on you choosing the correct representation of complex numbers like 34. If you choose wrongly, for example, 34=34(cos(π/3)isin(π/3)), 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!

Preview: (hide)
link

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 ( 4 years ago )

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 ( 4 years ago )

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: 4 years ago

Seen: 870 times

Last updated: Jun 12 '20