Sunday, August 11, 2024

Swiss Micros DM41X and fx-6500G: Complex Gudermannian Function and Its Inverse

Swiss Micros DM41X and fx-6500G: Complex Gudermannian Function and Its Inverse


Introduction


The Complex Gudermannian Function and the inverse are calculated as:


gd(x + yi) = u +vi where:

i = √-1

u = arctan( sinh x / cos y) = angle( cos y + i*sinh x )

v = arctanh( sin y / cosh x )


gd^-1(u + vi) = x + yi where:

i = √-1

x = arctanh( sin u / cosh v )

y = arctan( sinh v / cos u ) = angle(cos u + i*sinh v )


Notes:


* The calculator is set to radians mode during program execution.

* The arctangent function is handled using the rectangular to polar conversion (using the angle part). Doing so will increase the range between -π to π. The results are normalized.

* The results may not necessarily be the only answer but an attempt to get the principle branch.



Swiss Micros DM41X: Gudermannian and Inverse Gudermannian Functions


The DM41X is similar to the Hewlett Packard HP 41C series. Assuming we have no mathematical modules plugged in, the hyperbolic functions must be programmed as they were not included in the original function set.


Keeping with RPN notation, the imaginary part is placed on the Y stack and the real part is placed on the X stack. The memory registers used:


R01 = X

R02 = Y

R03 = U

R04 = V

gd(X + Yi) = U + Vi


The hyperbolic functions operate on real values only, and the in the Gudermannian and its inverse functions handle the real and imaginary parts separately.


DM41X: Hyperbolic Sine Routine: SINH


01 LBL^T SINH

02 ENTER↗

03 E↗X

04 X<>Y

05 CHS

06 E↗X

07 -

08 2

09 /

10 RTN

11 END


DM41X: Hyperbolic Cosine Routine: COSH


01 LBL^T COSH

02 ENTER↗

03 E↗X

04 X<>Y

05 CHS

06 E↗X

07 +

08 2

09 /

10 RTN

11 END


DM41X: Hyperbolic Arctangent Routine: ATANH


01 LBL^T ATANH

02 ENTER↗

03 ENTER↗

04 1

05 +

06 X<>Y

07 CHS

08 1

09 +

10 /

11 LN

12 2

13 /

14 RTN

15 END


Now to the main programs:


DM41X: Complex Gudermannian Function: CDG


01 LBL^T CGD

02 RAD

03 STO 01

04 X<>Y

05 STO 02

06 RCL 01

07 XEQ^T SINH

08 RCL 02

09 COS

10 R-P

11 X<>Y

12 STO 03

13 RCL 02

14 SIN

15 RCL 01

16 XEQ^T COSH

17 /

18 XEQ^T ATANH

19 STO 04

20 RCL 03

21 RTN

22 END


DM41X: Inverse Complex Gudermannian Function: CGDI


01 LBL^T CGDI

02 STO 03

03 X<>Y

04 STO 04

05 RAD

06 RCL 03

07 SIN

08 RCL 04

09 XEQ^T COSH

10 /

11 XEQ^T ATANH

12 STO 01

13 RCL 04

14 XEQ^T SINH

15 RCL 03

16 COS

17 R-P

18 X<>Y

19 STO 02

20 RCL 01

21 RTN

22 END


Casio fx-6500G: Gudermannian and Inverse Gudermannian Functions


The code can easily be adapted to other Casio calculators.


gd(X + Yi) = U + Vi


In these program listings, the real and imaginary parts are handled separately. For the fx-6500G (and same for the fx-7000G, 7500G, and 8000G), the Rectangular to Polar (Pol(x,y)) conversion stores the radius in the variable I and angle (θ) in the variable J. For the early Casio models, switch to Radians mode by pressing [ MODE ] [ 5 ].


gd(X + Yi) → U + Vi

Code:

Rad

“GD(X+YI)”

“X”:? → X

“Y”:? → Y

Pol(cos Y, sinh X)

J → U

tanh^-1 (sin Y ÷ cosh X) → V

“U + VI=”

U ⊿

V


gd^-1(U + Vi) → X + Yi


Code:

Rad

“GD^-1(U+YI)”

“U”:? → U

“V”:? → V

tanh^-1 (sin U ÷ cosh V) → X

Pol(cos U, sinh V)

J → Y

“X + YI=”

X ⊿

Y


Examples


Results are rounded to six decimal places. Be aware only one answer is given.


1. gd(3 + 4i) ≈ 1.635952 – 0.075314i

2. gd(-7 + 2i) ≈ -1.571555 + 0.001658i

3. gd(0 + 3i) ≈ 3.141593 + 0.142068i

4. gd(-3 + 0i) ≈ -1.471304 + 0i



Sources


“The Complex Gudermannian Function” analyticphysics.com. Uploaded June 16, 2021. Accessed June 23, 2024. https://analyticphysics.com/Complex%20Variables/The%20Complex%20Gudermannian%20Function.htm


“Gudermannian function” Wikipedia. Last Edited May 23, 2024. Accessed June 20, 2024.

https://en.wikipedia.org/wiki/Gudermannian_function#:~:text=The%20Gudermannian%20function%20relates%20the,sector%20is%20%CF%95%20%3D%20gd%20%CF%88.



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...