# HP Forums

Full Version: hyperbolic curiosity
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I just read a brilliantly written article by William K. Robinson that describes how it was a major revolution in time saving for engineers back in the 1940s when the first slide rule was created that could perform hyperbolic functions on complex numbers. Out of curiosity, I tried comparing my various calculators to see which machines could perform a similar function. My HP-49g+ with ROM version 2.09 was able to accept complex numbers as inputs for the SINH() function, but I was not able to get results that matched the numbers that had been generated by the super slide rules from a bygone era.

Perhaps I just have the modes or units wrong. The author reported getting sinh(0.243 + 53.5*i) = (0.14597, 0.82771) using lookup tables, or (0.146, 0.828) using a K&E 4083-3 slide rule. My results with the HP-49g+ were as follows:

In degrees mode, I had (-0.2443, -0.0955).

Those first results were obtained while the calculator's coordinate system had been set to rectangular. I tried changing the coordinate system to polar, with the following results:

In degrees mode, I had (0.2624, <-158.6).

I am using the "<" symbol to represent the angle symbol in the calculated results.

None of the results seem to match the numbers produced by the expert, and considering the quality of his article, I cannot imagine that the author was likely to have made a mistake. He worked the same example using several different methods, with different strategies for dealing with the differently arranged scales that had been designed by different manufacturers, and he always obtained the same result that agreed with his hand calculation by interpolating from lookup tables.

So, the question is, how do we get an HP-49g+ or HP-50g to produce the same answer?

I already know how to do this with a TI-89 calculator. I simply key in the complex number as an argument for the hyperbolic sine function, and read the words "Domain error" in the display.

William Robinson's article is at this link:

http://ww2.hyperbolicsliderules.com:8110/ArticleForWeb/SRwithHyperbolicScales.htm

Try this:

```.243 53.5 D->R R->C SINH
```
On my 50g I get (.146, .828) just as in the article.

The problem is sinh(u+jt) with u=.243 and t=53.5degrees ~ .934 rads so we want to compute sinh(.243, .934) .

kiyoshi

My 42S tells me that ASINH(0.14597 + i 0.82771) = 0.243 + i 0.9338. I noted 0.9338 radians equals 53.5 degrees. The real part matches the real part of the original argument and converted to degrees, it would be 13.923. So is it possible that the author started out with (13.923 + i 53.5) degrees, converted that to (0.243 + i 0.9388) radians, found the result on his slide rule, but then mis-wrote the original argument, mixing the real part in radians with the imaginary part in degrees? Or did the slide rule "expect" the arguments to be input that way? (I'm just speculating, I did not consult the article.)

Thanks! That works. I had forgotten that only the second number should be converted from degrees into radians. Now I am curious to see which other calculators can perform the same function. The TI-89 seems like a possible "no" but I am not certain yet.

Imagine needing to spend half of an hour, and perform hand calculations using pencil and paper (after consulting tables) in order to do this for a single case.

Good point. It looks as if the convention back then was to use polar coordinates. I do not have a hyperbolic slide rule to check it out with yet, but I found this amazing "calculator" emulator:

http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html

When you go to this URL, you can click and drag on the objects to make the simulation work.

It looks as if the convention was to provide scales for SINH() from about 0.1 degree to 3.0 degrees. If you needed to perform SINH() for smaller angles, then the angle in degrees would be approximately equal to the SINH value. If you needed to compute SINH() for larger angles, the answer would be approximately equal to e to the x quantity divided by two, so you would just use the logarithm scales for larger angles.

Quote:
Now I am curious to see which other calculators can perform the same function.

15C (circa 1985):
```SF 8                          ; Set Complex Mode
.243 ENTER 53.5 f I           ; Enter Complex Number
f HYP SIN                     ; sinh, (use Re<>Im to see both parts)
```
returns: -0.2443, -0.0955

```SF 8                          ; Set Complex Mode
.243 ENTER 53.5 ->RAD         ; Enter Complex Parts, Convert Im to RAD
f I                           ; Create Complex Number
f HYP SIN                     ; sinh, (use Re<>Im to see both parts)
```
returns: 0.1460, 0.8277

Get a 15C. :-)

