Ask Your Question
0

Solving an equation in multiple variables

asked 10 years ago

gelatine1 gravatar image

updated 10 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 10 years ago

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)

Preview: (hide)
link

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 ( 10 years ago )

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 ( 10 years ago )

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

Seen: 1,184 times

Last updated: Nov 15 '14