Re: Question on Solve
- To: mathgroup at smc.vnet.net
- Subject: [mg112747] Re: Question on Solve
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 29 Sep 2010 04:13:31 -0400 (EDT)
Actually, in Mathematica 7 Simplify[Solve[eqs, vars]] During evaluation of In[6]:== Solve::svars:Equations may not give solutions for all "solve" variables. >> {{v1 -> I*v8, v2 -> -v8, v3 -> -v8, v4 -> (-I)*v8, v5 -> v8, v6 -> I*v8, v7 -> (-I)*v8}} which is the general answer, I believe (it includes the trivial case). So the question still remains why: Reduce[eqs, vars] v1 ==== 0 && v2 ==== 0 && v3 ==== 0 && v4 ==== 0 && v5 ==== 0 && v6 ==== 0 && v7 ==== 0 && v8 ==== 0 Andrzej Kozlowski On 28 Sep 2010, at 16:21, Andrzej Kozlowski wrote: > I don't think one can fault Solve since it is not supposed to return comp= lete solutions anyway. I don't have anymore Mathematica 5.2 installed but M= athematica 7 returns a very complex output to your second example and produ= ces a warning that it may not give solutions for all Solve variables. The o= utput is too complicated for me to try to check if it is correct (in some s= ense anyway) or not. > > However, here is something that does worry me a little more: > > eqs == {(-3*Sqrt[3]*v1 + v2 + 17*v3 + (8*I)*Sqrt[3]*v3 - > 9*Sqrt[3]*v4 + 9*v5 - Sqrt[3]*v6 - 3*Sqrt[3]*v7 + 9*v8)/16 ==== > 0, (5*v1 - Sqrt[3]*v2 + 3*Sqrt[3]*v3 + 11*v4 + (8*I)*Sqrt[3]*v4 - > 5*Sqrt[3]*v5 + 3*v6 - 3*v7 - Sqrt[3]*v8)/16 ==== > 0, (-(Sqrt[3]*v1) + 3*v2 + 3*v3 + 5*Sqrt[3]*v4 + > 11*v5 + (8*I)*Sqrt[3]*v5 - 3*Sqrt[3]*v6 - Sqrt[3]*v7 - 5*v8)/ > 16 ==== 0, (-9*v1 - 3*Sqrt[3]*v2 + Sqrt[3]*v3 + 9*v4 + > 9*Sqrt[3]*v5 + 17*v6 + (8*I)*Sqrt[3]*v6 - v7 - 3*Sqrt[3]*v8)/ > 16 ==== 0, (9*v1 - Sqrt[3]*v2 + 3*Sqrt[3]*v3 - 9*v4 + > 3*Sqrt[3]*v5 - v6 + 17*v7 + (8*I)*Sqrt[3]*v7 - 9*Sqrt[3]*v8)/ > 16 ==== 0, (-5*Sqrt[3]*v1 + 3*v2 + 3*v3 + Sqrt[3]*v4 - 5*v5 + > Sqrt[3]*v6 + 3*Sqrt[3]*v7 + 11*v8 + (8*I)*Sqrt[3]*v8)/16 ==== > 0, ((11 + (8*I)*Sqrt[3])*v1 - 3*Sqrt[3]*v2 + Sqrt[3]*v3 + 5*v4 + > Sqrt[3]*v5 - 3*v6 + 3*v7 + 5*Sqrt[3]*v8)/16 ==== > 0, (9*Sqrt[3]*v1 + (17 + (8*I)*Sqrt[3])*v2 + v3 + 3*Sqrt[3]*v4 + > 9*v5 + 3*Sqrt[3]*v6 + Sqrt[3]*v7 + 9*v8)/16 ==== 0}; > vars == {v1, v2, v3, v4, v5, v6, v7, v8}; > > > > Reduce[eqs, vars] > > v1 ==== 0 && v2 ==== 0 && v3 ==== 0 && v4 ==== 0 && v5 ==== 0 && > v6 ==== 0 && v7 ==== 0 && v8 ==== 0 > > > However, let's just add the condition that not all vi's are 0 and we get: > > Reduce[And @@ eqs && ! And @@ Thread[vars ==== 0], vars] > > v2 ==== I*v1 && v3 ==== I*v1 && v4 ==== -v1 && > v5 ==== (-I)*v1 && v6 ==== v1 && v7 ==== -v1 && > v8 ==== (-I)*v1 && v1 !== 0 > > > Note that your particular solution is a special case of this one. The gen= eral solution should be the disjunction of the trivial solution, that Reduc= e returned and this solutions. It seems to me that this is exactly what Red= uce ought to have returned. Of course Solve could not return this since it = can't return inequalities. > > Andrzej Kozlowski > > On 28 Sep 2010, at 12:04, carlos at colorado.edu wrote: > >> I have noticed some erratic behavior of Solve, >> illustrated in the following two examples. >> Suppose I have 8 homogenous linear equations >> >> eqs=={(9*v1-3*Sqrt[3]*v2+v3+v4-(8*I)*Sqrt[3]*v4- >> 9*Sqrt[3]*v5+9*v6-Sqrt[3]*v7-3*Sqrt[3]*v8)/16====0, >> (-(Sqrt[3]*v1)+5*v2-Sqrt[3]*v3+3*Sqrt[3]*v4-5*v5- >> (8*I)*Sqrt[3]*v5-5*Sqrt[3]*v6+3*v7-3*v8)/16====0, >> (-5*v1-Sqrt[3]*v2+3*v3+3*v4+5*Sqrt[3]*v5-5*v6- >> (8*I)*Sqrt[3]*v6-3*Sqrt[3]*v7-Sqrt[3]*v8)/16====0, >> (-3*Sqrt[3]*v1-9*v2-3*Sqrt[3]*v3+Sqrt[3]*v4+9*v5+ >> 9*Sqrt[3]*v6+v7-(8*I)*Sqrt[3]*v7-v8)/16====0, >> (-9*Sqrt[3]*v1+9*v2-Sqrt[3]*v3+3*Sqrt[3]*v4-9*v5+ >> 3*Sqrt[3]*v6-v7+v8-(8*I)*Sqrt[3]*v8)/16====0, >> ((-5-(8*I)*Sqrt[3])*v1-5*Sqrt[3]*v2+3*v3+3*v4+ >> Sqrt[3]*v5-5*v6+Sqrt[3]*v7+3*Sqrt[3]*v8)/16====0, >> (5*Sqrt[3]*v1+(-5-(8*I)*Sqrt[3])*v2-3*Sqrt[3]*v3+ >> Sqrt[3]*v4+5*v5+Sqrt[3]*v6-3*v7+3*v8)/16====0, >> (9*v1+9*Sqrt[3]*v2+v3-(8*I)*Sqrt[3]*v3+v4+ >> 3*Sqrt[3]*v5+9*v6+3*Sqrt[3]*v7+Sqrt[3]*v8)/16====0}; >> >> The variables are >> v=={v1,v2,v3,v4,v5,v6,v7,v8}; >> Then >> sol==Solve[eqs,v]; Print[sol]; >> >> gives the parametric solution >> {{v4->-v3,v5->v2,v6->(-2*I)*v2-v3, >> v7->-3*v2+(2*I)*v3,v8->-3*v2+(2*I)*v3,v1->(2*I)*v2+v3}}; >> which is correct. >> >> Change the above equations to >> >> eqs=={(-3*Sqrt[3]*v1+v2+17*v3+(8*I)*Sqrt[3]*v3- >> 9*Sqrt[3]*v4+9*v5-Sqrt[3]*v6-3*Sqrt[3]*v7+9*v8)/16====0, >> (5*v1-Sqrt[3]*v2+3*Sqrt[3]*v3+11*v4+(8*I)*Sqrt[3]*v4- >> 5*Sqrt[3]*v5+3*v6-3*v7-Sqrt[3]*v8)/16====0, >> (-(Sqrt[3]*v1)+3*v2+3*v3+5*Sqrt[3]*v4+11*v5+ >> (8*I)*Sqrt[3]*v5-3*Sqrt[3]*v6-Sqrt[3]*v7-5*v8)/16====0, >> (-9*v1-3*Sqrt[3]*v2+Sqrt[3]*v3+9*v4+9*Sqrt[3]*v5+ >> 17*v6+(8*I)*Sqrt[3]*v6-v7-3*Sqrt[3]*v8)/16====0, >> (9*v1-Sqrt[3]*v2+3*Sqrt[3]*v3-9*v4+3*Sqrt[3]*v5-v6+ >> 17*v7+(8*I)*Sqrt[3]*v7-9*Sqrt[3]*v8)/16====0, >> (-5*Sqrt[3]*v1+3*v2+3*v3+Sqrt[3]*v4-5*v5+Sqrt[3]*v6+ >> 3*Sqrt[3]*v7+11*v8+(8*I)*Sqrt[3]*v8)/16====0, >> ((11+(8*I)*Sqrt[3])*v1-3*Sqrt[3]*v2+Sqrt[3]*v3+5*v4+ >> Sqrt[3]*v5-3*v6+3*v7+5*Sqrt[3]*v8)/16====0, >> (9*Sqrt[3]*v1+(17+(8*I)*Sqrt[3])*v2+v3+3*Sqrt[3]*v4+ >> 9*v5+3*Sqrt[3]*v6+Sqrt[3]*v7+9*v8)/16====0}; >> v=={v1,v2,v3,v4,v5,v6,v7,v8}; >> >> sol==Solve[eqs,v]; Print[sol]; >> >> and I get only the trivial solution >> {{v1->0,v2->0,v3->0,v4->0,v5->0,v6->0,v7->0,v8->0}}; >> >> But the system has an infinity of nontrivial solutions, >> for example (this one was obtained with another method) >> >> vsol=={v1->-I,v2->1,v3->1,v4->I,v5->-1,v6->-I,v7->I,v8->-1}; >> Print[Simplify[eqs/.vsol]]; >> gives {True,True,True,True,True,True,True,True}; >> >> These 2 examples are extracted from several thousands >> similar ones. Solve returns the trivial solution in >> about 1/3 of the instances. Mathematica version used >> is 5.2 under Mac OS 10.5.9. >> >> Question: what do I have to do to get the correct >> parametric answers in all cases? >> >