A beautiful lady surprised me by giving me a 15C recently after she had seen some of the other calculator's in my collection. I will learn how to use it a little more each day. Now I know how to set the flag to enable complex mode.

The little 15C could qualify as being the smallest physical machine that can perform the function, even after all these years. The Pickett N4P-ES slide rule either comes close, or it could be the winner in terms of mass. The N4P-ES is a shirt pocket sized hyperbolic slide rule that is similar to the N600-ES that was carried on board five Apollo missions. The N600-ES had slightly less mass, but it did not include hyperbolic scales. On Apollo 13, they just needed to do circular trig functions to navigate, so it worked well enough when they were in a bizarre situation.

I suspect you are maligning the TI-89! I don't have mine here, but my TI-Nspire (stop laughing!) is quite prepared to find the hyperbolic sine of a complex argument. (It gives the same result as the HP 49/50.) With the TI-89, did you (a) have it in a complex mode, and (b) have it in radians? Sometimes this matters when working with complex numbers on the TI.

Whatever you think about TI calculators, the TI-85, 86 and 89 are very capable machines. I would be astonished if the TI-89 couldn't cope with this!

I have an nspire without CAS (blue case) around here somewhere. Perhaps it is hiding from this problem. Is your nspire the blue or the gray CAS machine? I also have an 84+SE, 85, 86 (same machine, more memory) 89, 92+, and Voyage 200 (same machine with more memory and cramped keyboard).

I suspect that my venerable old TI-59 might be able to support this function with programs that are included in the standard library module that shipped with every machine. I do not know about the HP-41C standard library (yet), but I would imagine that this complex hyperbolic functionality would have been included in the thousands of programs that have been available for that machine from many sources. I wonder how well the 41C compares to the little 15C in this respect.

So far, I have only been able to get my Voyage 200 to give me a domain error, and of course, the same thing happens on the 89. I don't have any of the newer Casio super machines around here, but I wonder whether any of those calculators can do this. Perhaps a Classpad, or an Algebra FX would work. It still blows my mind that the little 15C could do this so long ago, and this was a built in function, not an add-on program.

Quote:
It still blows my mind that the little 15C could do this so long ago

Those were the days, my friend, where calculators had to do almost everything, since PCs were not capable yet doing reasonable stuff though very expensive, and you wouldn't like to run to a mainframe terminal for every small calculation.

Ceterum censeo: HP, launch a 43s.

Walter

Quote:
It still blows my mind that the little 15C could do this so long ago, and this was a built in function, not an add-on program.

What blows my mind is that I cannot do this on the state-of-the-art circa 2007 35s. Correct me if I'm wrong people, but I have 0.23400i0.93375 on the stack and HYP SIN returns INVALID DATA.

My Voyage 200 does it. I had to set it to complex (rectangular) mode and could type in:

sinh(.234+i*53.5°)

and got the correct result.

Marcus

I tried that, and it did not work. Then, I also changed from degrees mode to radians mode. That fixed it. The Voyage 200 has a big screen, so there should be plenty of room for an error message that says "I cannot do this unless you put me into radians mode." Instead, the error message says "Domain error."

Thanks for helping me to keep trying. I am quite fond of my Voyage 200. Yes, it has many odd quirks, but in general I find it very easy to use, self explanatory, especially in writing quick programs to analyze data without ever needing to worry about whether the program will do what is expected on the first run.

The TI-84 does not seem capable of doing this function. I managed to coax my blue nspire out from behind a desk where it had been hiding, and it was able to handle complex numbers in the sinh function. The gray nspire should be equally capable. No word is available yet on whether a Casio can do this.

