MathGroup Archive 2007

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

Search the Archive

Re: Strange Behaviour of Solve?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79016] Re: [mg79007] Strange Behaviour of Solve?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 16 Jul 2007 02:09:45 -0400 (EDT)
  • References: <200707150513.BAA08775@smc.vnet.net>

On 15 Jul 2007, at 14:13, Andreas Maier wrote:

> Hi,
>
> i tried (using Mathematica 6.0) to solve a system of equations:
>
> In:=Solve[{b == g, a == (g*v/c), (b)^2 + (a)^2 == 1}, g]
> Out:={}
>
> But when i use
>
> In:=Solve[{b == g, a == (g*v/c), (b)^2 + (a)^2 == 1}, {a, b, g}]
> Out={{g -> -c/Sqrt[c^2 + v^2], b -> -c/Sqrt[c^2 + v^2],
>           a -> -v/Sqrt[c^2 + v^2]}, {g -> c/Sqrt[c^2 + v^2],
>           b -> c/Sqrt[c^2 + v^2], a -> v/Sqrt[c^2 + v^2]}}
>
> i suddenly get the solution for g. It seems to me, that the number
> of solutions for one variable depends on the number of variables
> i want to solve for. Is this behaviour of Solve to be
> expected?
>
> Andreas Maier
>
>

Yes. Solve gives only "generic solutions", which means solutions that  
do not depend on the  "parameters" having any special values. In

Solve[{b == g, a == (g*v/c), (b)^2 + (a)^2 == 1}, g]
{}

g is a variable and a,b,v,c are all parameters. The system has no  
solutions that are valid for all values of the parameters. You can  
see that by using Reduce instead of Solve:

  Reduce[{b == g, a == g*(v/c), b^2 + a^2 == 1}, g]

c^2 + v^2 != 0 && (b == -(c/Sqrt[c^2 + v^2]) ||
       b == c/Sqrt[c^2 + v^2]) && c != 0 &&
    a == (b*v)/c && g == b

this tells you that g==b is a solution of your system provided that  
the parameters satisfy the given relations. On the other hand:

Solve[{b == g, a == (g*v/c), (b)^2 + (a)^2 == 1}, {a, b, g}]

{{g -> -c/Sqrt[c^2 + v^2], b -> -c/Sqrt[c^2 + v^2],
           a -> -v/Sqrt[c^2 + v^2]}, {g -> c/Sqrt[c^2 + v^2],
           b -> c/Sqrt[c^2 + v^2], a -> v/Sqrt[c^2 + v^2]}}

is a system with three variables a,b,g and two parameters v and c.  
The solutions that you get for {a,b,g} are valid for all values of v  
and c, provided we assume that c!=0 and c^2+v^2 !=0 which Solve does  
automatically (if c ==0 the second equation would be problematic, and  
if c^2+v^2==0 the solutions, if any could not be given in the form  
Solve returns).  Reduce is more careful:

  Reduce[{b == g, a == g*(v/c), b^2 + a^2 == 1}, {a, b, g}]
  (v == 0 && a == 0 && (b == -1 || b == 1) && g == b &&
       c != 0) || (c^2 + v^2 != 0 &&
       (a == -(v/Sqrt[c^2 + v^2]) ||
          a == v/Sqrt[c^2 + v^2]) && a*c != 0 &&
       b == (v - a^2*v)/(a*c) && g == b)


You can see a simpler example of the same phenomenon here:

Solve[x + y == x, x]
{}

because y is a parameter and there is no solution valid for all  
values of y, but:

Solve[x + y == x, {x, y}]
Solve::svars:Equations may not give solutions for all "solve"  
variables. >>
{{y -> 0}}

Now we have infinitely many solutions of the form {x,0} where x can  
by any complex number.


Andrzej Kozlowski


  • Prev by Date: Cascaded (Multi-range) Iterators?
  • Next by Date: Re: Strange behaviour of Simplify
  • Previous by thread: Strange Behaviour of Solve?
  • Next by thread: Re: Strange Behaviour of Solve?