Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16732
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Solve output depends on previous attempt with bad syntax |
| Date | 2014-04-04 07:58 +0000 |
| Message-ID | <lhlonp$kkb$1@smc.vnet.net> (permalink) |
| References | <20140403061601.46BAA6A06@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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. >>
Solve[{b+a x1,b+a x2},{a,b}]
While this failed to evaluate Solve it nonetheless did the assignment of
values to y1 and y2 before concluding that there was a problem. Clear y1
and y2 before attempting Solve again with the correct syntax.
Clear[y1,y2]
Solve[{y1==a x1+b,y2==a x2+b},{a,b}]
{{a -> -((-y1 + y2)/(x1 - x2)),
b -> -((x2*y1 - x1*y2)/
(x1 - x2))}}
Bob Hanlon
On Thu, Apr 3, 2014 at 2:16 AM, Alain Cochard <Alain.Cochard@unistra.fr>wro=
te:
>
> 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 output?
>
> Thank you,
> Alain
>
> --
> EOST (=C9cole et Observatoire des Sciences de la Terre)
> IPG (Institut de Physique du Globe) | alain.cochard@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
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar
Re: Solve output depends on previous attempt with bad syntax Bob Hanlon <hanlonr357@gmail.com> - 2014-04-04 07:58 +0000
csiph-web