I wonder, what would be the least expensive machine that can do this function, of any brand?

I found that the following formula works for any scientific calculator that has hyperbolic functions:

Sinh(x+iy) = Sinh(x)Cos(y)+(i)Cosh(x)Sin(y)

It requires a few more steps, but it can get the job done. If you find other machines, TI, HP, Casio, or others that do this directly as a built in function, please let me know.

The test problem is sinh(0.243 + i*0.93375).
The answer should be (0.14597 + i*0.82771).

I tried reading my HP-41c manual. There does not seem to be any way to compute the sinh(x+iy) function. Anyone more familiar with the machine, please correct me if this is not true.

In my collection, so far I have used the following machines to work the example successfully:

HP-15c
HP-39gs
HP-40gs (same machine with CAS)
HP-48gx
HP-49g+ (good version with excellent keyboard)

My TI-89 and TI Voyage 200 can do this, but only in radians mode.
Both my TI-nspire machines can do this, with or without CAS.

My TI-84+SE refused to accept anything except real numbers as inputs for the sinh function. I was able to track it down, and retrieve it from where it had crawled away to hide under a book, possibly to escape from this problem.

My TI-59 battery pack has finally gone flat line, so I have no way to test that until after a bit of surgery. Note. Never turn on a TI-59 while it is connected a power supply with no working battery pack installed to smooth out the rectified AC inside the calculator. Always leave the calculator power switch off (with tape) while charging, and then remove the power supply before turning the power on. This will prevent a boat load of problems from ever developing with the card reader's rate calibration.

I have a cheap little Casio FX-115ES that can multiply and divide complex numbers, but it does not know how to use complex numbers as inputs for trig functions, either circular or hyperbolic. It isn't half bad for fifteen bucks, but it would have been nicer if the designers had fully supported complex number operations.

So far, it looks as if the least expensive machine that can fully support complex numbers might be the HP-39gs, unless there is some other Casio or similar machine out there that I do not know about.

Bill --

There are so many comments and observations in this thread about the very topics that I've posted about in the recent and more-distant past, I hardly know where to start. I'll need to make multiple replies...

Many people noticed that the H-P models give the same answer in degree or radians mode. Your last post in this thread indicates why: Hyperbolic functions take inputs that are not angles and must be dimensionless. Thus, radians mode is assumed. The basic formulae for computing sinh or cosh of a complex-valued input are quite similar to the familiar "sum of angles" formulae for sine and cosine. In these formulae, hyperbolics are computed for each part of a complex-valued input, but the following identities are substituted to simplify a complex-valued calculation to elementary functions of reals:

cosh(ix) = cos(x)

sinh(ix) = i*sin(x)

I find it curious to enter a complex-valued argument in rectangular coordinates, but with the imaginary part as an angle. However, that's the input form the author clearly indicates. Maybe that's how these slide rules were designed.

I'm surprised that the TI-89 wouldn't accept a complex-valued input to sinh or cosh. I'll have to check with my TI-using younger colleagues... Is there a "complex" mode?

-- KS

Edited: 15 Oct 2008, 2:33 a.m.

Hi again, Walter --

Quote:
It still blows my mind that the little 15C could do this so long ago

Those were the days, my friend, (...)

Alas, they did. See Egan's post below.

-- KS

Edited: 15 Oct 2008, 3:06 a.m.

FWIW, I brought your problem to a Casio fx-991ES, and it caused a Math Error there. Looks like this machine is little better than your "cheap little Casio FX-115ES".

Ceterum censeo: HP, launch a 43s.

Walter

Hi, Egan --

Quote:
What blows my mind is that I cannot do this on the state-of-the-art circa 2007 35s. Correct me if I'm wrong people, but I have 0.23400i0.93375 on the stack and HYP SIN returns INVALID DATA.

You're not wrong, and I've mentioned a few times in the past that complex-number functionality on the HP-35s is mathematically incomplete: Hyperbolics, x2 and sqrt, inverse trigonometrics, and other functions are not supported.

