Thanks for the reply. However, I'm not so sure about the intention part of the comment
I got the solve(x+y==3, x,y), i.e. asking solve for more than one variables strict from the current documentation (solve? ) except I dropped the redundant equation 2x+2y==6. Why don't solve just call the main solve() routine? but calling Expression.solve() instead. I think solve(x+y==3,x,y) should give [[x == -r1 + 3, y == r1]] while solve(x+y==3,y,x) should give [[y == -r2 + 3, x == r2]] Currently these can be achieved by add a redundant equation, e.g. 1==1 to the list. On Sep 13, 9:34 am, kcrisman <kcris...@gmail.com> wrote: > On Sep 13, 12:08 pm, Pong <wypon...@gmail.com> wrote: > > > y,z=var('y,z'); solve(6*x + 10*y + 15*z ==1,x,y,z) gives > > ([{x: -5/3*y - 5/2*z + 1/6}], [1]) > > So wacky. Definitely a bug, needless to say. > > > ([x == -y + 3], [1]) > > > My questions are: > > 1) Why the notation are different in the 2 and 3-variable case? One > > gives x: and the other x== > > Well, you are asking for solutions to both x *and* y, but the solve is > really designed to solve one in terms of the other(s). I just think > no one has pointed out this weirdness before. So you are using it in > a way it wasn't intended. I'm not sure whether we should add the > use, or have a warning, or both, or neither, or documentation, or... > > > 2) What the [1] in both cases stand for ? > > Compare: > > sage: a = x+y==3 > sage: type(a) > <type 'sage.symbolic.expression.Expression'> > sage: a.solve(x,y) > ([x == -y + 3], [1]) > sage: a.solve(x,False) > [x == -y + 3] > sage: a.solve(x,True) > ([x == -y + 3], [1]) > > So we are giving a non-False input to the second argument (whether we > should get multiplicities) and so we get a multiplicity of 1. Which > doesn't really make sense anyway. > > Maybe we should put in a check for the expression having more than one > variable before we send it to a.solve(), or maybe it just needs that > long-awaited rewrite... seehttp://trac.sagemath.org/sage_trac/wiki/symbolics > for some issues with solve. > > > 3) In order to get the parameters appear in the solution, one need to > > add a redundant equation. Shall we improve on that? > > e.g. > > solve([x+y==3,2*x+2*y==6],x,y) > > [[x == -r1 + 3, y == r1]] > > I think this is because when you do that, now the input is multiple, > and instead of doing Expression.solve(), it does the main solve() > routine, which deals with this. > > Thoughts from others who care about "solve"? I'm not quite sure what > the best solution is. The easiest one is making really big letters in > the documentation that say "don't do this" and trying to catch these > cases. > > - kcrisman -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org