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

MathGroup Archive 2012

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

Search the Archive

Re: Strange behaviour of Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129108] Re: Strange behaviour of Solve
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 15 Dec 2012 05:52:49 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121214075949.D52176927@smc.vnet.net>

Use the option VerifySolutions

$Version

"9.0 for Mac OS X x86 (64-bit) (November 20, 2012)"

Clear[G, Nf, vd, dg, d, l, a, b, s, p, t, v];

K1 = ({{a - 2, -1, -3, -3}, {-1, 0, 0, 0}, {-3, 0, 0, -4}, {-3, 0, -4, 0}});
K2 = ({{0, -1, 0, 0}, {-1, a - 2, -3, -3}, {0, -3, -4, 0}, {0, -3, 0, -4}});
K3 = 1/3 ({{0, 0, 1, -4}, {0, 0, -3, 0}, {1, -3, -a - 2, -1}, {-4, 0, -1,0}});
K4 = 1/3 ({{0, 0, -4, 1}, {0, 0, 0, -3}, {-4, 0, 0, -1}, {1, -3, -1, -a -2}});
g = {g1, g2, g3, g4};
K = Transpose[{K1, K2, K3, K4}];

G[g1_, g2_, g3_, g4_] = Simplify[(d - 2) g - b*g.K.g];

Par = {dg -> 4, d -> 3, Nf -> 2, vd -> 1/(8*Pi), l -> 2/3};

Kurz = {a -> dg*Nf, b -> 4 vd l/Nf};

Options[Solve]

{Cubics -> True, GeneratedParameters -> C, InverseFunctions -> Automatic,
 MaxExtraConditions -> 0, Method -> Automatic, Modulus -> 0, Quartics -> True,
  VerifySolutions -> Automatic, WorkingPrecision -> \[Infinity]}

?VerifySolutions

VerifySolutions is an option to Solve and related functions. With
VerifySolutions -> True, solutions are verified and extraneous
solutions are eliminated. With VerifySolutions -> False, they are not.
Note that only those numerical solutions that are obviously extraneous
are eliminated.

sol = FullSimplify[
   Solve[G[s, p, v, t] == 0 /. Kurz /. Par,
    {s, p, v, t},
    VerifySolutions -> True]];

Length[sol]

16

G[s, p, v, t] /. Kurz /. Par /. sol // Simplify // Union

{{0, 0, 0, 0}}


Bob Hanlon


On Fri, Dec 14, 2012 at 2:59 AM,  <friedrich.gehring at gmail.com> wrote:
> I have a strange Problem with Solve: The number of solutions depends on the names for the variables. I am using Mathematica 8.0.1.0 on Linux x86 and this is my code:
> Clear[K1, K2, K3, K4, K, G, Nf, vd, dg, d, l, a, b, s, p, t, v];
> K1 = ({
>     {a - 2, -1, -3, -3},
>     {-1, 0, 0, 0},
>     {-3, 0, 0, -4},
>     {-3, 0, -4, 0}
>    });
> K2 = ({
>     {0, -1, 0, 0},
>     {-1, a - 2, -3, -3},
>     {0, -3, -4, 0},
>     {0, -3, 0, -4}
>    });
> K3 = 1/3 ({
>      {0, 0, 1, -4},
>      {0, 0, -3, 0},
>      {1, -3, -a - 2, -1},
>      {-4, 0, -1, 0}
>     });
> K4 = 1/3 ({
>      {0, 0, -4, 1},
>      {0, 0, 0, -3},
>      {-4, 0, 0, -1},
>      {1, -3, -1, -a - 2}
>     });
> g = {g1, g2, g3, g4};
> K = Transpose[{K1, K2, K3, K4}];
> G[g1_, g2_, g3_, g4_] = Simplify[(d - 2) g - b * g.K.g];
> Par = {dg -> 4, d -> 3, Nf -> 2, vd -> 1/(8*Pi), l -> 2/3};
> Kurz = {a -> dg*Nf, b -> 4 vd l /Nf};
> sol =
>  FullSimplify[Solve[G[s, p, v, t] == 0 /. Kurz /. Par, {s, p, v, t}]]
> Length[sol]
>
> The System G consists of 4 coupled quadratic equations so it should have 16 solutions in general. If I take the order of variables as above, Mathematica returns the warning "Solve::svars: Equations may not give solutions for all "solve" variables. >>" and 17 solutions the first being {p->-s-\[Pi],v->-\[Pi],t->-\[Pi]}. This is obviously wrong in general because if you type:
> FullSimplify[G[s, p, t, v] /. sol[[1]] /. Kurz /. Par]
> you will get the result:
> {(4 (-s^2-\[Pi] s+\[Pi]^2))/(3 \[Pi]),(4 (-s^2-\[Pi] s+\[Pi]^2))/(3 \[Pi],0,0}
> that is different from zero. It only holds true for the special cases s -> -(1/2) (1 + Sqrt[5]) \[Pi] and s -> (1/2) (-1 + Sqrt[5]) \[Pi], that are part of the remaining 16 solutions. That means that there are in fact only 16 solutions (as one would have expected) and the first one is wrong.
> The strange thing is, that if I change the order of variables to {s, p, t, v}, the right result with only 16 solutions is generated. I was really wondering about this an tried with other names, sometimes is worked properly sometimes not. I would be interested why this problem arises and how I can avoid it to get the right result in all cases.
> A further problem is, if I tune the parameter Nf e.g. to 4, the same error as above occurs, but the trick with changing the variables does not give the right result anyway (in fact for s,p,v,t there are 19 solutions and for s,p,v,t only 18 but both is too much). Actually there should be 16 solutions as you get using NSolve.
> My question is: Why are there too many (wrong) solutions and is there a possibility to get the right ones for all names of variables?
> Thank you very much,
> Friedrich Gehring
>



  • Prev by Date: Re: Problem with PlotLegends
  • Next by Date: How can a sub picture be resized with a Row?
  • Previous by thread: Strange behaviour of Solve
  • Next by thread: Re: Strange behaviour of Solve