The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

35s and SQRT of Negative Numbers
Message #1 Posted by Les Wright on 2 Oct 2008, 5:11 p.m.

Now this is an interesting curiosity of the 35s and I can imagine I am the first to spot it.

-3 SQRT gives an error.

So does -3 ENTER .5 y^x.

So does -3 i 0 SQRT.

But -3 i 0 ENTER .5 y^x gives the right answer.

The much older 15C gives the correct answer to -3 SQRT provided that flag 8 (complex mode) is enabled, and the 42S just gives the right answer automatically.

I read in a calculator app review in the iTunes App Store that the 35s can't give the square root of a negative number. It does, but you have to pose the question to the calculator very specifically.

Weird.....

Les

      
Re: 35s and SQRT of Negative Numbers
Message #2 Posted by Paul Dale on 2 Oct 2008, 5:35 p.m.,
in response to message #1 by Les Wright

This is known and has annoyed several others here too. Unfortunately, the 35s has a rather limited array of complex operations.

- Pauli

      
Re: 35s and SQRT of Negative Numbers
Message #3 Posted by Gene Wright on 2 Oct 2008, 5:50 p.m.,
in response to message #1 by Les Wright

Correct, and this is noted on page 6 of the HP 35s review in the Datafile Special Issue (July 2007) devoted to that machine when it was first introduced. :-)

You can find it here: 35s review in Datafile

Gene

      
Re: 35s and SQRT of Negative Numbers
Message #4 Posted by bill platt on 2 Oct 2008, 7:38 p.m.,
in response to message #1 by Les Wright

I don't think it is particularly annoying. To work in complex mode, the machine is designed to require complex arguments. For the sake of simplicity or something, it was decided to handle all complex roots and exponents using the same command (y^x).

This really isn't a big deal.

Yes, on the 15c, you get the right answer to a simple -3 SQRT as long as it is set to *complex mode* This is essentially doing the same thing as the 35, except that the mode is set by the argument type.

In either case, there is a clear distinction between "ordinary" mode and "complex" mode. This has its advantages for simplification of programming of many routines. It avoids complex arguments when they would not be expected nor desired as a result.

What is annoying is the difficulty or impossibility of composing and decomposing complex and reals--something for which the 15c (or 42s or 48 series) is properly equipped.

I know you know all this.

I am just being pedantic.

It is sort of fun once in a while :-)

Edited: 2 Oct 2008, 7:42 p.m.

      
Re: 35s and SQRT of Negative Numbers
Message #5 Posted by Egan Ford on 2 Oct 2008, 8:40 p.m.,
in response to message #1 by Les Wright

Quote:
Weird.....
How about lame. This may be forgivable if the 15C and the 42S had horrible complex number implementation, but they didn't, they totally rocked. 20 years later you'd think it would only get better.

I posted similar results here: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv017.cgi?read=119518#119518.

Human beings, who are almost unique in having the ability to learn from the experience of others,
are also remarkable for their apparent disinclination to do so.

-- Douglas Adams, Last Chance To See

Edited: 2 Oct 2008, 9:03 p.m.

      
Re: 35s and SQRT of Negative Numbers
Message #6 Posted by Hal Bitton in Boise on 3 Oct 2008, 12:30 p.m.,
in response to message #1 by Les Wright

With the 35S, what if one had the audacity to enter the negative number in polar form (ie, 3<180, or 3<pi), then raise it to the .5 power. Failing that, if one first converted the above polar cordinates to rectangular using P>R (it does have a P>R function, doesn't it?), would the resultant rectangular form be palatable to the 35s for nth root operations?
Best regards, Hal

            
Re: 35s and SQRT of Negative Numbers
Message #7 Posted by Walter B on 3 Oct 2008, 12:57 p.m.,
in response to message #6 by Hal Bitton in Boise

Quote:
With the 35S, what if one had the audacity to enter the negative number in polar form (ie, 3<180, or 3<pi), then raise it to the .5 power.
Works like a charm.
Quote:
if one first converted the above polar cordinates to rectangular using P>R (it does have a P>R function, doesn't it?), ...
Here you must be kidding. Or did you live on the moon the last 15 months?

Edited: 3 Oct 2008, 1:01 p.m.

            
Re: 35s and SQRT of Negative Numbers
Message #8 Posted by bill platt on 3 Oct 2008, 1:23 p.m.,
in response to message #6 by Hal Bitton in Boise

What Walter is getting at is that the R-P functionality of the 32sii has been replaced with a rather useless version to say the least! It uses the vector capabilities, but sadly the vectors cannot be composed/decomposed.

      
Re: 35s and SQRT of Negative Numbers (UPDATED)
Message #9 Posted by Karl Schneider on 4 Oct 2008, 2:07 a.m.,
in response to message #1 by Les Wright

Les --

When you posted that, I immediately thought of a similar post from last year, which I had bookmarked. It was Egan Ford's post of similar results; please see his reply before mine in this thread.

If you scroll a bit further in that archived post, you'll see my analysis of reasons for the behavior of that functionality in the HP-35s, along with a philosophical discussion.

Here's a more-direct explanation, incorporating Egan's findings:

Quote:
  1. sqrt(-1) returns: SQRT(NEG)
  2. -1 .5 y^x returns: INVALID y^x
  3. sqrt(-1i0) returns: INVALID DATA
  4. -1i0 .5 y^x returns: 0i1, finally.

    It should not be this hard.


On the HP-35s (as well as on the HP-33s, HP-32SII, and HP-32S):

The square root function is defined only for a domain (input) and range (output) of real-valued numbers in that format. This has the effect of restricting valid input to non-negative real values.

Thus, tests 1 and 3 fail for obvious reasons.

y^x -- which also provides a general-purpose capability for complex-valued sqrt, x2, and y^(1/x) -- is programmed so as to give only real-valued output (where mathematically defined) for real-valued input 'y', and only complex-valued output in that format for complex-valued input 'y'. (Input 'x' can be either real-valued or complex-valued on the HP-35s.) The user does not have the option of obtaining complex-valued output for real-valued input 'y', as the HP-15C and HP-42S provide.

Internally, y^x is calculated using the familiar theorem: y^x = exp(ln(y^x)) = exp(x ln y)

The data type of 'y' -- complex or real -- determines what algorithm is used to calculate 'ln y'.

Test 2 fails because 'y' is real-valued, but 'ln y' has no real-valued result.

-- KS

Edited: 4 Oct 2008, 5:11 p.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall