Re: Cubic equations again...

*To*: mathgroup at smc.vnet.net*Subject*: [mg115494] Re: Cubic equations again...*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Wed, 12 Jan 2011 04:09:33 -0500 (EST)

eqn = a - K - 2 (1 + b) q - (Sqrt[K] Sqrt[zhi])/Sqrt[q] == 0; solq[a_, b_, K_, zhi_] = Solve[eqn, q] // Simplify; params = {a -> 10, b -> 3, K -> 1/10, zhi -> 1}; sol1 = solq[a, b, K, zhi] /. params // Simplify; FullSimplify[eqn /. params /. sol1] {False, True, True} For these values of the parameters, the first root (the one that you investigated) is invalid sol1 // N // Chop {{q -> 1.2725408113389873}, {q -> 0.001021991380051641}, {q -> 1.201437197280962}} Solve[eqn /. params, q] // N // Chop {{q -> 0.0010219913800514346}, {q -> 1.2014371972809619}} Reduce[eqn /. params, q, Reals] // N q == 0.0010219913800515628 || q == 1.2014371972809617 Bob Hanlon ---- pjl52 <LEDERER at SSB.ROCHESTER.EDU> wrote: ============= 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