Ask Your Question
0

Solving an equation in multiple variables

asked 2014-11-15 12:08:18 +0100

gelatine1 gravatar image

updated 2014-11-15 12:09:09 +0100

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:

var('a,b,c,A,B,C')
eq1 = (sqrt((b-a)^2 + (B-A)^2) == A+B)
(eq1^2).expand()

Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-15 14:30:25 +0100

god.one gravatar image

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

var('a,b,c,A,B,C')
eq1 = (sqrt((c)^2 + (B-A)^2) == A+B)
assume(A>0)
assume(B>0)
solve(eq1,c)

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

Comments

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

Thanks, but in this case using different assume scenarios resulting in different results is strange (escpecially in the both is negative case)

god.one gravatar imagegod.one ( 2014-11-16 07:03:19 +0100 )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

2 followers

Stats

Asked: 2014-11-15 12:08:18 +0100

Seen: 1,127 times

Last updated: Nov 15 '14