Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question on Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112781] Re: Question on Solve
  • From: carlos at colorado.edu
  • Date: Thu, 30 Sep 2010 04:51:53 -0400 (EDT)
  • References: <i7useh$ra9$1@smc.vnet.net>

On Sep 29, 2:13 am, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
> 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 co=
mp=
>
> 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 pro=
du=
> 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 ge=
t:
>
> > Reduce[And @@ eqs &&  ! And @@ Thread[vars ==== 0], vars]
>
> > v2 ==== I*v1 && v3 ==== I*v1 && v4 ==== -v1 &&
> >   v5 ==== (-I)*v1 && v6 ==== v1 && v7 ==== -v=
1 &&
> >   v8 ==== (-I)*v1 && v1 !== 0
>
> > Note that your particular solution is a special case of this one. The g=
en=
>
> eral solution should be the disjunction of the trivial solution, that Red=
uc=
> e returned and this solutions. It seems to me that this is exactly what R=
ed=
> uce ought to have returned. Of course Solve could not return this since i=
t =
> can't return inequalities.
>
>
>
>
>
> > Andrzej Kozlowski
>
> > On 28 Sep 2010, at 12:04, car... 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?

Many thanks for pointing out Reduce as alternative.  I have tried it long ago
on other problems without much luck.  The posted application is part of
a module doing symbolic eigenvector extraction given exact symbolic
eigenvalues, for matrix orders 4 to 16. Solve tends to partly collapse as
the order exceeds 6.  Might also experiment with NullSpace.

BTW the reason for 5.2 is compatibility with remote (part-time) students who have
kept a previous version.  The 5.2 kernel is generally stable but on
Mac OS 10.6
(Snow Leopard)  the front end is becoming flaky; no problems on 10.5.


  • Prev by Date: Re: Interpolate in polar coordinates or cartesian
  • Next by Date: Re: Root Finding Methods Gaurenteed to Find All Root
  • Previous by thread: Re: Question on Solve
  • Next by thread: Washington DC Area Mathematica Special Interest Group