Showing posts with label natural logarithm. Show all posts
Showing posts with label natural logarithm. Show all posts

Saturday, January 31, 2026

RPN: HP 11C: Transferring Between Bases (Common/Natural)

RPN: HP 11C: Transferring Between Bases (Common/Natural)



All algorithms were tested with the HP 11C.



Between the Exponential Function and Common-Antilog


e^α = 10^ß


Given α, what is ß?


ß = log(e^α)


RPN:

<input α>

e^x

LOG


Examples (Fix 6):

e^1.05 = 10^ß

ß ≈ 0.456009


e^(-2.2) = 10^ß

ß ≈ -0.955448


Given ß, what is α?


α = ln(10^ß)


RPN:

<input ß>

10^x

LN


Examples (Fix 6):

e^α = 10^5.4

α ≈ 12.433960


e^α = 10^0.366

α ≈ 0.842746


Between the Natural Logarithm and Common Logarithm


log α = ln ß


Given α, what is ß?

ẞ = exp(log α)


RPN:

<input α>

LOG

e^x


Examples (Fix 6):

log 17 = ln ß

ß ≈ 3.422766


log 317 = ln ß

ß ≈ 12.195405



Given ß, what is α?

α = 10^(ln ß)



RPN:

<input ß>

LN

10^x



Examples (Fix 6):

log α = ln 425

α ≈ 1,127,428.915



log α = ln 9.81

α ≈ 192.044677




Eddie


All original content copyright, © 2011-2026. 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.

Saturday, July 6, 2024

HP 12C: Hyperbolic Sine and Cosine, and their Inverses

HP 12C: Hyperbolic Sine and Cosine, and their Inverses


Introduction


The following program calculates four hyperbolic functions:


sinh x = (e^x – e^(-x)) / 2

cosh x = (e^x + e^(-x)) / 2

arcsinh x = ln(x + √(x^2 + 1))

arccosh x = ln(x + √(x^2 - 1)) (principal arccosh x)



HP 12C Program: sinh x, cosh x, arcsinh x, arccosh x



Step #: Step Code: [ keys ]


# sinh x: GTO 01, R/S

01: __, 43, 22: [ g ] e^x

02: __, 43, 36: [ g ] LST x

03: __, __, 16: [ CHS ]

04: __, 43, 22: [ g ] e^x

05: __, __, 30: [ - ]

06: __, __, _2: [ 2 ]

07: __, __, 10: [ ÷ ]

08: 43, 33, 00: [ g ] GTO 00


# cosh x: GTO 09, R/S

09: __, 43, 22: [ g ] e^x

10: __, 43, 36: [ g ] LST x

11: __, __, 16: [ CHS ]

12: __, 43, 22: [ g ] e^x

13: __, __, 40: [ + ]

14: __, __, _2: [ 2 ]

15: __, __, 10: [ ÷ ]

16: 43, 33, 00: [ g ] GTO 00


# arcsinh x: GTO 17, R/S

17: __, __, 36: [ ENTER ]

18: __, __, 36: [ ENTER ]

19: __, __, _2: [ 2 ]

20: __, __, 21: [ y^x ]

21: __, __, _1: [ 1 ]

22: __, __, 40: [ + ]

23: __, 43, 21: [ √ ]

24: __, __, 40: [ + ]

25: __, 43, 23: [ g ] LN

26: 43, 33, 00: [ g ] GTO 00


# arccosh x: GTO 27 R/S

27: __, __, 36: [ ENTER ]

28: __, __, 36: [ ENTER ]

29: __, __, _2: [ 2 ]

30: __, __, 21: [ y^x ]

31: __, __, _1: [ 1 ]

32: __, __, 30: [ - ]

33: __, 43, 21: [ √ ]

34: __, __, 40: [ + ]

35: __, 43, 23: [ g ] LN

36: 43, 33, 00: [ g ] GTO 00



Instructions


1. Enter x

2. To calculate, press [ g ] GTO ##, then press [ R/S ].

* GTO 01 R/S: sinh x

* GTO 09 R/S: cosh x

* GTO 17 R/S: arcsinh x

* GTO 27 R/S: arccosh x


Examples

(Fix 4)

x

sinh x

cosh x

-0.64

-0.6846

1.2119

0.59

0.6248

1.1792

1.23

1.5645

1.8568

3.74

21.0371

21.0609


Note: arccosh(1.2119) returns 0.64



Source


Selby, Samuel M. Ph. D. Sc. D. CRC Standard Mathematics Tables: Nineteenth Edition. The Chemical Rubber Co. Cleveland, OH. 1971. pp. 202, 211



Until next time,

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.

Thursday, March 3, 2016

Casio fx-5800p: Complex Numbers Calculations: e^z, ln z, z^w

Casio fx-5800p:  Complex Numbers Calculations: e^z, ln z, z^w


Let z = a + bi = r*e^(θi) and w = c + di = s*e^(αi) where i = √-1

