HP Forums
SQRT(X^2) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: SQRT(X^2) (/thread-4227.html)



SQRT(X^2) - Marcelo Vanti - 06-25-2015 12:48 PM

Hello ,
I knew SQRT (X ^ 2) = ABS ( X) , and this result is what I got with the HP 50G calculator CAS. With PRIME, however, I have X as a result, which does not seem right . Does anyone know why this happens ? May I be using a wrong setup?
still , I found a nice thread about of this topic here.
http://math.stackexchange.com/questions/258876/proving-square-root-of-a-square-is-the-same-as-absolute-value

Marcelo


RE: SQRT(X^2) - Tim Wessman - 06-25-2015 03:03 PM

In the latest release (2015.06.17 r8151) I type in √(x^2) and press ENTER in the cas screen and get abs(x).

You up to date? Or doing some other procedure?


RE: SQRT(X^2) - Maro - 06-25-2015 03:28 PM

(06-25-2015 03:03 PM)Tim Wessman Wrote:  In the latest release (2015.06.17 r8151) I type in √(x^2) and press ENTER in the cas screen and get abs(x).

You up to date? Or doing some other procedure?

latest release (2015.06.17 8151): in CAS √(x^2) results in x, but not abs(x)


RE: SQRT(X^2) - Marcelo Vanti - 06-25-2015 04:03 PM

Tim , thank you.
I redid the same procedure on the emulator ( I should have tried before) and got the right result - abs ( x ) . Then I checked CAS settings on the calculator. I had " use i" set. This caused the apparent error, but I don't now why.
I still need to learn a lot about the CAS operation.


RE: SQRT(X^2) - parisse - 06-25-2015 04:12 PM

This is not an error. sqrt(x^2) is different from abs(x) if x is complex non real. This is the reason why the system chooses the x branch.


RE: SQRT(X^2) - Marcelo Vanti - 06-25-2015 04:42 PM

(06-25-2015 04:12 PM)parisse Wrote:  This is not an error. sqrt(x^2) is different from abs(x) if x is complex non real. This is the reason why the system chooses the x branch.

Thanks for the explanation. Now it becomes clear to me.


RE: SQRT(X^2) - Tugdual - 06-25-2015 07:30 PM

While the 50g doesn't simplify to x when Complex is ticked.
I think I finally understood why there is this "rigorous" flag.


RE: SQRT(X^2) - retoa - 11-19-2015 08:13 AM

One more reason not to take away the "Use i " feature !!


RE: SQRT(X^2) - Tim Wessman - 11-19-2015 04:02 PM

(11-19-2015 08:13 AM)retoa Wrote:  One more reason not to take away the "Use i " feature !!

Actually, argument for it. Too many people keep turning it on an have no clue what it does, and it "screws up" all sorts of calculations in an unexpected way.


RE: SQRT(X^2) - parisse - 11-19-2015 07:17 PM

My opinion is remove it from the settings, but keep the command for advanced users:
complex_mode:=1
complex_mode:=0


RE: SQRT(X^2) - Helge Gabert - 11-19-2015 11:48 PM

I just want to caution that "complex_mode" and "use i" are not the same with rev. 8151.

complex_mode:=0
factor (x^2+4,x) returns (x+2*i)*(x-2*i)

"use i" check off

factor (x^2+4,x) returns x^2+4

Looks like "complex_mode" is not implemented.


RE: SQRT(X^2) - retoa - 11-20-2015 08:11 AM

The setting that gives me more trouble is the CAS "Complex" setting (the one above "Use i" to be clear). The help says "Include complex results in variables" but I do not fully understand what it does.

Can someone post an example of a result/solution that will be different if "Complex" is checked or not?


RE: SQRT(X^2) - parisse - 11-20-2015 09:11 AM

complex_mode:=0 or 1 is available in Xcas, it could be available on the Prime, instead of beging in CAS Settings.


RE: SQRT(X^2) - hpfx - 11-20-2015 11:06 AM

(11-20-2015 09:11 AM)parisse Wrote:  complex_mode:=0 or 1 is available in Xcas, it could be available on the Prime, instead of beging in CAS Settings.

Will it be displayed on top of the screen ?
yes, because having a CAS settings also showed us in which mode we are.
if you remove it, please at least add "i" indicator next to "CAS" one, on top of the screen !


RE: SQRT(X^2) - Helge Gabert - 11-21-2015 07:56 PM

(11-20-2015 08:11 AM)retoa Wrote:  The setting that gives me more trouble is the CAS "Complex" setting (the one above "Use i" to be clear). The help says "Include complex results in variables" but I do not fully understand what it does.

Can someone post an example of a result/solution that will be different if "Complex" is checked or not?

Well, I tried (with "Complex" on and off to evaluate sqrt(sqrt(x*i+y)) to see if there were any differences, but, unfortunately, the Prime hangs (Emulator, too).


RE: SQRT(X^2) - parisse - 11-22-2015 07:43 AM

Indeed, you have found a bug inside giac (access to a null pointer). I'm fixing it, and I will also add a test to avoid rewriting the sqrt as real part/imaginary part in this case, because otherwise it returns a very complicated answer : not surprising for an advanced user, you are working with 2 variables and taking twice a sqrt of a complex number, but probably to easy to run for a normal user.


RE: SQRT(X^2) - Helge Gabert - 11-22-2015 06:10 PM

Thank you for checking into that.

But to get back to the above question (difference between "complex" flag on/off), this example works

1. 4root (x+i*y)
2. Ans^2
3. simplify()


RE: SQRT(X^2) - retoa - 11-22-2015 06:48 PM

(11-22-2015 06:10 PM)Helge Gabert Wrote:  Thank you for checking into that.

But to get back to the above question (difference between "complex" flag on/off), this example works

1. 4root (x+i*y)
2. Ans^2
3. simplify()

Now I see

Thank you very much !!!