Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Extract solutions from solve

I am new to sage. So, sorry if my question is trivial.

How can I get the values of a solve operation. Say I have

x = var('x');
f = x^2 - 5*x + 6;
z = solve(f = 0, x);
show(z);

gives me something like

[x == 2, x == 3]

How can I take the value 2 or 3 from that?

Also, when I was trying to solve another equation (quiet a long one), I get the solution as

[0 = something something.....]

What does that zero mean?

click to hide/show revision 2
retagged

Extract solutions from solve

I am new to sage. So, sorry if my question is trivial.

How can I get the values of a solve operation. Say I have

x = var('x');
f = x^2 - 5*x + 6;
z = solve(f = 0, x);
show(z);

gives me something like

[x == 2, x == 3]

How can I take the value 2 or 3 from that?

Also, when I was trying to solve another equation (quiet a long one), I get the solution as

[0 = something something.....]

What does that zero mean?