Dangerous factorization « Next Oldest | Next Newest »

 ▼ Juraj O. Junior Member Posts: 8 Threads: 3 Joined: Nov 2012 01-09-2013, 02:54 PM 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? ▼ Nigel J Dowrick Member Posts: 167 Threads: 13 Joined: Sep 2008 01-09-2013, 04:00 PM 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) ▼ Ángel Martin Posting Freak Posts: 1,253 Threads: 117 Joined: Nov 2005 01-10-2013, 03:14 AM 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

 Possibly Related Threads... Thread Author Replies Views Last Post Prime Factorization for the HP15c? JamesT 2 420 09-29-2011, 10:29 AM Last Post: JamesT hp48, factorization Sok-khieng Chum Hun 15 1,329 03-05-2010, 05:34 AM Last Post: Hal Bitton in Boise Prime factorization in the 48GX Hal Bitton in Boise 8 781 07-16-2008, 12:53 PM Last Post: Joe Horn

Forum Jump: