Ask Your Question
0

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

asked 2015-05-08 06:42:14 -0500

this post is marked as community wiki

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]);

gives the expected answer:

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

Comments

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

slelievre gravatar imageslelievre ( 2015-05-10 08:05:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-27 13:15:06 -0500

dan_fulea gravatar image

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)]
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

1 follower

Stats

Asked: 2015-05-08 06:42:14 -0500

Seen: 220 times

Last updated: Feb 27