Metropoli BBS
VIEWER: allroots.all MODE: TEXT (ASCII)
Subject: Re: Unit Problems Solved! (Was:Re: Units Problems...
Organization: Purdue University Engineering Computer Network
Lines: 51

In article <1473@meaddata.meaddata.com>, mead!johnt@uccba.uc.edu (John Townsend) writes:
> 
> In article <9700@ccncsu.ColoState.EDU>,
> 
> This reminds me of when I first got my HP-28C when I was in college.  The first
> thing I did with it was "acid-test" it by calculating the cube root of -27.
> Every sixth-grader knows that the answer to this is simply -3, but most
> calculators (including every TI I've ever seen) gag on it.  Up to that time,
> the only calculator I'd seen give me a correct answer was a Sharp EL506-P that
> I'd gotten for about $10.  Well, my $200 28C coughed out "(1.5,2.59807621135)".
> "Bug!!!", I screamed.  Fortunately, before I could send any hate mail to HP,
> a friend of mine who was taking Complex Variables at the time reminded me that
> I was actually solving a cubic equation, which always has THREE correct answers
> in the complex number domain.  Turns out that the 28C returns the first of
> these (going around the complex plane counterclockwise from the X axis).  The
> other two solutions are (-3,0) and (1.5,-2.59807621135).  The 28C will cube all
> of these back into -27.  That sure raised by opinion of HP in a hurry!

This feature caused me enormous headaches when trying to debug a root solver
sometime back.  It never occured to me that a calculator might return a
complex cube root.

On the same topic, here is a program I wrote that finds ALL of the roots of
any real or complex number and puts them on the stack in order, as they are
arranged around the origin.

To solve X^(1/N) = Y for Y:

Input: level 2: X
Input: level 1: N

Output: roots in stack levels 1 to N

RTCX
<< -> z0 n
   << z0 ABS n INV ^
z0 ARG n / (0,1) *
EXP * (0,2) n / [pi] *
EXP -> m a
    << 0 n 1 -
       FOR k a k ^ m
* ->NUM ROUN          ;ROUN is optional
       NEXT
    >>
  >>
>>
-- 
Robert Yoder  306 Hawkins Graduate House, West Lafayette, IN 47906 (317)495-6845
Internet: ryoder@ecn.purdue.edu           "Flame all you want, We'll post more."
UUCP:     pur-ee!ryoder                         Apologies to Jay Leno & Doritos.
Bitnet:   ryoder@ecn.purdue.edu@purccvm.bitnet


[ RETURN TO DIRECTORY ]