       Re: Strange Solve result after previous bad input

• To: mathgroup at smc.vnet.net
• Subject: [mg100948] Re: [mg100937] Strange Solve result after previous bad input
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 18 Jun 2009 20:45:16 -0400 (EDT)

```Clear[a, b, x, y]

Solve[{a == x + y, b == -x + y}, {x, y}]

{{x -> (a - b)/2, y -> (a + b)/2}}

Solve[{a == x + y, b = -x + y}, {x, y}] // Quiet

Solve[{a\[LongEqual]x+y,y-x},{x,y}]

Note in the output that in the place of the second equation there is the value (y-x). This is the result from the assignment to b. At this point b has a value

b

y-x

Just Clear b

Clear[b]

Solve[{a == x + y, b == -x + y}, {x, y}]

{{x -> (a - b)/2, y -> (a + b)/2}}

Bob Hanlon

---- Alain Cochard <alain at geophysik.uni-muenchen.de> wrote:

=============
This is the proper solution to the correctly input system:

Mathematica 6.0 for Linux Itanium (64-bit)

In:= Solve[{a==x + y, b==-x + y},{x,y}]

a - b       a + b
Out= {{x -> -----, y -> -----}}
2           2

Here, there is '=' instead of '==' in the 2nd eq:

In:= Solve[{a==x + y, b=-x + y},{x,y}]

Solve::eqf: -x + y is not a well-formed equation.

Out= Solve[{a == x + y, -x + y}, {x, y}]

and then, subsequent properly input systems will still fail:

In:= Solve[{a==x + y, b==-x + y},{x,y}]

Solve::svars: Equations may not give solutions for all "solve" variables.

Out= {{x -> a - y}}

Is this normal?

If so, is there a cure (some "resetting" procedure), apart from
quiting Mathematica and entering back?

Also, is there a way of testing that a previous bad input is indeed
the cause of that strange output? (Because if it happened a long time
ago in the Mathematica history, one might no longer remember.)

Thanks
AC

```

• Prev by Date: Re: Strange Solve result after previous bad input
• Next by Date: Re: Strange Solve result after previous bad input
• Previous by thread: Re: Strange Solve result after previous bad input
• Next by thread: Re: Strange Solve result after previous bad input