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:
- sqrt(-1) returns: SQRT(NEG)
- -1 .5 y^x returns: INVALID y^x
- sqrt(-1i0) returns: INVALID DATA
- -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.
|