HP Forums

Full Version: Dangerous factorization
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I was doing some calculations on 50g and have noticed a numerical error that happens sometimes. I narrowed it to this:

consider x sqrt (-x). Substituting x with -1 gives -1. Now use FACTOR on the expression to get
i sqrt(x) ^ 3. Now, substituting x with -1 yields 1!!

Is this a bug in CAS?

No, it's an ambiguity in the square root function. The square root function is double-valued (if x^2=c, then (-x)^2=c as well) and it isn't possible to make it single-valued over the whole complex plane without having a discontinuity somewhere. This type of discontinuity is called a branch cut. From memory, the HP-50g makes the standard choice of having the cut along the negative real axis. So you'll find that it gives sqrt (-1) = i , sqrt (-1 + 0.000001 i) = i (roughly) but sqrt (-1 - 0.0000001 i) = -i (roughly).

This discontinuity means that equations like sqrt(ab) = sqrt(a) sqrt(b) are not necessarily true (e.g., try this with a = b = -1 + i on your HP-50g) and will sometimes not work. It's arguable that FACTOR on the HP-50g should be aware of the problem and refuse to do a rearrangement that might not work, but whether it works or not depends on the values of a and b which the calculator might not know.

Nigel (UK)

Absolutely correct and well explained. The 41Z yields exactly the same results to the examples you supplied - as a consequence of always choosing the main value of the logarithm function (the one with the argument between -pi/2 and pi/2) - as there's always a logarithm involved in the calculation of a square root.

Same fun happens calculating inverse trigonometric functions, also due to their logarithm expressions.

Cheers,
'AM