# unable to solve([x^2+y^2==4, (y-y0)^2+z^2==4], [x, y, z]) This post is a wiki. Anyone with karma >750 is welcome to improve it.

here is the script:

x, y, z = var('x, y, z');
y0 = var('y0');
solve([x^2+y^2==4, (y-y0)^2+z^2==4], [x, y, z]);
[x^2 + y^2 == 4, (y - y0)^2 + z^2 == 4]


but if:

y0 = 0

solve([x^2+y^2==4, (y-y0)^2+z^2==4], [x, y, z]);


[[x == r1, y == -sqrt(-r1^2 + 4), z == r13, [x == r2, y ==
sqrt(-r2^2 + 4), z == r2, [x == r3, y == -sqrt(-r3^2 + 4), z ==
-r3], [x == r4, y == sqrt(-r4^2 + 4), z == -r4]]


With parameter y0, I would expect:

[x = +- sqrt(4-u^2),
y = u,
z = +- sqrt(4-(u-y0)^2)]


Thank you for helping me.

edit retag close merge delete

Is this homework? Hint: what geometric object does each equation represent?

Sort by » oldest newest most voted

Then let us solve with respect to x and z.

Essentially the same code gives the expected answer:

var( 'x, y, z, y0' )

eq1 =    x^2 + y^2 == 4
eq2 =    (y-y0)^2 + z^2 == 4

solutions = solve( [ eq1, eq2 ], [x, z] )
for solution in solutions:
print solution


And we get:

[x == -sqrt(-y^2 + 4), z == -sqrt(-y^2 + 2*y*y0 - y0^2 + 4)]
[x == sqrt(-y^2 + 4), z == -sqrt(-y^2 + 2*y*y0 - y0^2 + 4)]
[x == -sqrt(-y^2 + 4), z == sqrt(-y^2 + 2*y*y0 - y0^2 + 4)]
[x == sqrt(-y^2 + 4), z == sqrt(-y^2 + 2*y*y0 - y0^2 + 4)]

more