Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12784 > unrolled thread

Strange behaviour of Solve

Started byfriedrich.gehring@gmail.com
First post2012-12-14 07:59 +0000
Last post2012-12-15 10:46 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Strange behaviour of Solve friedrich.gehring@gmail.com - 2012-12-14 07:59 +0000
    Re: Strange behaviour of Solve "Nasser M. Abbasi" <nma@12000.org> - 2012-12-15 10:46 +0000

#12784 — Strange behaviour of Solve

Fromfriedrich.gehring@gmail.com
Date2012-12-14 07:59 +0000
SubjectStrange behaviour of Solve
Message-ID<kaem88$5qb$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#12790

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-12-15 10:46 +0000
Message-ID<kahker$d66$1@smc.vnet.net>
In reply to#12784
Please do not start your variables and symbols and function names
with UpperCase letter. start everything with lowerCase. Using first
letter as lowercase is not recommended as it can conflict with internal
symbols and internal names.


On 12/14/2012 1:59 AM, friedrich.gehring@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]
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web