The complex mode of the Casio fx-5800p, and quite frankly, most graphing calculators of Casio have limited capabilities working with complex numbers, limited to arithmetic, and powers to real numbers only.  These three programs extend that functionality. 

Use Radian mode.

Complex Exponential Function

Calculation:  e^z = e^a * e^(yi) = e^a * (cos b + i*sin b)

The input is stored in Z, output is stored in X. 

Program EXPCOMPLX
“Z”? → Z
Rad
ReP(Z) → A
ImP(Z) → B
e^(A)*(cos(B)+i*sin(B))→X

Examples: 
e^(-6i) ≈ 0.9601702867 + 0.2794154982i
e^(5.25 + 3.75i) ≈ -156.3709348 – 108.9203077i

Complex Natural Logarithm Function

Calculation: ln z = ln r + iθ

Program LNCOMPLX
“Z”? → Z
Rad
Abs(Z) → R
Arg(Z) → T
ln(R) + iT → X

Examples:
ln(3 + 6i) ≈ 1.903331245 + 1.107148718i
ln(7i) ≈ 1.945910149 – 1.570796327i

Complex Power

Calculation: z^w = e^(w ln z)

Program POWCOMPLX
“Z^(W), Z”? → Z
Rad
Abs(Z) → R
Arg(Z) → T
ln(R) + iT → X
“W”? → W
WX → X
ReP(X) → A
ImP(X) → B
e^(A)*(cos(B) + i*sin(B)) → X

Examples:
(2 + 3i)^(-1 + i) ≈ 0.09917578259 + 0.03064399883i
(0.075 – 3i)^(0.2i) ≈ 1.3295102 + 0.2970040915i


This blog is property of Edward Shore - 2016

Sunday, May 15, 2011

Complex Number Operations (Part II)



For all the calculations, let z = a + bi

Assume your calculator is in Radians Mode. The algorithms are suggested.

Exponential of a Complex Number

e^z = e^a (cos b + i sin b)

This calculation is fairly easy because it is relatively straight forward.

A sample RPN (Reverse Polish Notation) routine would look like:

With b on the y stack and a on the x stack:

e^x
STO 0 (or whatever register or variable you want as temporary storage)
x< >y (swap)
ENTER
SIN
RCL 0
×
R↓
COS
×
x< >y (swap)
R↓

Result: real(e^z) is on the x stack, while imag(e^z) is on the y stack

Natural Logarithm of a Complex Number

ln z = ln r + i θ

where r = √(x^2 + y^2) and θ = arctan(y/x)

Casio fx-115ES:
ln(abs(a + bi)) + i arg(a + bi)

Sharp EL-W516:
ln(abs(a + bi)) + i tan^-1(b÷a)

TI-36X Pro:
ln(abs(a + bi)) + i angle(a + bi)

With b on the y stack and a on the x stack, a sample RPN routine mat look like this:
→P (Rectangular to Polar conversion)
LN

Argument vs Arctangent (tan^-1)

Bear in mind that the argument (often labeled arg or angle for TI calulators) and the arctangent functions returns different angles. However the angles are accurate, recall the identity tan(x ± π) = tan(x).

Ranges of Calculator Functions:

angle/arg returns the angle between -π/2 and π/2 (-90° and 90°)

tan^-1 returns the angle between 0 and π (0° and 180°)






Sine of a Complex Number

There are two general formulas to calculate the sine of a complex number

(1) sin z = sin a cosh b + i cos a sinh b

(2) sin z = (e^iz - e^-iz)/(2i)

Formula (2) is good if your calculator can handle e^z. For the non-graphing calculators, I recommend using formula (1).

A sample RPN routine looks like this:

With b on the y stack and a on the x stack:

STO 0 (or A)
COS
x< >y
STO 1 (or B)
SINH
×
RCL 1 (or B)
COSH
RCL 0 (or A)
SIN
×


Cosine of a Complex Number

Calculating the cosine of a complex number is similar:

(1) cos z = cos a cosh b - i sin a sinh b

(2) cos z = (e^iz + e^-iz)/2

A sample RPN routine looks like this:

With b on the y stack and a on the x stack:

STO 0 (or A)
SIN
CHS (+/-)
x< >y
STO 1 (or B)
SINH
×
RCL 1 (or B)
COSH
RCL 0 (or A)
COS
×



The formulas are presented for completion.

ArcSine and ArcCosine

These formulas are presented for completion.

sin^-1 z = -i ln( i z ± √(1 - z^2))

cos^-1 z = -i ln(z ± i√(1 - z^2))

The principle angle is given by using +.

(staff.jccc.net)

Complex Power of a Complex Number

Let z and w be complex numbers, then:

z^w = e^(w ln z)

(HP 41C Math Pac)

Earth's Radius by Latitude

Earth's Radius by Latitude Introduction: Calculating the Earth’s Radius In quick, general calculations, we assume that the...