Re: cubic polynomial
- To: mathgroup at smc.vnet.net
- Subject: [mg22682] Re: [mg22646] cubic polynomial
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sat, 18 Mar 2000 01:27:56 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
on 3/17/00 5:48 AM, Andrzej Kozlowski at andrzej at tuins.ac.jp wrote: > on 3/16/00 3:11 PM, E.Carletti1 at E.Carletti1 at lse.ac.uk wrote: > >> >> I have a problem: I want to solve this equation: >> >> x^3+(3c-1)(x^2)-4cx-4(c^2)=0 with respect to x. >> >> It has to have a real solution because it is continuous >> in x. c is a positive parameter. >> If i solve it numerically, plugging numbers for c, then it is fine. But >> I would like an analytical solution: in this case i get only one >> solution which should give me a real value for x (the other two are >> imaginary) but >> it has a square root with all negative members (all terms with c, which >> is positive, with a sign - in front of it, so immaginary). How is that >> possible? What procedure does mathematica use to solve cubic expression? >> >> How can I express the expression in a nicer way to get rid of these >> negative terms? My feeling is that the programm is not able to simplify >> the expression for the solution. >> Could you please help me? if I write the expression I find in the paper >> I am writing, noone will believe it is real! >> And even more funny, if I plug number into the solution I find for x, it >> comes the same number as I plug numbers directly into the function I >> want to solve, except for the last part which is an imaginary number >> which shoult tend to zero. >> What is going on? >> >> Thank your for your help >> >> Elena Carletti >> Financial Markets Group >> LSE >> Houghton Street >> London WC2A 2AE >> >> Tel. 0044 (0)20 7955 7896 >> Fax 0044 (0) 20 7242 1006 >> >> >> > > I am afraid this your problem is as unsolvable as it is typical. Mathematica > solves cubic equations using the famous formula attributed to the 16 century > Italian mathematician Cardano (though actually it was discovered by another > 16th century Italian Tartaglia). This formula (and another one for fourth > degree equations discovered by Cardano) inevitably involves complex numbers > even when the roots are real. > > For example consider the following equation: > x^3 + x^2 - 12 x - 6 == 0 > > This has three real roots. You can see this just by looking at the graph > Plot[x^3 + x^2 - 12 x - 6, {x, -4, 4}] > > (I personally prefer a different proof. Just evaluate > In[3]:= > Experimental`CylindricalAlgebraicDecomposition[x^3 + x^2 - 12 x - 6 == 0, x] > Out[3]= > 3 2 > x == Root[#1 + #1 - 12 #1 - 6 & , 1] || > > 3 2 > x == Root[#1 + #1 - 12 #1 - 6 & , 2] || > > 3 2 > x == Root[#1 + #1 - 12 #1 - 6 & , 3] > > This shows that all three roots must be real!) > > > Now look at the answer Solve gives > > In[4]:= > Solve[x^3 + x^2 - 12 x - 6 == 0, x] > > Out[4]= > 1 37 > {{x -> -(-) + ------------------------- + > 3 1/3 > 3 (26 + 9 I Sqrt[617]) > > 1 1/3 > - (26 + 9 I Sqrt[617]) }, > 3 > > 1 37 (1 + I Sqrt[3]) > {x -> -(-) - ------------------------- - > 3 1/3 > 6 (26 + 9 I Sqrt[617]) > > 1 1/3 > - (1 - I Sqrt[3]) (26 + 9 I Sqrt[617]) }, > 6 > > 1 37 (1 - I Sqrt[3]) > {x -> -(-) - ------------------------- - > 3 1/3 > 6 (26 + 9 I Sqrt[617]) > > 1 1/3 > - (1 + I Sqrt[3]) (26 + 9 I Sqrt[617]) }} > 6 > > All roots look complex, though we know they are real. In general it is > impossible to give an expression for arbitrary real roots of polynomial > equations in terms of radicals without using complex numbers, although one can > give such expressions if one does not insist on using radicals. In the above > case one can give real expressions for the roots using trigonometric > functions: for example the first root above is actually equal to > > > 1 2 1 9 Sqrt[617] > -(-) + - Sqrt[37] Cos[- ArcTan[-----------]] > 3 3 3 26 > and one can find similar real expressions for all of the others. > > If your equation involves parameters the situation is even more confusing. You > may get roots which seem to involve complex numbers and others which appear to > be real. But actually which one is real and which is not will depend on the > values of the parameters, and in fact for certain values the roots that look > complex may turn out to be real while those which look real may result in > complex values. > > The moral is that if you want to use algebraic solutions of equations you > simply can't avoid complex numbers. This is exactly what Tartaglia and Cardano > discovered and this is the reason why they invented what they called > "imaginary" numbers. -- When I wrote my first reply to this message I forgot to consider the equation that caused the original posting. To determine the real roots of an algebraic equation the best way is, in my opinion, to use on eof the most powerful functions in Mathematica 4.0 as follows: In[1]:= Experimental`CylindricalAlgebraicDecomposition[ x^3 + 3*c*x^2 - x^2 - 4*c*x - 4*c^2 == 0, {c, x}] Out[1]= 3 2 2 2 c < 0 && x == Root[#1 + 3 c #1 - #1 - 4 c #1 - 4 c & , 1] || c == 0 && (x == 0 || x == 1) || 3 2 2 c > 0 && (x == Root[#1 + 3 c #1 - #1 - 4 c #1 - 2 4 c & , 1] || x == 3 2 2 2 Root[#1 + 3 c #1 - #1 - 4 c #1 - 4 c & , 2] || 3 2 2 2 x == Root[#1 + 3 c #1 - #1 - 4 c #1 - 4 c & , 3]) What this means is this. If c<0 then there is only one real root, which, as a Root object can be described as Root[#1^3 + 3*c*#1^2 - #1^2 - 4*c*#1 - 4*c^2 & , 1]. If you want to express it in terms of radicals you can do so: In[3]:= ToRadicals[Root[#1^3 + 3*c*#1^2 - #1^2 - 4*c*#1 - 4*c^2 & , 1]] Out[3]= 1 1 3 2 - (1 - 3 c) + - Power[-27 c + 27 c + 9 c + 3 3 5 4 3 6 Sqrt[3] Sqrt[-27 c - 9 c - c ] + 1, 1/3] - 2 (-9 c - 6 c - 1) / 3 2 (3 Power[-27 c + 27 c + 9 c + 5 4 3 6 Sqrt[3] Sqrt[-27 c - 9 c - c ] + 1, 1/3]) If c==0 then there are just two possible real roots, x==0 and x==1. And if c>0 then the real root is just one of the roots of the original equation! Which one? That, of course, depends, on the value of c. Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp