linsolve, final



On 4/2/07, Kostas Oikonomou <ko at research.att.com> wrote:
> However, is the result "Inconsistent equations" really appropriate for [x=2,y=3], [x]?
> I think it would mystify the average user (e.g. me)!
> Shouldn't the result be [x=2]?

I agree that the message is confusing.  However, it *is* actually
consistent with the basic meaning of "solve".  solve(eqs,vars) means
"return the values of vars which make eqs true".  If eqs contain
parameters (i.e. variables which are not members of vars), the
solution must be true for all values of the parameters.  If the eqs
constrain the values of the parameters, then there is a problem (which
we are currently reporting as an "inconsistency").

Thus for example solve([x=a,x=a^2],[x]) gives "inconsistent
equations", while solve([x=a,x=a^2],[x,a]) gives
[[x=1,a=1],[x=0,a=0]].

You can easily create a variant of solve which solves for all included
symbols very easily:

        fullsolve(eqs) := solve(eqs,listofvars(eqs))

but you might be surprised by the results:

        fullsolve(x^2=a) =>   [[x = %r8, a = %r8^2]]
vs.
       solve(x^2=a,a) => [x = -sqrt(a), x=sqrt(a)]

So I think the challenge here is how to ensure that users understand
what is going on, not to change the behavior (except of course the bug
where we give an internal error instead of a message like
"inconsistent equations").

              -s