This shortcoming can be traced historically as follows:

HP-41 Math Pac (1980) --> HP-32S (1988) --> HP-32SII (1991) --> HP-33s (2004) --> HP-35s (2007)

-- KS

Edited: 15 Oct 2008, 3:06 a.m.

Hi again, Bill --

Quote:
I do not know about the HP-41C standard library (yet), but I would imagine that this complex hyperbolic functionality would have been included in the thousands of programs that have been available for that machine from many sources. I wonder how well the 41C compares to the little 15C in this respect.

The HP-41 Math Pac ROM of 1980 provided rudimentary hyperbolics and complex-number functionality for the HP-41, implemented as RPN keystroke programs. The Math Pac is also available on the combined-module HP-41 Math/Stat Pac. Almost all of the math Pac complex-number functionality was ported to the HP-41 Advantage Pac.

Here are several posts of mine from a few years ago:

-- KS

Edited: 15 Oct 2008, 2:57 a.m.

Quote:
If you find other machines, TI, HP, Casio, or others that do this directly as a built in function, please let me know.

I did the specific problem in this thread successfully with the TI-95 Mathematics module.

Hyperbolics with complex numbers are not available with the TI-59 Master Library.

This subject was addressed earlier this year in a thread "Complex number capability in non-HP machines" dated 5 July 2008. You can access it at http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=138627#138627

Quote:
I have a cheap little Casio FX-115ES that can multiply and divide complex numbers, but it does not know how to use complex numbers as inputs for trig functions, either circular or hyperbolic. It isn't half bad for fifteen bucks, but it would have been nicer if the designers had fully supported complex number operations.

The Casio FX-115ES is a slightly-improved successor to the Casio FX-115MS, which I also bought a few years ago for \$15:

-- KS

I tried it on my classpad 300 plus and it worked. Settings are RAD and COMPLEX. I had to use the approx icon in the upper left corner of the screen to see a numerical result.

What bothers me is the reasoning behind a complex number with an angle in degrees as the imaginary part. I can't see any use for such a number.

Karl, you can set the TI machines to either REAL, RECTANGUALAR or POLAR. In REAL mode you get the domain error. RADians mode seems to be the other prerequisite.

Quote:
HP-41 Math Pac (1980) --> HP-32S (1988) --> HP-32SII (1991) --> HP-33s (2004) --> HP-35s (2007)

I'd assumed (sans Math Pac) that was the case or perhaps 11C -> 32S.

Sadly, from my point of view:

```41CX ---.                    .-----> 28 -----> 48  (RPL Fork)
>------> 42S ------<
15C  ---'                    '-----> NONEXISTENT   (RPN Fork)
```

Quote:
I wonder how well the 41C compares to the little 15C in this respect.

IMHO, the 41C family when initially released was more computer than calculator. And like a computer you need to tailor it for your purpose with the addition of software. That said, take a look at 41Z (2005). This modern module for the 41C family adds 15C/42S-like complex number support.

E.g.:

```   15C                 41C/41Z
---------         -----------------
OFF
SF 8              Insert 41Z Module
ON
.243              .243
ENTER             ENTER
53.5              53.5
f I               X<>Y
f HYP SIN         ZSINH
```
41Z similar to the 42S will display a nicely formatted:
```Z:0.1460+0.8277J
```

My Inspire is also the non-CAS variety (blue case). My Casio fx-9860G slim won't do this problem; arithmetic, logarithms, and exponentials are the only functions that accept complex arguments. (Which is rather silly: if you are implementing complex exponentials and logarithms, the extension for trig/hyperbolic functions is simple.)

