Re: Re: Bug in Solve?
- To: mathgroup at smc.vnet.net
- Subject: [mg103014] Re: [mg102951] Re: [mg102921] Bug in Solve?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Thu, 3 Sep 2009 19:57:11 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200909020803.EAA03289@smc.vnet.net> <200909030937.FAA20743@smc.vnet.net>
- Reply-to: murray at math.umass.edu
FullSimplify (after ComplexExpand) is a bit of overkill here to get rid of the I's: Simplify suffices. Andrzej Kozlowski wrote: > On 2 Sep 2009, at 10:03, tonysin wrote: > >> I am just trying to learn Mathematica. What am I doing wrong here? >> >> I have a very simple equation: >> >> x^3 - 15 x + 2 = 0 >> >> When I plot it in Mathematica 7, >> >> ClearAll[*] >> f[x_] := x^3 - 15 x + 2 >> Plot[f[x], {x, -5, 5}] >> >> >> it gives the expected graph of a cubic, with three real roots near -4, >> 0, and 4. >> >> >> When I NSolve it, >> >> NSolve[f[x] == 0, x] >> >> it gives >> >> {{x -> -3.938}, {x -> 0.133492}, {x -> 3.80451}} >> >> which is exactly what you would expect from the graph. >> >> But when I Solve it >> >> Solve[f[x] == 0, x] >> >> it gives this mess >> >> {{x -> 5/(-1 + 2 I Sqrt[31])^(1/3) + (-1 + 2 I Sqrt[31])^( >> 1/3)}, {x -> -((5 (1 + I Sqrt[3]))/( >> 2 (-1 + 2 I Sqrt[31])^(1/3))) - >> 1/2 (1 - I Sqrt[3]) (-1 + 2 I Sqrt[31])^(1/3)}, {x -> -(( >> 5 (1 - I Sqrt[3]))/(2 (-1 + 2 I Sqrt[31])^(1/3))) - >> 1/2 (1 + I Sqrt[3]) (-1 + 2 I Sqrt[31])^(1/3)}} >> >> >> I don't know how it looks in your font, but that "I" in each solution >> is the imaginary i. Solve is saying this equation has no real roots, >> even though the graph clearly shows that all three roots are real. >> >> Can someone tell me if I am doing something wrong, or am I expecting >> something wrong, or if I just can't trust Mathematica? Thanks for any >> help. >> > > You should learn a little more mathematics. The fact that your > expressions contain I does not mean at all that they have non-zero > imaginary parts, only that Mathematica does not attempt by itself to > find an expression without I automatically (this is a reasonable thing > to do as trying to find such an expression would take, in general, a > lot of extra time which would, in most cases, be wasted. But if you > want a purely real expression then: > > > FullSimplify[ComplexExpand[Solve[x^3 - 15*x + 2 == 0, x]]] > {{x -> Sqrt[5]* > (Sqrt[3]*Sin[(1/3)*ArcTan[2*Sqrt[31]]] + > Cos[(1/3)*ArcTan[2*Sqrt[31]]])}, > {x -> -2*Sqrt[5]*Cos[(1/3)*ArcTan[2*Sqrt[31]]]}, > {x -> Sqrt[5]*(Cos[(1/3)*ArcTan[2*Sqrt[31]]] - > Sqrt[3]*Sin[(1/3)*ArcTan[2*Sqrt[31]]])}} > > gives you one. > > Andrzej Kozlowski > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Bug in Solve?
- From: tonysin <a2mgoog@yahoo.com>
- Re: Bug in Solve?
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Bug in Solve?