# Understanding the 'solve()' result with braces and brackets ("([{x:z},{x:y}],[1,1])")

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Having following code

var('x,y,z')
P=-x^2*y + x*y^2 + x^2*z - y^2*z - x*z^2 + y*z^2 == 0
solve(P,x,y,z)


Sage gives me a result of

([{x:z},{x:y}],[1,1])


which I am not really able to interpret, also the help(solve) did not get me any further - is there anyone who can help me out with that? (btw. as -(x-y)*(x-z)*(y-z)==0 is an alternate form for writing the polynomial my expected answer would be something like x=y or x=z or y=z but in other cases where I'd get a similar answer I would have no idea, so I'd be happy to get this format explained.)

edit retag close merge delete

Sort by » oldest newest most voted

The result consists of two lists: [{x: z}, {x: y}] and [1, 1]. Each list is a possible result that solves the equation. The first list is a Python dictionary (which by definition has no order but gives the values that specific variables will need to satisfy the equation); the second is a list (which simply gives the needed values for the variables in the order the vars were given as argument. Substitution confirms:

sage: P.subs(x==z)
0 == 0
sage: P.subs(x==y)
0 == 0
sage: P.subs(x==1,y==1)
0 == 0

more

Thanks so far, now I understand a bit more, but: How does it come? I mean, if there is already an x==y as solution, for what is it useful to add another result where these both values are just the same? And where is the y:z solution I now would expect?

( 2015-09-15 09:26:32 -0500 )edit

The y:z can be deduced from the other two, but I have no idea how the results come up specifically.

( 2015-09-25 02:16:08 -0500 )edit