Re: Strange Solve result after previous bad input

• To: mathgroup at smc.vnet.net
• Subject: [mg100967] Re: Strange Solve result after previous bad input
• From: Alois Steindl <Alois.Steindl at tuwien.ac.at>
• Date: Thu, 18 Jun 2009 20:48:49 -0400 (EDT)
• References: <h1d4ao\$o0q\$1@smc.vnet.net>

```Alain Cochard schrieb:

> Here, there is '=' instead of '==' in the 2nd eq:
>
>      In[2]:= Solve[{a==x + y, b=-x + y},{x,y}]
>
With this input you assigned -x+y to b. In subsequent expressions b is
replaced by -x+y.
Furthermore the "side effect" of that assignment is, that its result
-x+b is passed to Solve, so to Mathematica your input looked as if you
had typed "Solve[{a == x + y, -x + y}, {x, y}]"
>
>      Solve::eqf: -x + y is not a well-formed equation.
>
>      Out[2]= Solve[{a == x + y, -x + y}, {x, y}]
>
> and then, subsequent properly input systems will still fail:
>
Here b has still the value -x+y, so now you ask for the solution of
-x+y=-x+y and a==x+y.
>      In[3]:= Solve[{a==x + y, b==-x + y},{x,y}]
>
>      Solve::svars: Equations may not give solutions for all "solve" variables.
>
>      Out[3]= {{x -> a - y}}
>
>
> Is this normal?
>
Yes
> If so, is there a cure (some "resetting" procedure), apart from
> quiting Mathematica and entering back?
>
The simplest way:
b=.
Also different variants of Clear[] should help.
> 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.)
>
Similar problems happen to me quite often. If Mathematica seems to
behave in a strange way, I try to look at the input more closely.
In your case you could have tried to input just
{a==x + y, b==-x + y}

Good luck
Alois

```

• 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