RE: RE: [Q] Equation solving?

*To*: mathgroup at smc.vnet.net*Subject*: [mg23359] RE: [mg23318] RE: [mg23282] [Q] Equation solving?*From*: "David Park" <djmp at earthlink.net>*Date*: Thu, 4 May 2000 02:59:26 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

> From: Andrzej Kozlowski [mailto:andrzej at tuins.ac.jp] To: mathgroup at smc.vnet.net > I wrote the message below in a hurry and did not express it very > well. Here > is another go. We can get the answer slightly faster if we do the > following: > > In[1]:= > eqns = {Q1 == (2*z + 1 - 1)^2 + 4*1*1, > k1 == 1/Sqrt[Q1]*(v*z - 3/2*(2*z + 1 + 1 - > Sqrt[Q1])), Q2 == (2*z + 1 - 1)^2 + 4*1*1, > k2 == 1/Sqrt[Q2]*((6.1 - v)*z - > 2/2*(2*z + 1 + 1 - Sqrt[Q2])), > 3/2*(2*z + 1 + 1) + (k1 - 3/2)*Sqrt[Q1] == > 6.1*z - (2/2*(2*z + 1 + 1) + (k2 - 2/2)*Sqrt[Q2])}; > In[2]:= > sols = Solve[eqns, {k1, k2, z}, {Q1, Q2, w}] > Out[2]= > {{k1 -> 0., k2 -> 0., z -> 0.}, {k1 -> 0., k2 -> 2., z -> 0.}, {k1 -> 3., > k2 -> 0., z -> 0.}, {k1 -> 3., k2 -> 2., z -> 0.}} > > However, only the first solution is genuine, the rest are spurious (or > parasites). Thanks Andrzej, We should all learn to check solutions. This would have been a smoother way to the one genuine solution. Eliminate k1 and k2 first and solve for Q1, Q2 and z. Then solve for k1 and k2. Eliminate[eqns, {k1, k2}] sols = Solve[%, {Q1, Q2, z}] Q1 == 4. && Q2 == 4. && z == 0. && Q1 != 0. && Q2 != 0. {{Q1 -> 4., Q2 -> 4., z -> 0.}} Rationalize[Chop[eqns /. sols]] sols2 = Solve[%[[1]]] {{True, k1 == 0, True, k2 == 0, 3 + 2*(-(3/2) + k1) == -2 - 2*(-1 + k2)}} {{k1 -> 0, k2 -> 0}} Now check the solution. eqns /. sols /. sols2 // Chop {{{True, True, True, True, True}}} I guess that the lesson is: if you are having difficultly solving a set of equations, try doing it in stages, but always check the solutions, which I failed to do. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/