MathGroup Archive 2014

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

Search the Archive

Re: Solve output depends on previous attempt with bad syntax

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132512] Re: Solve output depends on previous attempt with bad syntax
  • From: Alain.Cochard at unistra.fr
  • Date: Fri, 4 Apr 2014 03:57:18 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <lhiuav$de5$1@smc.vnet.net>
  • Reply-to: alain.cochard at unistra.fr

Hi Kevin, and thank you very much.

Kevin writes on Thu  3 Apr 2014 06:29:
 > You could have anticipated this by noting two things:
 >
 > (1) The symbol y1 is now black instead of blue, which means that it =
has
 > a value (b+a x1) in this case;

Hum, this rather looks like an aposteriori hint!  At any rate, I use
the text based interface, which has no color variations.

 > (2) The use of the "=" itself is the reason.
 >
 > The second execution was looking for a solution to
 >
 > a x1 + b == a x1 +b, a x2 + b == a x2 + b
 >
 > Which is why you got the null answer, since a,b can be anything.
 >
 > To prevent this and other problems with previously used variables, I=

 > would generally include
 >
 > Clear[a,b,x1,x2,y1,y2]
 >
 > in the same cell as the Solve.

OK, I see the reason now.  I dare say this is a some sort of a
misconception...

Regards,
Alain


 > Kevin
 >
 >
 > On 4/3/2014 2:15 AM, Alain Cochard wrote:
 > > First, the correct solution of a linear system of 2 equations with=
 2
 > > unknowns, for reference.
 > >
 > >      Mathematica 9.0 for Linux x86 (64-bit)
 > >      Copyright 1988-2013 Wolfram Research, Inc.
 > >
 > >      In[1]:= Solve[{y1==a x1 +b, y2==a x2 +b},{a,b}]
 > >
 > >                       -y1 + y2          x2 y1 - x1 y2
 > >      Out[1]= {{a -> -(--------), b -> -(-------------)}}
 > >                       x1 - x2              x1 - x2
 > >
 > > Now, starting a new Mathematica session, assume I make a mistake, =
using '='
 > > instead of '==', I get an error message -- so far, so good:
 > >
 > >      Mathematica 9.0 for Linux x86 (64-bit)
 > >      Copyright 1988-2013 Wolfram Research, Inc.
 > >
 > >      In[1]:= Solve[{y1=a x1 +b, y2=a x2 +b},{a,b}]
 > >
 > >      Solve::naqs: b + a x1 && b + a x2 is not a quantified system
 > >      of equations and inequalities.
 > >
 > >      Out[1]= Solve[{b + a x1, b + a x2}, {a, b}]
 > >
 > > Realizing my mistake, I retry with the proper syntax:
 > >
 > >      In[2]:= Solve[{y1==a x1 +b, y2==a x2 +b},{a,b}]
 > >
 > >      Out[2]= {{}}
 > >
 > > which is obviously not the correct result.
 > >
 > > Is there a rationale here, i.e., could I have anticipated this out=
put=3F
 > >
 > > Thank you,
 > > Alain
 > >

--
EOST (=C9cole et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard at unistra.fr
5 rue Ren=E9 Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25    =



  • Prev by Date: Re: Solve output depends on previous attempt with bad syntax
  • Next by Date: Re: Solve output depends on previous attempt with bad syntax
  • Previous by thread: Re: Solve output depends on previous attempt with bad syntax
  • Next by thread: Re: Solve output depends on previous attempt with bad syntax