Sunday, October 31, 2021

Happy Halloween: Belphagor's Prime and Triple Digit Integers

 Happy Halloween: Belphagor's Prime and Triple Digit Integers


Greetings everyone.  And a very Happy Halloween to you, hopefully you are all celebrating, having a great time, staying safe and sane.   


Today, I'm going there, talking about a number with a very dark and evil repetition, better known to religions as the "number of the beast":  six hundred and sixty six.  And to try to balance things out, I'm also going to be talking about a holy number.  


A Prime Evil:  Belphegor's Prime - Starring the Triple Six 


Belphegor's Prime is a large palindrome number:


1000000000000066600000000000001


that has three sixes in the middle of 13 zeroes on other side enclosed by a 1.  A two for one deal, not only the number of the beast but also the presence of a number with a unlucky repetition, 13.  Engineer and mathematician Harvey Dubner determined this monster of a number to be a prime integer.   However, the number received its nefarious name from well-known mathematics and science author Cliff Pickover.   


Who is Belphegor?   In religion, Belphegor is a prince of Hell, whose purpose in demonhood was to trick people into discovery (with a heavy price attached).  


Other connections to the infamous triple six include:


* The sum of the integers 1 to 36.  


* Multiply 2/3 by 1000 and take the integer part (without rounding) to get this number.


*  The triple six can be written has every roman numeral less than 1,000.  


*  It make can property very valuable, such as 666 5th Ave in New York City selling for a then record $1.8 billion, only to be changed to 660 5th Ave sometime later.  

 


Triple Digit Integers - The Glory of Triple Seven


Triple sixes aren't the only number to receive a mythological, metaphysical, or religious repetition.   


For instance, triple sevens, 777, is said to be a very heavenly number.  In Christianity, 777 represents the perfection of Trinity, made up of the Father, Son (Jesus Christ), and the Holy Spirit.  


Maybe the prime factorization of 777, 3 × 7 × 37, is what lead Judaism to declare the numbers 3 and 7 to be "perfect".


Finally, 777 is what brings much happiness to slot players. If you have been a casino, you know why. 


In numerology, triple numbers are promoted to have significance in the new age religion.  111, 222, 333, and so on, are given various meanings depending on the new age writer.  111 and its four digit number "relative", 1111, are very popular in the new age industry, often suggesting completion, oneness with the universe, and positive attraction thoughts. 


Generating Triple Digit Palindrome Numbers


You can generate integers 1 [ n number of zeros ] ddd [ n number of zeroes ] 1, where d is the digit 0 through 9 through the following formula:


10^(2n+4) + d × 111 × 10^(n+1) + 1


Examples:


n = 1, d = 9:   1099901


n = 2, d = 2:   100222001


n = 3, d = 3:   10003330001



No guarantees that the integer you get is prime.  Use at your own risk.  


Sources:


Grundhauser, Eric.  "How a Mathematician Turned an Obscure Number Into a Scary Story"  Atlas Obscura.  August 23, 2016.   Accessed August 1, 2021.  https://www.atlasobscura.com/articles/how-a-mathematician-turned-an-obscure-number-into-a-scary-story


"660 Fifth Avenue".  Wikipedia Last Edited. August 11, 2021.  Accessed August 11, 2021.  https://en.wikipedia.org/wiki/660_Fifth_Avenue


"666 (number)" Wikipedia.  Last Edited July 31, 2021.  Accessed August 9, 2021.  https://en.wikipedia.org/wiki/666_(number)


"777 (number)" Wikipedia.  Last Edited August 6, 2021.  Accessed August 9, 2021. https://en.wikipedia.org/wiki/777_(number)


Three very infamous tarot cards: The Tower, The Devil, Death.  (Gilded Tarot Deck - Ciro Marchetti)

Happy Halloween,


Eddie


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

Swiss Micros DM41X and HP 41CX: Advanced String Programs

Swiss Micros DM41X and HP 41CX:  Advanced String Programs





Introduction and Generating Random Integers


This blog entry features three programs for the Swiss Micros DM41X and HP 41CX (or a HP 41C with an extended module):


ACODE:  generate a code of random letters


ASAMP:  generate a sample of numbers of digits 0 to 9, where no numbers repeat.  ASAMP accepts up to 9 numbers.   


