Ask Your Question
0

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

asked 2015-09-15 09:58:47 +0200

this post is marked as community wiki

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-09-15 14:41:34 +0200

rws gravatar image

updated 2015-09-15 14:54:59 +0200

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
edit flag offensive delete link more

Comments

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?

Jaleks gravatar imageJaleks ( 2015-09-15 16:26:32 +0200 )edit

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

rws gravatar imagerws ( 2015-09-25 09:16:08 +0200 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2015-09-15 09:58:47 +0200

Seen: 489 times

Last updated: Sep 15 '15