Ask Your Question
0

square root

asked 2012-02-25 17:57:32 -0500

BobB gravatar image

updated 2012-02-25 18:17:45 -0500

Shashank gravatar image

I am continually running into the problem where square roots defeat any attempt to simplify an expression. For example:

sqrt(-x_3 + sqrt(x_1^2 + x_2^2 + x_3^2))*sqrt(x_3 + sqrt(x_1^2 + x_2^2 +
x_3^2))/sqrt(x_2^2/x_1^2 + 1)

should simplify to x_1.

I understand the reason sage hesitates to simplify a square root. But being unable to force the issue is starting to render sage almost completely useless.

Does anybody know how to get sage to simplify these types of expressions? simplify_radical does not work. The closest I can come is to square the expression first, then simplify and take the square root. That still does not get rid of the final square root. I wonder if making the expression complex might work, and if so, how might I do that?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-02-25 18:23:02 -0500

Shashank gravatar image

updated 2012-02-25 18:42:03 -0500

This question has been already answered

http://ask.sagemath.org/question/222/...

Here is how you can force sage to simplify roots

var('x_1 x_2 x_3')
t=(sqrt(-x_3 + sqrt(x_1^2 + x_2^2 + x_3^2))*sqrt(x_3 + sqrt(x_1^2 + x_2^2 +
x_3^2))/sqrt(x_2^2/x_1^2 + 1)).maxima_methods().rootscontract().simplify()
view(t)

Edit: If you want to get rid of the last square root use the following code

var('x_1 x_2 x_3')
assume(x_1>0)
t=(sqrt(-x_3 + sqrt(x_1^2 + x_2^2 + x_3^2))*sqrt(x_3 + sqrt(x_1^2 + x_2^2 +
x_3^2))/sqrt(x_2^2/x_1^2 + 1)).maxima_methods().rootscontract().simplify()
view(t)
edit flag offensive delete link more

Comments

That is better. I don't suppose you know how to get rid of the last square root; i.e. x_1 instead of sqrt(x_1^2)?

BobB gravatar imageBobB ( 2012-02-25 18:39:34 -0500 )edit

I have updated the answer.

Shashank gravatar imageShashank ( 2012-02-25 18:45:49 -0500 )edit

Great! And for me, it would be a good idea to finish it off with: forget(x_1>0) so the end result can be used without the constraint. Feels a bit like cheating, avoiding the things that make you safe. But, that's what I was asking for! Thanks!

BobB gravatar imageBobB ( 2012-02-25 19:09:35 -0500 )edit

You have to remember that x_1 = sqrt(x_1^2) only if x_1 is positive. So the end result is actually abs(x_1). The end result cannot be used without constraint as x_1, if x_1 is actually negative.

Shashank gravatar imageShashank ( 2012-02-25 19:19:51 -0500 )edit

Real numbers are a subset of complex numbers. So if some property does not hold in general for real numbers it does not hold for complex numbers. Another way of looking at it is that a negative number is nothing but x_1exp(ipi) with a real x_1

Shashank gravatar imageShashank ( 2012-02-25 19:51:05 -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

Stats

Asked: 2012-02-25 17:57:32 -0500

Seen: 6,394 times

Last updated: Feb 25 '12