Lobachevsky Function for the HP-41
Overview
-The Lobachevsky function is defined by L(µ) = - §0µ Ln | 2 Sin t | dt
-We have also L(µ) = (1/2) Im [ Li2 ( exp(2i.µ) ) ] where Li2 = dilogarithm function
-So, we could call "DILM1" that is listed in "Dilogarithm & Polylogarithm
functions for the HP-41" , paragraph 3°)
-The following routine employs the same method with a few extra terms.
L(µ) = (1/2) SUMk=1,2,..... sin(2k.µ) / k2 = -2.µ ln | 2.µ | + 2.µ + SUMk=1,2,..... (-1)k-1/(2k+1)! [B2k/(2k)] (2.µ)2k+1
where B2k are the Bernoulli numbers
Program Listing
Data Registers: R00 = 2 µ ( in radians
)
Flags: /
Subroutines: /
01 LBL "LOB"
02 ST+ X 03 FC? 43 04 D-R 05 PI 06 ST+ X 07 MOD 08 PI 09 X>Y? 10 CLX 11 ST+ X 12 - 13 STO 00 14 X^2 15 918 E17 16 1/X 17 RCL Y |
18 43 E20
19 / 20 + 21 * 22 1931 E15 23 1/X 24 + 25 * 26 3983 E13 27 1/X 28 + 29 * 30 12462 E-19 31 + 32 * 33 15 34 FACT |
35 12
36 * 37 1/X 38 + 39 * 40 29522 E7 41 1/X 42 + 43 * 44 11 45 FACT 46 132 47 * 48 1/X 49 + 50 * 51 9 |
52 FACT
53 240 54 * 55 1/X 56 + 57 * 58 7 59 FACT 60 252 61 * 62 1/X 63 + 64 * 65 5 66 FACT 67 X^2 68 1/X |
69 +
70 * 71 72 72 1/X 73 + 74 * 75 RCL 00 76 ABS 77 X#0? 78 LN 79 - 80 RCL 00 81 ST* Y 82 + 83 2 84 / 85 END |
( 144 bytes / SIZE 001 )
STACK | INPUT | OUTPUT |
X | µ | L(µ) |
where µ must be expressed in degrees if the HP-41 is in DEG mode, or in radians if the calculator is in RAD mode.
Example:
XEQ "DEG"
28°90854705 XEQ "LOB" >>>> L(28°90854705) = 0.5071518525
Notes:
-If your HP-41 is in GRAD mode, express µ in degrees.
-"LOB" is a periodic function of period PI ( or 180° )
-Its graph looks approximately like this:
y
|
*
y = L(x)
| *
*
| *
*
0 |*---------------------------*----------------------------*PI-------
x (rd)
|
*
*
|
*
*
|
*