linsolve strange behavior



> a linear system of 3 eqn.s in 4 unknowns with 4
> parameters (DX,coeff_x,DY,coeff_y):
> 
> [coe[4]+coe[3]+coe[2]+coe[1] = 1,
> -coe[2]*DY/(2*coeff_y)-coe[1]*DY/(2*coeff_y)+coe[4]*DY/2+coe[3
> ]*DY/2= 0,
> -coe[4]*DX/(2*coeff_x)+coe[3]*DX/(2*coeff_x)-coe[2]*DX/(2*coef
> f_x)         +coe[1]*DX/(2*coeff_x) = 0]
> with unknowns coe[i].

First of all, you should know that the solve/linsolve routines do not
take advantage of the "assume" database, so for example they will look
for solutions where DX=0.

Interesting.  In my Maxima (5.9.0 GCL 2.5.0 W2k), solve returns a
solution, but the solution is incorrect (only correct if DY=0 or
DX=coeff_y).  The solution *is* correct, however, if I include the
parameters among the variables to solve for.  Perhaps that is an
acceptable workaround for you?

(C1) eq;
(D1) [coe[4]+coe[3]+coe[2]+coe[1] = 1,
      -coe[2]*DY/(2*coeff_y)-coe[1]*DY/(2*coeff_y)+coe[4]*DY/2
			    +coe[3]*DY/2
        = 0,
      -coe[4]*DX/(2*coeff_x)+coe[3]*DX/(2*coeff_x)
			    -coe[2]*DX/(2*coeff_x)
			    +coe[1]*DX/(2*coeff_x)
        = 0]
(C2) solve(eq,[coe[1],coe[2],coe[3],coe[4]]);
(D2) [[coe[1] = ((2*%R105+1)*DX+2*%R105-1)/(2*DX+2),
       coe[2] = -(2*%R105-1)/2,
       coe[3] = -(%R105*DX+%R105-1)/(DX+1),coe[4] = %R105]]
(C3) ratsimp(subst(d2[1],eq));
(D3) [1 = 1,-(DX-coeff_y)*DY/(2*coeff_y*DX+2*coeff_y) = 0,0 = 0]

/* !! Solution only valid for some values of parameters */

(C4) solve(d3[2],[DX,DY,coeff_y]);
(D4) [[DX = %R106,DY = 0,coeff_y = %R107],
      [DX = %R108,DY = %R109,coeff_y = %R108]]

/* ... more precisely, when DY=0 or DX=coeff_y  */

/* Let's try putting in both variables and parameters */

(C5) solve(eq,[coe[1],coe[2],coe[3],coe[4],DX,DY,coeff_x,coeff_y]);
(D5) [[coe[1] = %R110,coe[2] = %R111,coe[3] = %R112,
       coe[4] = -%R112-%R111-%R110+1,DX = 0,DY = 0,
       coeff_x = %R113,coeff_y = %R114],
      [coe[1] = -((%R115-1)*%R119+%R115)/(%R119+1),
       coe[2] = %R115,coe[3] = -(%R116*%R119+%R116-1)/(%R119+1),
       coe[4] = %R116,DX = 0,DY = %R117,coeff_x = %R118,
       coeff_y = %R119],
      [coe[1] = %R120,coe[2] = %R121,coe[3] = -(2*%R120-1)/2,
       coe[4] = -(2*%R121-1)/2,DX = %R122,DY = 0,coeff_x = %R123,
       coeff_y = %R124],
      [coe[1] = -(%R129*((%R129*(1
				-2*(%R125*%R129+%R125-1)
				 /(%R129+1))
			-2*(%R125*%R129+%R125-1)/(%R129+1)-1)
			/(2*%R129+2)
			-1)
	      +(%R129*(1-2*(%R125*%R129+%R125-1)/(%R129+1))
	       -2*(%R125*%R129+%R125-1)/(%R129+1)-1)
	       /(2*%R129+2))
	      /(%R129+1),
       coe[2] = (%R129*(1-2*(%R125*%R129+%R125-1)/(%R129+1))
	      -2*(%R125*%R129+%R125-1)/(%R129+1)-1)
	      /(2*%R129+2),
       coe[3] = -(%R125*%R129+%R125-1)/(%R129+1),coe[4] = %R125,
       DX = %R126,DY = %R127,coeff_x = %R128,coeff_y = %R129]]

/* Fortunately, the solutions for the parameters are either special
   cases or unconstrained.  Note that some of these solutions may
   be redundant.   Anyway, only the last one obeys the parameter
   constraints. */

/* Verify the solutions */

(C6) makelist(ratsimp(subst(sols,eq)),sols,d5);
(D6) [[1 = 1,0 = 0,0 = 0],[1 = 1,0 = 0,0 = 0],
      [1 = 1,0 = 0,0 = 0],[1 = 1,0 = 0,0 = 0]]