Ask Your Question

Solving an equation in multiple variables

asked 2014-11-15 05:08:18 -0500

gelatine1 gravatar image

updated 2014-11-15 05:09:09 -0500

I have this equation : sqrt((b-a)^2 + (B-A)^2) == A+B and i would like to have it solved to b-a=+- 2 * sqrt(AB) in sage. Right now I have the following code but it doesn't really output what I want. I just get
A^2 - 2AB + B^2 + a^2 - 2ab + b^2 == A^2 + 2AB + B^2
and I don't know how to make sage solve it further.

my code:

eq1 = (sqrt((b-a)^2 + (B-A)^2) == A+B)

Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-15 07:30:25 -0500 gravatar image

You can try the following with substituting b-a with c

eq1 = (sqrt((c)^2 + (B-A)^2) == A+B)

which results in

[c == -2*sqrt(A*B), c == 2*sqrt(A*B)]

But can anybody explain me the results of the computation without the assume statements? For A,B both beeing negative the solver does not do anything and for A being bigger and B being smaller then zero, sage throws an error that maxima needs further inputs (the same as when you're not using assume)

edit flag offensive delete link more


If there was no assume, an expression like sqrt(A*B) is not very well defined. The same kind of behavior occurs with simplify_radical.

vdelecroix gravatar imagevdelecroix ( 2014-11-15 07:42:42 -0500 )edit

Thanks, but in this case using different assume scenarios resulting in different results is strange (escpecially in the both is negative case) gravatar ( 2014-11-16 00:03:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2014-11-15 05:08:18 -0500

Seen: 121 times

Last updated: Nov 15 '14