Ask Your Question

A bug with solve xy=x ?

asked 2013-12-30 11:58:08 +0200

updated 2013-12-30 13:43:31 +0200

For solving the equation "xy=x", we can do:

sage: x,y=var('x,y')
sage: solve([x*y==x],[x,y])     
[x == 0]

But this is not the complete solution.

We need to add the trivial equation "0==0" for having the complete solution:

sage: solve([x*y==x,0==0],[x,y])
[[x == 0, y == r1], [x == r2, y == 1]]

Is it a bug ?

edit retag flag offensive close merge delete



Is it a bug? A good question. If we change the order of x,y to solve([x*y==x],[y,x]) , we get y==1 as solution. Obviously only the first variable is used as far as there is only one equation. IMHO that's not a bug, but it would be nice, if Sage could add the trivial equation automatically.

ndomes gravatar imagendomes ( 2013-12-31 04:30:41 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-12-31 00:08:33 +0200

cjsh gravatar image

x,y=var('x,y') show((x*y-x).solve(x,y))

"==" is a logic,not always equal "="

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-12-30 11:58:08 +0200

Seen: 365 times

Last updated: Dec 31 '13