First time here? Check out the FAQ!

Ask Your Question
0

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

asked 10 years ago

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.

Preview: (hide)

Comments

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

slelievre gravatar imageslelievre ( 10 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 8 years ago

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)]
Preview: (hide)
link

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: 10 years ago

Seen: 433 times

Last updated: Feb 27 '17