So the TI's do the problem (when set to radians mode); Casio calculators don't seem to (I don't know about the Classpad); some HPs do and some don't.

I wonder why TI doesn't make more of this in its advertising? People who buy scientific calculators have probably heard of complex numbers; the ability to handle complex arguments correctly would surely be a selling point, whether or not the ability was actually needed!

References to previous discussion are greatly appreciated, and have been interesting reading. Thanks.

I noticed that my old TI-85 can handle this type of problem, and it does not care whether it is set in radians mode or degrees mode. I am looking at the slide rules, and trying to figure out why the imaginary part was an angle. William Robinson's article talks about how the slide rules were made for simplifying solutions to particular types of important problems such as when modeling the stability of a vibrating aircraft, perhaps. His article might contain clues as to why the imaginary part was an angle. I could break down and ask the author about the slide rules. He might be more likely to know why than any other living person.

I guess the reason why this topic has me perplexed is that there are many modern calculators that do not support this function, and yet in 1946 people were doing this with slide rules to such an extent that multiple scales on the slide rules were carefully arranged so that a user could do this job with as few physical movements as possible. We tend to forget too much of what had been mastered long ago.

Egan --

I failed to clearly state that I was referring only to complex-number functionality, not the developmental lineage of the respective models.

I believe that the complex-number functionality of the HP-41 Math Pac was the template for what was implemented in the HP-32S. The similarities -- what's present and what isn't -- are too strong to ignore. It's a usable capability that is not complete like that of the HP-42S. Had to preserve that product differentiation for the considerable difference in price!

A small quibble with your tree: The HP-28C and HP-28S preceded the HP-42S by a year or two, so the developmental process overlapped. The HP-42S had the capability of displaying and assembling complex numbers in polar form, while the HP-28 supported only rectangular form, despite its dot-matrix display. The subsequent HP-48 (1990) brought the RPL branch up to par in that respect.

Egan --

Is the 41Z module Angel Martin's "Sandbox ROM" project? If you follow the "Hyperbolics with Advantage" thread linked in my post directly above yours, you'll see where he was working on it in 2004.

I'm not sure how feasible it would have been, but maybe an HP-15C style "parallel imaginary stack" solution would have worked for the HP-41. This would have provided a full 4-level stack with complex-valued arguments.

Quote:
41Z similar to the 42S will display a nicely formatted:
```Z:0.1460+0.8277J
```

I assume that the displayed value is constructed in the ALPHA register, and that the two components are in the x- and y-stack registers. The "J" ought to precede the imaginary-part component (per electrical engineering and HP-42S convention), lest it be overlooked. "J" stands out better than "I", particularly without good lowercase letters.

-- KS

Quote:
His article might contain clues as to why the imaginary part was an angle. I could break down and ask the author about the slide rules. He might be more likely to know why than any other living person.

Back in the early part of the 20th century, solution of networks didn't use the matrix methods we use today. The more modern methods were initially due to Feldtkeller in about 1930. Methods developed by the Bell Labs researchers were used, emphasizing the transmission properties of networks.

Kennelly (of Kennelly-Heaviside layer fame) published many papers on the use of hyperbolic functions, and he even wrote a book, "Hyperbolic Functions Applied to Electrical Engineering", circa 1912.

He showed that the solutions to the voltages and currents along a transmission line (power or telephone) were given by hyperbolic functions.

The hyperbolic functions are considered to be analogous to the circular trig functions, sin, cos, tan, etc.; they are just a different type of trig function. The hyperbolics are combinations of exponentials, and as we know, EXP(x + iY) = EXP(x)* (COS(y) + i SIN(y)); that is, the imaginary part of the argument (x + iy) is the argument to sin and cos functions, normally considered to be angles. The real part is just an attenuation constant. And, of course, in engineering work, it's common to measure angles in degrees.

Kennelly even referred to the length of a transmission line as its hyperbolic angle.

Edited: 17 Oct 2008, 10:30 p.m. after one or more responses were posted

Quote:
Is the 41Z module Angel Martin's "Sandbox ROM" project?

No, its a standalone module.

Quote:
I'm not sure how feasible it would have been, but maybe an HP-15C style "parallel imaginary stack" solution would have worked for the HP-41. This would have provided a full 4-level stack with complex-valued arguments.

Angel mentions in the docs that could have been done, but was not.

Quote:
I assume that the displayed value is constructed in the ALPHA register, and that the two components are in the x- and y-stack registers.

Correct. Z functions end with a call to ZVIEW.

Read the 41Z PDF from TOS, its quite impressive.

Karl,

Quote:
"J" stands out better than "I", particularly without good lowercase letters.

Don't cure the symptoms, fight the root cause. Create good lowercase letters or other suitable layouts to let the "i" show up clearly.

Ceterum censeo: HP, launch a 43s.

Walter

Thanks for explaining why the functions need angles for the imaginary component. The author of the slide rule article probably still has a copy of Kennelly's book from 1912 safely tucked away, and I imagine it probably has well worn pages.

Karl covered some of this in an earlier post. I don't have an HP-35s to try this with, but it should cover all of the bases for that and some of the Casio machines:

sinh(x + i y) = sinh(x) cos(y) + i cosh(x) sin(y)

cosh(x + i y) = cosh(x) cos(y) + i sinh(x) sin(y)

tanh(x + i y) = (tanh(x) + i tan(y))/(1 + i tanh(x) tan(y))

arcsinh(x + i y) = ln((x + i y) + sqrt((x + i y) (x + i y) + 1)

arccosh(x + i y) = ln((x + i y) + sqrt((x + i y) (x + i y) - 1)

arctanh(x + i y) = (1/2)*ln((1 + (x + i y))/(1 - (x + i y)))

ln(x + i y) = ln(sqrt(p*p+q*q)) + i ((pi*q)/(2*abs(q)) - arctan(p/q))

I hope the format is readable.

I used incorrect variables for the last entry for complex logarithms. The correct form should be as follows:

ln(x + i y) = ln(sqrt(x*x+y*y)) + i ((pi*x)/(2*abs(y)) - arctan(x/y))

No jokes about minding my p's and q's.

Good grief, this is just one more step of correction:

ln(x + i y) = ln(sqrt(x*x+y*y)) + i ((pi*y)/(2*abs(y)) - arctan(x/y))

This one seems correct, but I would appreciate it if anyone would try it independently, and check the result, especially using an HP-35s against something like a 49g+, or 50g.

Grrr.

Now, we can see why it is nice to have this functionality already built into a machine.

Easycalc, on any palm pda, gives 0.1459688 + i*0.927706645.

This is my favorite calculator on the pda. It has an amazing amount of power - reals, complex, vectors, matrices, functions up the wazoo (special functions listed below), programmability (I implemented the Lanczos log of gamma function), and it is free!

I know it it neither HP nor rpn, but I find it incredibly useful.

Features and Specifications:

* IEEE-754 double precision math routines, courtesy of MathLib.
* Support for color, OS 5.x and DIA (Dynamic Input Area).
* Algebraic (not RPN) entry.
* Range of values: +/- 1E-308 to +/-1E308 (IEEE 754 double precision); up to 15-digit (user-selectable) decimal precision.
* 150 built-in functions including: trigonometry, complex numbers, exponential, probability, statistics, numerical analysis of functions (roots, derivatives, integrals, intersection), discrete math, digital signal processing, list, matrix, and special.
* Unlimited user-defined variables and functions.
* Multipe levels of nested parentheses limited only by available stack memory.
* Multiple screens easily categorize functions.
* "ANS" button (last result).
* Scrolling history.
* Integer Base Operations: Decimal, Binary, Hexadecimal, and Octal.
* Display Formats: Normal, Scientific and Engineering display modes.
* Automatic parentheses matching.
* Full PalmOS clipboard support.
* Complex number support in all functions.
* Graphics:
o Normal (Cartesian), polar, and parametric graphs.
o Graph up to six functions simultaneously with trace and numerical analysis.
o Graphs have user definable colors, axes, axes lables, range, grid, log and log-log.
o "Table Mode" of graph function values.
o Zoom in/out.
o Live screen scrolling.

Special functions:

Function Name Name in EasyCalc
Euler Gamma gamma(z)
Beta beta(z:w)
Incomplete Gamma igamma(a:x)
Error erf(x)
Complementary Error erfc(x)
Incomplete Beta ibeta(a:b:x)
Bessel 1st Kind besselj(n:x)
Bessel 2nd Kind bessely(n:x)
Mod. Bessel 1st Kind besseli(n:x)
Mod. Bessel 2nd Kind besselk(n:x)
Incomplete Elliptic Integral 1st kind elli1(m:phi)
Incomplete Elliptic Integral 2nd kind elli2(m:phi)
Complete Elliptic Integral 1st kind ellc1(m)
Complete Elliptic Integral 2nd kind ellc2(m)
Jacobi sn sn(m:u)
Jacobi cn cn(m:u)
Jacobi dn dn(m:u)

Quote:
Easycalc, on any palm pda, gives 0.1459688 + i*0.927706645.

There's a typo here isn't there? Shouldn't the result be 0.1459688 + i*0.827706645?

Also, it looks like you're only getting about 5 or 6 correct digits. Can you do the complex SINH calculation in double precision?

What does Easycalc get for TAN(1.57079), in radians mode? In both single and double precision, if available.

Bill --

Quote:
Good grief, this is just one more step of correction:

ln(x + i y) = ln(sqrt(x*x+y*y)) + i ((pi*y)/(2*abs(y)) - arctan(x/y))

This one seems correct, but I would appreciate it if anyone would try it independently, (...)

A clearer rearrangement is:

1. ln(x + i y) = ln(sqrt(x*x+y*y)) + i ((pi/2)*(y/abs(y)) - arctan(x/y))

A further simplification is use of the signum function, but it is unavailable on any H-P model that lacks built-in complex-number support, so that's a moot issue.

2. ln(x + i y) = ln(sqrt(x*x+y*y)) + i ((pi/2)*(sign(y)) - arctan
(x/y))

Both of these expressions would cause a divide-by-zero error for y = 0. However, the expression is unnecessary for that case, which indicates a real-valued input.

Those who are familiar with Fortran and C/C++ language might construct it using the atan2 function as:

3. ln(x + i y) = ln(hypot(x,y)) + i (atan2(y,x))

"hypot" and "atan2" are the functions of rectangular-to-polar conversions. Here, "angle" is returned in radians, and a "ln" is also incorporated. It's not surprising that calculators would use the same code for both. Have a look at this archived post of mine:

However, it's not simply conversion per se; the form of the output is still rectangular.

So, on the HP-11C, for example, ln(x + i y) would be:

```(y)
ENTER
(x)
->P
LN
```

In summary, on a calculator without complex-number support, rectangular->polar conversions, or signum, I'd use equation 1, with an exception for y = 0 to return ln(x) in place of x.

What do you think might be the best way to calculate the polar-format natural logarithm of a polar-format complex number? Don't forget to put the input number into proper form, don't neglect input and output angular mode, and don't do any unnecessary calculations!

Quote:
Now, we can see why it is nice to have this functionality already built into a machine.

Yes, indeed...

;-)

-- KS

Edited: 20 Oct 2008, 1:28 a.m. after one or more responses were posted

Karl,

In the expression for natural logarithm, the angle for the imaginary part would be simply the arctan of y over x, but that would not work in every quadrant. To fix that, and make it work for other quadrants, the expression uses arctan of x over y intentionally. In the quadrants of interest, 180 degrees minus the arctan of x over y is the same thing as the simpler arctan of y over x, except that when combined with the term for the signum of y the larger expression can work for all four quadrants.

I switched to using the abs function because I was not confident that most scientific calculators that are not programmable would include a signum function, and you can get the same result by dividing y with abs(y).

An interesting road block is that when I type "ln(x+iy)" into my HP-49g+ in a folder where x and y did not have values assigned, my HP-49g+ responded with "ln(x+iy)" instead of showing me the symbolic expression it would use for evaluation. I grabbed my TI Voyage 200 and my TI-nspire CAS, and typed "ln(x+iy)" into each machine, with the following response in both cases:

ln(x^2+y^2)/2+(pi*sign(y)/2-arctan(x/y))*i

I am wondering how I would ask my HP-49g+ CAS system to symbolically display the expression that it would use internally?

Now, I am curious about the other CAS machines HP has produced. If anyone has CAS in a machine, please try this experiment, and see what symbolic expression pops out for the complex natural logarithm.

Let me think about the question you had about the polar version. That puzzle will make a nice thing to ponder while I am dreaming. Yes, I really do think about math while I am sleeping. Sometimes, it is the fastest way to solve a problem.

Quote:
I am wondering how I would ask my HP-49g+ CAS system to symbolically display the expression

See the TRIG command.

Hope this helps,

PG

Under the TRIG menu, I tried TEXPAND(LN(X+iY)) with no luck. It just responded with LN(X+iY).

I should have said 90 degrees. Now I can go back to sleep.

I ran this past my Casio Classpad. Like the HP-49g+, it would only respond to ln(x+iy) with ln(x+iy) until I found the classpad's cExpand function. Using cExpand(ln(x+iy)) produces an expression for complex logarithm that also uses arctan(x/y) and a signum function to get the angle into the correct quadrant. It looks sightly different in format, but it is essentially the same expression that is output by both of the TI CAS machines.

There probably is something similar for the HP-49g+, HP-50g, or other HP CAS machines. I am just not finding it right now.

Quote:
Under the TRIG menu, I tried TEXPAND(LN(X+iY)) with no luck. It just responded with LN(X+iY).

Try the TRIG *command* which can be found in the Catalog (or under the "Trig" menu).

Best,

PG

Edited: 19 Oct 2008, 12:35 p.m.

Bill --

Quote:
In the expression for natural logarithm, the angle for the imaginary part would be simply the arctan of y over x, but that would not work in every quadrant. To fix that, and make it work for other quadrants, the expression uses arctan of x over y intentionally.

Mea culpa about the input argument to arctan. I have corrected my earlier post.

Quote:
In the quadrants of interest, (90) degrees minus the arctan of x over y is the same thing as the simpler arctan of y over x, except that when combined with the term for the signum of y the larger expression can work for all four quadrants.

Except when y = 0 (for which the expression is unneeded), as my earlier response illustrated. I'd stick with rectangular->polar conversions with internal "atan2" to implement ln(x+ iy) in a program without complex-number support available. About the only H-P scientifics without rectangular<->polar conversions for real-valued inputs -- ironically enough -- are the old HP-35 (which is nonprogrammable), and the new HP-35s (which can compute natural logarithm for complex-valued input).

-- KS

Quote:
There's a typo here isn't there? Shouldn't the result be 0.1459688 + i*0.827706645?

Yes, there is a typo. EasyCalc reports: 0.145968879271932+0.827706644863301*i

Quote:
Also, it looks like you're only getting about 5 or 6 correct digits. Can you do the complex SINH calculation in double precision?

I think EasyCalc only supports double-precision calculations. It won't run without Mathlib, the Palm shared IEEE-754 double-precision library.

Quote:
What does Easycalc get for TAN(1.57079), in radians mode? In both single and double precision, if available.

EasyCalc: 158,057.913410701003158

Hope this helps,

PG

Ok, I see the reason for the apparent error in the result for the SINH calculation. You used .243 + i .93375 for the input; the imaginary part was 5 digits.

And it looks like Easycalc reduces radian trig arguments with fewer digits of Pi than the Saturn based HP calcs.