Ask Your Question
1

square root

asked 2012-02-26 00:57:32 +0100

BobB gravatar image

updated 2012-02-26 01:17:45 +0100

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-26 01:23:02 +0100

Shashank gravatar image

updated 2012-02-26 01:42:03 +0100

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-26 01:39:34 +0100 )edit

I have updated the answer.

Shashank gravatar imageShashank ( 2012-02-26 01:45:49 +0100 )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-26 02:09:35 +0100 )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-26 02:19:51 +0100 )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-26 02:51:05 +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

Stats

Asked: 2012-02-26 00:57:32 +0100

Seen: 24,422 times

Last updated: Feb 26 '12