CRYPT:  allows the user to "add" or "subtract" a code to a word to encrypt it.   CRYPT is a basic form of encryption.   


Both ACODE and ASAMP use a random number generator.  Unfortunately, the HP 41C does not have a random number generator and one must be programmed.  I wanted to avoid reinventing the wheel.   The following formula, obtained from the book An Atlas of Functions (see source), generates random numbers of value 0 ≤ r < 1:


r_n+1 = [ ( (4561 * int(243000 * r_n) + 51349 ) mod 243000 ] ÷ 243000


To convert this into a random integer from a to b: 


randint = int( (b - a + 1) * r) + a


int is the integer function.   The second formula is useful because we don't have to change display modes to execute the calculation.  


Note:


XTOA takes an integer from the stack and appends the associated code to the alpha string.


ATOX takes the left most character, converts it to code, and deposits it on the X stack.  The length of the alpha string is reduced by one.


Codes:

Alphabet:  65 is code for A, 90 is code for Z (all letters inclusive)

Numbers:  48 is code for 0, 57 is code for 57 (all letters inclusive)

# 35

$  36

%  37

&  38

:  58

@  64

[  91

]  93

Σ 126


The system's DATE and TIME are used to generate an initial seed


Swiss Micros DM41X Program:  ACODE


Instructions:

Enter the length, execute ACODE


Example (results will vary):

10 ACODE (may) return CDSJHPNWLD  (10 letters)

11 ACODE -> NVJZJMVVBSV


01 LBL^T ACODE

02 CLA

03 STO 01

04 DATE

05 TIME

06 +

07 2

08 /

09 FRC

10 STO 02

11 LBL 00

12 RCL 02

13 XEQ 01

14 XEQ 02

15 XTOA

16 DSE 01

17 GTO 00

18 AVIEW

19 RTN

20 LBL 01

21 RCL 02

22 243 E3

23 *

24 LASTX

25 X<>Y

26 INT

27 4561

28 *

29 51349

30 +

31 X<>Y

32 MOD

33 LASTX

34 /

35 STO 02

36 RTN

37 LBL 02

38 26

39 *

40 INT

41 65

42 +

43 RTN

44 END


Swiss Micros DM41X Program: ASAMP


Instructions:

Enter the length, execute ASAMP


If the length is greater than 9, an error is generated.  


Example (results will vary):

4 ASAMP can generate results such as 4381, 0361, 4920

7 ASAMP can generate results such as 6732145, 9852067, 1963542

 

Results are returned as an alpha string


01 LBL^T ASAMP

02 CLA

03 STO 01

04 9

05 X<Y?

06 GTO 03

07 DATE

08 TIME

09 *

10 FRC

11 STO 02

12 LBL 00

13 XEQ 01

14 STO 03

15 POSA

16 -1

17 X=Y?

18 GTO 02

19 GTO 00

20 LBL 02

21 RCL 03

22 XTOA 

23 DSE 01

24 GTO 00

25 AVIEW

26 RTN

27 LBL 01

28 RCL 02

29 243 E3

30 *

31 LASTX

32 X<>Y

33 INT

34 4561

35 *

36 51349

37 +

38 X<>Y

39 MOD

40 LASTX

41 / 

42 STO 02

43 10

44 *

45 INT

46 48

47 +

48 RTN

49 LBL 03

50 0

51 1/X

52 RTN

53 END


Swiss Micros DM41X Program:  CRYPT


Syntax:

Store your word in the Alpha register

Give a key (integer), can be positive or negative

XEQ CRYPT


Example:

Starting alpha string:  MATHS

10 CRYPT returns WKDRC

-10 CRYPT returns MATHS (where you started from)

This allows for two people to have short encoded messages and a secret key.


01 LBL^T CRYPT

02 STO 01

03 ALENG

04 STO 02

05 LBL 00

06 ATOX

07 65

08 - 

09 RCL 01

10 +

11 26

12 MOD

13 65

14 + 

15 XTOA

16 DSE 02

17 GTO 00

18 AVIEW

19 RTN 


You can download all three files (in .raw format) here:  

https://drive.google.com/file/d/1UD8CAILnfe4l2ID_UdoHfFGvaYiWni8J/view?usp=sharing


Thanks to Albert Chan (MoHPC) for feedback on the the programs.  



Source for the Random Number Formula:


Keith Oldham, Jan Mayland,  Jerome Spainer  An Atlas of Functions 2nd Edition Springer:  New York, NY.  2009.  ISBN 9780387488066


Eddie


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


Sunday, October 24, 2021

Swiss Micros DM41X: Health Calculations

 Swiss Micros DM41X: Health Calculations




These programs also apply to the HP 41C or almost any emulator.  I don't believe that you will need the Extended Functions Module for these programs.  


Mean Arterial Pressure


Generally, when we take our blood pressure we get a ratio:  systolic blood pressure over diastolic blood pressure.   The Mean Arterial Pressure (MAP) can  be calculated by the following formula:


MAP = (Systolic BP + 2 × Diastolic BP) ÷ 3


Example:

Systolic BP = 124

Diastolic BP = 86


Result:  MAP ≈ 98.6667


Swiss Micros DM41X Program:  MAP


01 LBL^T MAP

02 ^T SYS BP?

03 PROMPT

04 ^T DIA BP?

05 PROMPT 

06 2

07 *

08 +

09 3

10 /

11 ^T MAP = 

12 ARCL X

13 AVIEW

14 RTN


Source:

Lung, Johnny.   Respiratory Therapy Formulas and Calculations Respiratory Therapy Zone 2020


Body Surface Area:  The Mosteller Formula


There are several ways of calculating BSA (body surface area) which is used as a person's metabolic mass, which in turn is used in other clinical and respiratory calculations such as the cardiac output.  Several formulas to estimate BSA exist, including formulas from Haycock, Fujimoto, Body, Du Bois, and Mosteller.  The calculations depend on two factors:  the person's height in centimeters (cm), and the person's mass in kilograms (kg).    The BSA is measured in squared meters (m^2).


The Mosteller formula provides a simple calculation:


BSA ≈ √(mass × height) ÷ 60


The program presented will allow for U.S. units, as amounts are converted when necessary.  Using U.S. units, enter height in inches (in) and mass in pounds (lb).  The result will be in square feet (ft^2).


Conversions:

1 in = 2.54 cm

2.2406 lb ≈ 1 kg

1 m^2 ≈ 10.7639 ft^2


The program will prompt you "IN/LB? Y=1" if you want to use U.S. units, enter 1 then press [R/S] for yes, entering any other number then [R/S] defaults to SI units.  In U.S. units mode, flag 1 is turned on (there will be a 1 indicator on the screen). 


Examples:


Height = 70 in (5'10")

Mass = 240 lb

BSA ≈ 24.9589 ft^2


Height = 177.8 cm

Mass = 108.8622 kg

BSA ≈ 2.31874 m^2


Swiss Micros DM41X Program:  BSA


01 LBL^T BSA

02 CF 01

03 ^T IN/LB? Y=1

04 PROMPT

05 1

06 X=Y?

07 SF 01

08 ^T HEIGHT?

09 PROMPT

10 FS? 01

11 2.54

12 FS? 01

13 *

14 ^T WEIGHT?

15 PROMPT

16 FS? 01

17 2.2046

18 FS? 01

19 /

20 *

21 SQRT

22 60

23 /

24 ^T BSA=

25 AVIEW

26 PSE

27 PSE

28 FS? 01

29 10.7639

30 FS? 01

31 *

32 FS? 01

33 ^T FT^2:

34 FC? 01

35 ^T M^2:

36 ARCL X

37 AVIEW

38 CF 01

39 RTN


Source:

"Body Surface Area".  Wikipedia.  Edited July 22, 2021.  Accessed on August 9, 2021.  https://en.wikipedia.org/wiki/Body_surface_area


Cardiac Output with Fick's Equation


Given the following variables:


VO_2:  total oxygen consumption in L/min

CaO_2:  arterial oxygen content in ml/L

CvO_2:  venous oxygen content in ml/L

HR: heart rate (BPM)


The following can be calculated:


CO:  Cardiac Output in l/min


CO = (VO_2 × 100) ÷ ((CaO_2 - CvO-2) × 1000)


SV:  Stroke Volume in ml/beat


SV = (CO × 1000) ÷ HR


Example:

Inputs:

VO_2: 248 ml/min 

CaO_2:  22%  (enter 22)

CvO_2:  18% (enter 18)

HR: 84 BPM


Results:

CO = 6.2000 l/min

SV = 73.8095 ml/beat 


Swiss Micros DM41X Program:  FICK


01 LBL^T FICK

02 ^T VO.2?

03 PROMPT

04 ^T C.A 0.2 %?

05 PROMPT

06 ^T C.V 0.2 %?

07 PROMPT

08 - 

09 1000

10 *

11 /

12 100

13 *

14 STO 01

15 ^T CO = 

16 ARCL 01

17 AVIEW

18 STOP

19 1000

20 *

21 ^T HR?

22 PROMPT

23 /

24 STO 02

25 ^T SV =

26 ARCL 02

27 AVIEW

28 RTN


Sources:


"Fick Cardiac Output" HP 67/97 User's Library Solutions:  Cardiac.   Corvallis, OR.  1976.  pp. 20-23 https://literature.hpcalc.org/community/hp6797-ul-cardiac.pdf


"Fick's Cardiac of cardiac output measurement" Deranged Physiology.  Updated December 1, 2020.   Accessed August 9, 2021.  https://derangedphysiology.com/main/cicm-primary-exam/required-reading/cardiovascular-system/Chapter%20811/ficks-principle-cardiac-output-measurement


Download the .raw files here:  https://drive.google.com/file/d/1VJCkwSk9QpbBFsxoh6H0G8dRfAuuVU7j/view?usp=sharing

Eddie

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

Swiss Micros DM41X and HP Prime: The Exit Game

Swiss Micros DM41X and HP Prime: The Exit Game





Introduction


We have two entities in an area:  A and B.   Unfortunately, that area isn't big enough for A and B to stay.  If both A and B stay, they suffer a loss (think economical loss, but it can apply to morality loss, emotional loss, etc.).   Neither A nor B want to leave and each of them want their opponent to leave instead.  


If A and B both leave, neither have any benefits from staying in the area.


The program EXTGAME/EXITGAME calculates four probabilities:


P(A):  probability A stays if A is indifferent of whether B stays or leaves


K_a =  G_a ÷ (G_a - L_a)


P(B):  probability B stays if B is indifferent of whether A stays or leaves


K_b =  G_b ÷ (G_b - L_b)


P(both):  probability that both A and B stay, given they are indifferent about what their opponent does


P(both) = K_a × K_b


P(neither):  probability that both leave, given they are indifferent about what their opponent does 


P(neither) = (1 - K_a) × (1 - K_b)



DM41X Program:  EXTGAME


01 LBL^T EXTGAME

02 ^T A LOSS?

03 PROMPT

04 STO 01

05 ^T A GAIN?

06 PROMPT

07 STO 02

08 ENTER

09 ENTER

10 RCL 01

11 -

12 /

13 STO 05

14 ^T P<A>=

15 ARCL 05

16 AVIEW

17 STOP

18 ^T B LOSS?

19 PROMPT

20 STO 03

21 ^T B GAIN?

22 PROMPT

23 STO 04

24 RCL 04

25 ENTER

26 ENTER

27 RCL 03

28 -

29 / 

30 STO 06

31 ^T P<B>=

32 ARCL 06

33 AVIEW

34 STOP

35 RCL 05

36 RCL 06

37 *

38 ^T P<BOTH>=

39 ARCL X

40 AVIEW

41 STOP

42 1

43 RCL 05

44 -

45 1

46 RCL 06 

47 -

48 *

49 ^T P<NONE>=

50 ARCL X

51 AVIEW 

52 END



HP Prime Program: EXITGAME


EXPORT EXITGAME()

BEGIN

// 2021-07-30 EWS

MSGBOX("Game of Chicken/Exit: Either A

 or B must leave or they both lose.");


LOCAL la,lb,ga,gb,ka,kb,m;


INPUT({la,ga},"A is indifferent",

{"Loss/B stays: ",

"Gain/B leaves: "});


INPUT({lb,gb},"B is indifferent",

{"Loss/A stays: ",

"Gain/A leaves: "}); 


ka:=ga/(ga-la);

kb:=gb/(gb-lb);


m:=[[la,lb,0,gb],[ga,0,0,0]]; 

  

PRINT();

PRINT("*** Matrix ***");

PRINT2D(m); 

PRINT("*** Results ***");

PRINT("---------------");

PRINT("Prob. A Stays: "+STRING(ka));

PRINT("Prob. B Stays: "+STRING(kb));

PRINT("Prob. Both Stays: "+

STRING(ka*kb));

PRINT("Prob. Both Leave: "+

STRING((1-ka)*(1-kb)));

  

END;



Example


Example:  For players A and B:


A is indifferent:

A's Loss if B Stays:  -45  (DM41X prompt:  A LOSS?)

A's Gain if B Leaves:  +50 (A GAIN?)


B is indifferent:

B's Loss if A Stays: -35 (B LOSS?)

B's Gain if A Leaves: +60 (B GAIN?)


Results:

Probability A Stays:  0.526315789474  (P<A>)

Probability B Stays:  0.631578947368 (P<B>)

Probability both A and B stay:  0.332409972299 (P<BOTH>)

Probability both A and B leave: 0.174515235457 (P<NONE>)






Source:

Ivan Pastine, Tuvana Pastine, Tom Humberstone.  Introducing Game Theory: A Graphic Guide Icon Books Ltd:  London, United Kingdom.  2017  ISBN 9781785780820


Eddie


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


Sunday, October 17, 2021

Σ(1 / (a^n)) from n=1 to m

 Σ(1 / (a^n)) from n=1 to m


This blog entry covers the sum of the series:


Σ[1 / (a^n), n=1 to m] with n and m positive integers


Specific Cases:  a = 2 and a = 3


When a = 2:


m = 1:   1/2


m = 2:   1/2 + 1/4  = (2 + 1)/4 = 3/4


m = 3:   1/2 + 1/4 + 1/8 = (4 + 2 + 1)/8 = 7/8


m = 4:   1/2 + 1/4 + 1/8 + 1/16 = (8 + 4 + 2 + 1)/16 = 15/16


Going from the pattern,


Σ[1 / (2^n), n=1 to m] = 1/(2^m) * Σ[(2^n), n=0 to m-1] = (2^m - 1) / 2^m 


When a = 3:


m = 1:  1/3


m = 2:  1/3 + 1/9  = (3 + 1)/9 = 4/9


m = 3:  1/3 + 1/9 + 1/27 = (9 + 3 + 1)/27 = 13/27


m = 4:  1/3 + 1/9 + 1/27 + 1/81 = (27 + 9 + 3 + 1)/81 = 40/81


Going from the pattern,


Σ[1 / (3^n), n=1 to m] = 1/(3^m) * Σ[(3^n), n=0 to m-1]



Finding the General Formula and Proof


Let's presume that, for any a:


Σ[1 / (a^n), n=1 to m-1] = 1/(a^(m-1) * Σ[(a^n), n=0 to m-2]


Let's add 1/(a^m) to the series:  


Σ[1 / (a^n), n=1 to m-1]  + 1/(a^m)


= (1 + a + a^2 + ... + a^(m-3) + a^(m-2)) / (a^(m-1)) + 1 / (a^m)


= (a * (1 + a + a^2 + ... + a^(m-3) + a^(m-2)) + 1) / (a^m)


= (a + a^2 + a^3 + ... + a^(m-2) + a^(m-1) + 1) / (a^m)


= 1/(a^(m)) * Σ[(a^n), n=0 to m-1]



The general formula is now: 


Σ[1 / (a^n), n=1 to m] = 1/(a^(m)) * Σ[(a^n), n=0 to m-1]


Until next time,


Eddie


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

Swiss Micros DM41X: Applications

Swiss Micros DM41X: Applications





Swiss Micros DM41X Program:  Euclid Algorithm


Registers:

R01:  A

R02: B

R03:  C  (used)


Finds the GCD of A and B, where A and B are positive integers and A > B.


01 LBL^T EUCLID

02 ^T GCD A>B

03 AVIEW

04 PSE

05 ^T A?

06 PROMPT

07 STO 01

08 ^T B?

09 PROMPT

10 STO 02

11 LBL 00

12 RCL 01

13 ENTER

14 ENTER

15 RCL 02

16 /

17 LASTX

18 X<>Y

19 INT

20 *

21 - 

22 STO 03

23 X=0?

24 GTO 01

25 RCL 02

26 STO 01

27 X<>Y

28 STO 02

29 GTO 00

30 LBL 01

31 ^T GCD=

32 ARCL 02

33 AVIEW

34 END


Examples:


A = 100, B = 20, GCD = 20

A = 78, B =24, GCD = 6


Swiss Micros DM41X Program: Fan Laws 


The program will calculate RPM_new (Revolutions per Minute), SP_new (Static Pressure), and BHP_new (Brake Horsepower).  


Inputs:

CFM_old:  Cubic Feet of Minute - old

CFM_new:  Cubic Feet of Minute - new

RPM_old:  Revolutions per Minute - old

SP_old:  Static Pressure - old

BHP_old:  Brake Horsepower - old


Outputs:

RPM_new

SP_new

BHP_new


01 LBL^T FANLAWS

02 CLA

03 ^T CFM.OLD?

04 PROMPT

05 STO 01

06 ^T CFM.NEW?

07 PROMPT

08 STO 02

09 X<>Y

10 /

11 STO 04

12 STO 06

13 ST* 06

14 STO 08

15 ST* 08

16 ST* 08

17 ^T RPM.OLD?

18 PROMPT

19 STO 03

20 ST* 04

21 ^T SP.OLD

22 PROMPT

23 STO 05

24 ST* 06

25 ^T BHP.OLD?

26 PROMPT

27 STO 07

28 ST* 08

29 ^T RPM.NEW=

30 ARCL 04

31 AVIEW

32 STOP

33 ^T SP.NEW=

34 ARCL 06

35 AVIEW

36 STOP

37 ^T BHP.NEW=

38 ARCL 08

39 AVIEW

40 END


Variables:


R01 = CFM.OLD

R02 = CFM.NEW

R03 = RPM.OLD

R04 = RPM.NEW

R05 = SP.OLD

R06 = SP.NEW

R07 = BHP.OLD

R08 = BHP.NEW


The program uses a lot of storage arithmetic.  


Example


Inputs:

CFM.OLD:  1250 CFM

CFM.NEW: 1600 CFM

RPM.OLD:  840 RPM

SP.OLD: 4 in

BHP.OLD: 7 BHP


Results:

RPM.NEW: 1075.2 RPM

SP.NEW: 6.5536 in

BHP.OLD:  14.680064 BHP


Source:

Calculated Industries "Sheet Metal/HVAC Pro Calc User's Guide" 2021


Swiss Micros DM41X Program: Johnson-Nyquist Noise Analysis


Equations Used:


Power (in Watts):


P = kb * T * Δf


RMS Voltage (in Volts):


v_n = √(4 * R * kb * T * Δf) = √(4 * R * P)


Current (in Amps):


i_n = √((4 * T * kb * Δf / R) = v_n / R


Inputs:


T = temperature in Kelvin  (°C + 273.15)

Δf = bandwidth, difference of frequencies in Hz

R = resistance in ohms (Ω)


Constants:  Boltzmann's Constant

kb ≈ 1.380649 * 10^-23 J/K


Program:


01 LBL^T NOISE

02 ^T TEMP? <K>

03 PROMPT

04 ^T BANDWIDTH?

05 PROMPT

06 *

07 1.308649E-23

08 *

09 ^T POW=

10 ARCL X

11 AVIEW

12 STOP

13 ^T R?

14 PROMPT

15 *

16 LASTX

17 X<>Y

18 4

19 *

20 SQRT

21 ^T V=

22 ARCL X

23 AVIEW

24 STOP

25 X<>Y

26 /

27 ^T I=

28 ARCL X

29 AVIEW

30 END


Example:


Temperature:  299.68 K

Bandwidth:  10,500 Hz

Resistance:  1375 Ω


Results:


Power:  4.3444E-17 W

Volts:  4.8882E-7 V

Current:  3.5550E-10 A


"Johnson-Nyquist Noise" Wikipedia.  Retrieved February 15, 2015 https://en.wikipedia.org/wiki/Johnson%E2%80%93Nyquist_noise




Eddie


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


Monday, October 11, 2021

Comparison Between HP 17B and 17BII+

 Comparison Between HP 17B and 17BII+


This is a quick comparison between the original HP 17B and the current (since 2007) silver HP 17BII+ calculators. I hope the 17BII+ is still being produced and sold, it has been quite a while since an update to the 17BII+.  


The main features of the 17B family have remained constant since the original 17B came to the markets in early 1988:


*  Time Value of Money with Amortization

*  Business Calculations including Percent Change, Cost/Sell/Margin/Markup

*  Four Regression Models:  Linear, Logarithm, Power, Exponential

*  Bond Calculations

*  Depreciation including Straight Line, Sum of the Year's Digits, and Accelerated Cost Recovery

*  Days Between Dates, 10 Alarms, Clock

*  10 Memory Registers with Storage Arithmetic

*  Can use the HP 82240 Infrared Printer (82240A/82240B); even though they are well out of production by now


HP 17B

HP 17BII+

HP 17B Mode Menu

HP 17BII+ Mode Menu

Now for the differences:


HP 17B:  (1988)

*   Available Memory:  6,752 bytes

*   Batteries:  3 x LR 44

*   Case Colors:   Brown, Peach-Orange shift key and text

*   Shift functions are printed above the keys


HP 17BII+:  (2007 - present)

*   Available Memory:  about 31,000 bytes

*   Batteries:  2 x CR2032

*   Case Colors:  Silver, Electric Blue shift key and text

*   Shift functions are printed below the function

*   Double line print option  

*   Currency conversion mode

*   RPN mode (this was added to the HP 17BII in 1990)


I did a quick speed test on the equation:


Σ(I:1:525:1:I)  (Result:  138,075)


The original HP 17B won the speed test.


HP 17B Solver

HP 17BII+ Solver


That is about it.   I love the 17B series, which has a rich set of financial functions and a robust solver that includes ore functions that most calculators have.  (including integer part, fractional part, signum, solve if, Σ, date functions, and yes, the Let and Get functions!)

Eddie


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


Sunday, October 10, 2021

n = a^m + b

 n = a^m + b



Calculators:  Swiss Micros DM41X, HP-32S/32SII, Casio fx-9750 GIII


n = a^2 + b


The following program breaks down a positive integer n into n = a^2 + b, where a is √n rounded to the nearest integer in attempt to minimize abs(b).    


Examples:

  

800 = 28^2 + 16

662 = 26^2 - 14

525 = 23^2 - 4


This technique is useful, especially with the HP 32S and HP 32SII.  Normally, real numbers take up 9.5 bytes of memory on the HP 32S series.  Integers 0 - 100 only consume 1.5 bytes of memory for the original HP 32S and the range is extended to 0 - 254 for the HP 32SII.  


When the program terminates, b is on the X stack while a is on the Y stack.  


HP 41C/Swiss Micros DM41X Program:  SQPLUS


01 LBL^T SQPLUS

02 FIX 0

03 ENTER 

04 SQRT

05 RND

06 X^2

07 -

08 LASTX

09 SQRT

10 X<>Y

11 FIX 4

12 RTN


HP 32S and HP 32SII Program: SQPLUS


S01 LBL S

S02 FIX 0

S03 ENTER

S04 SQRT

S05 RND

S06 x^2

S07 -

S08 LASTx

S09 SQRT

S10 x<>y

S11 ALL

S12 RTN


Example:  684


Result:

Y:  26

X:  8 

(26^2 + 8 = 684)


Additional Powers


Now let's extend the problem to include higher powers.  


n = a^m + b


We can estimate a by:


n ≈ a^m

ln n ≈ ln(a^m)

ln n ≈ m * ln a

ln n / m ≈ ln a


a ≈ e^(ln n / m)


Round a to the nearest integer.  Use this a to find b.


n = a^m + b


b = n - a^m


The script brkpower.py (225 bytes) calculates a and b for powers m = 2 to 6.  This script was created on the Casio fx-9750GIII.


Casio fx-9750GIII Micro python Script:  brkpower.py


# 2021-07-17 ews

from math import *

print("n = a**m + b")

n=float(input("n? "))

m=2.0

while m<7:

  a=int(exp(log(n)/m)+.5)

  b=n-a**m

  s="{:.0f} = {:.0f}**{:.0f} + {:.of}".format(n,a,m,b)

  print(s)

  m+=1


Example:  n = 860


Results:

860 = 29**2 + 19         (860 = 29^2 + 19) 

860 = 10**3 + -140     (860 = 10^3 - 140, and so on)

860 = 5**4 + 235

860 = 4**5 + -164

860 = 3**6 + 131


Eddie


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


  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...