Re: HP 50G Cube Root of Negative Message #6 Posted by C.Ret on 15 Oct 2008, 5:46 p.m., in response to message #1 by Hal Bitton in Boise
Quote: Is there any way to make the 50G return the real cube root of a negative number?
Hi,
I have no HP50G, only a HP28S. As your 50g, my 28S returns one of the two conjugate solution when keying 8 CHS 3 INV ^ > (1.0000,1.7324)
A first way to get only the real root is to use the SOLVER menu or the ROOT function:
'y^3=8' 'y' 0 ROOT > 2.000
A short program may spare same keystrokes:
\<< 'y' DUP 3 ^ ROT = SWAP 0 ROOT \>> 'RCRt' STO
Stack:
1: 8 [RCRt] > 1: 2.0000
1: 27 [RCRt] > 1: 3.0000
1: 125 [RCRt] > 1: 5.0000
1: 125 [RCRt] > 1: 5.0000
This little code determine the real cube root of any positive, null or negative real number at stack level 1:.
Any complex number may lead to an "Bad Guess(es)" error stop, as ROOT may only handle real number.
A second easy way to get the real cubic root may be using absolute value of the negative number to avoid switching to complex solutions domain :
8^(1/3) returns 2.000 which may be sign changed in 2.0000
\<< DUP SIGN SWAP ABS 3 INV ^ * \>> 'CRt' STO
Stacks:
1: 8 [CRt] > 1: 2.0000
1: 27 [CRt] > 1: 3.0000
1: 125 [CRt] > 1: 5.0000
1: 125 [CRt] > 1: 5.0000
This second version is faster than the first one. Giving a complex number as entry returns a complex number
Edited: 15 Oct 2008, 6:02 p.m.
