HP Forums
(35S) complex asin, acos, atan + hyperbolic - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (35S) complex asin, acos, atan + hyperbolic (/thread-8301.html)



(35S) complex asin, acos, atan + hyperbolic - stephane - 05-05-2017 07:31 PM

Curiously, the complex sin, cos and tan are available on the HP35s, but not the inverse arc functions.

So, you can find below 3 programs to compute them. They use the labels H, I, J as these letters are placed on the corresponding SIN, COS, TAN keys.

The corresponding formulas are:

asin(z) = -i.ln(i.z+sqrt(1-z²))
acos(z) = -i.ln(z+sqrt(z²-1))
atan(z) = i/2.ln((1-i.z)/(1+i.z))

Usage:
asin(x): XEQ H
acos(x): XEQ I
atan(x): XEQ J

The variables of the calculator are preserved.
The stack is preserved too.
LASTx is set with the right previous value before running the programs. (I use the following tip: ABS followed by CLx)


Code for asin(x)

Code:

H001 LBL H
H002 ABS
H003 CLx
H004 -LN(LASTx*i+(1-LASTx*LASTx)^0.5i0)*i    CK=33E0 LN=36
H005 RTN

CK=B392 LN=51


Code for acos(x)

Code:

H001 LBL I
H002 ABS
H003 CLx
H004 -LN(LASTx+(LASTx*LASTx-1)^0.5i0)*i    CK=8277 LN=34
H005 RTN

CK=6DAE LN=49


Code for atan(x)

Code:

H001 LBL J
H002 ABS
H003 CLx
H004 LN((1-LASTx*i)/(1+LASTx*i))*i0.5    CK=D6E7 LN=32
H005 RTN

CK=91AE LN=47

To check the code:
asin(-2) = -1.5708 i 1.3170
acos(-2) = 3.1416 i 1.3170
atan(-2 i 3) = -1.4099 i 0.2291


For hyperbolic functions:

I don't provide code because I don't use them, but you can calculate them easily, either from the exp/logarithmic expressions, or from:

sinh(z) = -i.sin(i.z)
cosh(z) = cos(i.z)
tanh(z) = -i.tan(i.z)

asinh(z) = i.asin(-i.z)
acosh(z) = i.acos(z)
atanh(z) = i.atan(-i.z)

(I haven't checked the latter expressions myself)