Re: Cubic equations again...
- To: mathgroup at smc.vnet.net
- Subject: [mg115495] Re: Cubic equations again...
- From: Alexei Boulbitch <alexei.boulbitch at iee.lu>
- Date: Thu, 13 Jan 2011 03:23:19 -0500 (EST)
Phil, there is something wrong with your calculation. I guess, it is the use of the parameter K. I would better take a low case letter k. In addition you made one wrong conclusion. Let us do it. I first simplify your equation by renaming: expr = Simplify[(a - k - 2 (1 + b) q - (Sqrt[k] Sqrt[g])/Sqrt[q] /. {q -> x^2, g -> G/k, a -> k + A, b -> c/2 - 1}), Assumptions -> {x> 0, k> 0, g> 0}] (*Assumptions x>0, just to look for a most simple case first, while k,g>0, since you later gave them positive values *) A - (Sqrt[G] + c x^3)/x Here are your three solutions, now in a form that you can more easily look at: Clear[A, G, c]; sol1 = Solve[expr == 0, x][[1, 1, 2]] sol2 = Solve[expr == 0, x][[2, 1, 2]] sol3 = Solve[expr == 0, x][[3, 1, 2]] -(((2/3)^(1/3) A)/(9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^( 1/3)) - (9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^( 1/3)/(2^(1/3) 3^(2/3) c) ((1 + I Sqrt[3]) A)/( 2^(2/3) 3^( 1/3) (9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^( 1/3)) + ((1 - I Sqrt[3]) (9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^(1/3))/(2 2^(1/3) 3^(2/3) c) ((1 - I Sqrt[3]) A)/( 2^(2/3) 3^( 1/3) (9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^( 1/3)) + ((1 + I Sqrt[3]) (9 c^2 Sqrt[G] + Sqrt[3] Sqrt[-4 A^3 c^3 + 27 c^4 G])^(1/3))/(2 2^(1/3) 3^(2/3) c) The two of them seem to be complex, while one seems to be real, but this is not necessarily the case. Let us take your values of the parameters and substitute -> first into the new parameters and then into the obtained solutions: A = a - k /. {a -> 10, b -> 3, k -> 0.1, g -> 1} G = g*k /. {a -> 10, b -> 3, k -> 0.1, g -> 1} c = 2 (1 + b) /. {a -> 10, b -> 3, k -> 0.1, g -> 1} 9.9 0.1 8 x1 = sol1 // Chop x2 = sol2 // Chop x3 = sol3 // Chop -1.12807 1.0961 0.0319686 You get, therefore, all three solutions real, rather than one real and two complex. Legal are however, only the two last, since we used the assumption x>0, so that the first should be additionally checked. One way is to evaluate the following: Plot[expr // N // Chop, {x, -1.13, -1.12}] Plot[expr // N // Chop, {x, 1.09, 1.1}] Plot[expr // N // Chop, {x, 0.02, 0.035}] Solutions you want are then q1 = x1^2 q2 = x2^2 q3 = x3^2 1.27254 1.20144 0.00102199 Have fun, Alexei Related questions have been asked here before but I do not see how they apply to the following problem. I have solved a cubic equation using Solve to get an analytic solution. In the case I am dealing with I am interested in a real root. I then plug in the actual values of coefficients into the real solution generated and get an answer that is incorrect. Here are the details: In[14]:= Solve[ a - K - 2 (1 + b) q - (Sqrt[K] Sqrt[zhi])/Sqrt[q] == 0, q] Out[14]....presents three solutions, the first I simplify and then assign to a function solq: solq[a_, b_, K_, zhi_]=(a (1 + b) - (1 + b) K + (3 Sqrt[3] Sqrt[(1 + b)^7 K zhi (-2 (a - K)^3 + 27 (1 + b) K zhi)] + (1 + b)^3 (-(a - K)^3 + 27 (1 + b) K zhi))^( 1/3))^2/(6 (1 + b)^2 (3 Sqrt[3] Sqrt[(1 + b)^7 K zhi (-2 (a - K)^3 + 27 (1 + b) K zhi)] + (1 + b)^3 (-(a - K)^3 + 27 (1 + b) K zhi))^(1/3)) Evaluating: solq[10, 3, .1, 1] I get 1.2725408113389869 + 0. I ( a real number). Now evaluating In[35]:= a - K - 2 (1 + b) q - (Sqrt[K] Sqrt[zhi])/Sqrt[ q] /. {a -> 10, b -> 3, K -> .1, zhi -> 1, q -> 1.2725408113389869` } Out[35]= -0.5606529814237877 So the solution is wrong. The actual solution is q=1.2014371972809619 which can be confirmed by graphing or numerical solution using FindRoot In[12]:= Rt[a_, b_, K_, zhi_] := FindRoot[a - K - 2 (1 + b) q - (Sqrt[K] Sqrt[zhi])/Sqrt[q], {q, 0.1}] In[13]:= Rt[10, 3, .1, 1] Out[13]= {q -> 1.2014371972809619} Does Solve not find the root, or is the problem evaluation of the analytical expression with the selected values? Thank you in advance, Phil University of Rochester -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu www.iee.lu -- This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.