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 13:42:14 +0100

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 15:05:33 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-27 20:15:06 +0100

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 13:42:14 +0100

Seen: 420 times

Last updated: Feb 27 '17