Linsolve doesn't check arguments



Commit 42bee1 (love the commit identifier) appends a function affine_p (written by Stavros)  to fourier_elim.lisp. Maybe affine_p should be moved to the
linsolve code and have linsolve signal an error for nonlinear input. I'm fine with the overhead of the check--my Fourier elimination code had an bogus check
for an affine expression--that resulted in dispatching linsolve on a nonlinear system :(

--Barton
________________________________

linsolve([x*y-1],[x,y]) => [x = -(%r4*x-1)/y,y = %r4]

This is wrong, presumably because linsolve is blindly assuming that the arguments are linear in all variables.  To see that it is really grossly wrong and not just unhelpful (which is bad enough), substitute y=%r4=1, and you'll see x=1-x i.e. x=1/2; [x=1/2,y=1] is not a solution.

I'd propose that linsolve check this precondition and give an error if it fails.  This should avoid some user confusion at the cost of a little overhead.

It could be argued that only sophisticated users will use linsolve rather than solve, and should know better, but (a) we get new users trying out all sorts of things; (b) even sophisticated users make blunders from time to time.  As a matter of fact, I ran into a silent bug in some share code because of this.

             -s