Showing posts with label Swiss Micros DM41X. Show all posts
Showing posts with label Swiss Micros DM41X. Show all posts

Friday, July 26, 2024

Update: Swiss Micros DM41X Version 2.2

Update:  Swiss Micros DM41X Version 2.2 


Special thanks to Bob Prosperi of the Museum of HP Calculators.


More details and download here:  


https://www.hpmuseum.org/forum/thread-22066-post-189595.html#pid189595


Highlights include:

*  Bug fixes with display

*  Special characters are now displayed correctly in the program editor

*  The volume of the screenshot sound is increased


We are in calculator update season!


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.

Saturday, January 14, 2023

Swiss Micros DM41X: Infinite Integrals by Gaussian Quadrature

Swiss Micros DM41X:   Infinite Integrals by Gaussian Quadrature



Introduction


The program INFGAUS calculates the integral:


∫ e^-x * f(x) dx from x = a to x = ∞


f(x) is the subroutine FX.   The subroutine starts with the x value on the stack and ends with the RTN command.


The HP 45 algorithm, which is incorporated into the program INFGAUS estimates the integral by the sum


e^-a * Σ(( w_i * f(z_i + a)) for i=1 to 3)



where 


w_1 = 0.71109390099

z_1 = 0.4157745568


w_2 = 0.2785177336

z_2 = 2.29428036


w_3 = 0.0103892565

z_3 = 6.289945083




DM41X Program:  INFGAUS


The code can work is for the entire HP 41C/DM41 family.  The calculator is set to Fix 2 mode.  Registers 01 through 08 are needed.  


01  LBL^T INFGAUS

02  .4157745568

03  STO 01

04  2.29428036

05  STO 02

06  6.289945083

07  STO 03

08  .7110930099

09  STO 04

10  .278517736

11  STO 05

12  .0103892565

13  STO 06

14  FIX 2

15  ^T A?

16  PROMPT

17  STO 07

18  RCL 01

19  +

20  XEQ^T FX

21  RCL 04

22  *

23  STO 08

24  RCL 07

25  RCL 02

26  +

27  XEQ^T FX

28  RCL 05

29  *

30  ST+ 08

31  RCL 03

32  RCL 07

33  +

34  XEQ^T FX

35  RCL 06

36  *

37  RCL 08

38  +

39  RCL 07

40  CHS

41  E↑X

42  *

43  STO 08

44  END


Examples


Example 1


∫ e^-x * x^3.99 dx from x = 0 to ∞   (calculate Γ(4.99))


LBL^T FX

3.99

Y↑X

RTN


A? 0

Result:  23.64



Example 2


∫ e^-x * x^2 ÷ (x - 1)  dx from x = 2 to ∞   


LBL^T FX

X↑2

LASTx

1

-

/

RTN


A?  2

Result:  0.62



Example 3


∫ (e^-x)^2 dx from x = 0 to ∞   

= ∫ (e^-x) * (e^-x) dx from x = 0 to ∞   



LBL^T FX

CHS

E↑X

RTN


A?  0

Result:  0.50  (it turns out 0.5 is the exact answer)




Source


HP-45 Applications Handbook  Hewlett Packard Company.  1974.



Remember, my regular posting schedule for January and February 2023 is on Saturdays only. 


Eddie 


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

Swiss Micros DM41X: Setting Up Keys Through a Program

Swiss Micros DM41X:  Setting Up Keys Through a Program


Assigning User Keys Through a Program


On the HP 41/DM 41 family, it is possible to store programs or commands in a program (see Caution below).


ASN vs PASN


Both ASN and PASN assigns a user key.  ASN is not a programmable command, but PASN is.  


ASN will prompt for a key with the program or command in the alpha register. 


PASN is a programmable command with the following syntax:


^T  (program or command name)

(key code)

PASN


The key codes start in the upper left hand corner of the classic HP 41C calculators.  If you are using a Swiss Micros version, please keep in mind that the keyboard is different from the classic HP 41C but the key codes are retained.


Some common user keyboard key codes are:

[ Σ+ ] 11

[ 1/x ] 12

[ √x ] 13

[ LOG ] 14

[ LN ] 15


[x<>y] 21

[ R↓ ] 22

[SIN] 23

[COS] 24

[TAN] 25


[ENTER↑] 41

[ - ] 51

[ + ] 61

[ × ] 71

[ ÷ ] 81


Shifted user keys have a negative value, for example:

[ (shift) ] [ Σ+ ] ( Σ- )  -12

[ (shift) ] [ 1/x ] (y^x)  -13

 and so on.


Clearing Assigned Keys


To clear a single user key, assign a blank alpha string to it.  This works for both ASN and PSAN.  


You can clear all the keys by the CLKEYS command. (see Caution below).


Caution:  Unless modifications or additional ROMs are added, the commands PASN and CLKEYS are not available on the HP 41C and the HP 41CV.  The commands are available on the HP 41CX, DM41X,  DM 41, and DM 41L.  



Template



Give the user a choice to clear or load the user keys: 


LBL ^T  (main name of the program)

^T 0 CLR 1 LOAD

PROMPT

STO 00

GTO IND 00


Fortunately we can use indirect addressing with the GTO command. 


This section clears all the keys.  I put a DONE message to tell the user that the process is done.  


LBL 00

CLRKEYS

^T DONE

AVIEW

RTN          


This section loads the commands and programs to user keys.  Detailed programs will follow. 


LBL 01 

^T  (program or command name)

(key code)

PASN

...

RTN


Now for the programs and calculations created:


LBL ^T (program or command name)

(contents)

RTN

...


END 


Add an END command after the last RTN.  


The Program UFX


The program UFX presents the user with two options:  enter 0 to clear all the user keys.  Entering 1 loads the following functions:


SSPH:  Surface area of a sphere.  Assigned to the user key [ Σ+ ], key code 11.

Surface area of a sphere = 4 * π * x^2


VSPH:  Volume of a sphere.  Assigned to the user key [ x<>y ], key code 21.

Volume of a sphere = 4/3 * π * x^3


STOR:  Surface area of a torus.  Assigned to the user key [ 1/x ], key code 12. 

Surface area of a torus = 4 * π * y * x 

y = larger radius, x = smaller radius


VTOR:  Volume of a torus.  Assigned to the user key [ R↓ ], key code 22.

Volume of a torus = 2 * π^2 * y * x^2

y = larger radius, x = smaller radius


Swiss Micros DM41X Program UFX


(^T:  alpha string indicator)


01 LBL ^T UFX

02 ^T 0 CLR 1 LOAD

03 PROMPT

04 STO 00

05 GTO IND 00

06 LBL 00

07 CLRKEYS

08 ^T DONE

09 AVIEW

10 RTN          \\ RTN outside a subroutine stops the program

11 LBL 01      \\  assign the keys first, add the programs later

12 ^T SSPH

13 11

14 PASN

15 ^T VSPH

16 21

17 PASN

18 ^T STOR

19 12

20 PASN

21 ^T VTOR

22 22

23 PASN

24 ^T DONE    

25 AVIEW

26 RTN              \\ this ends the loading processing, the detialed subroutines follow 

27 LBL ^T SSPH

28 X↑2

29 PI

30 *

31 4

32 *

33 RTN

34 LBL ^T VSPH

35 3

36 Y↑X

37 4

38  *

39  3

40  /

41 PI

42  *

43 RTN

44 LBL ^T STOR

45 *

46 PI

47 X↑2

48  *

49  4

50  * 

51  RTN

52 LBL ^T VTOR

53 X↑2

54  *

55  PI

56 X↑2

57  *

58  2

59  *

60  RTN

61  END     \\ we want to end the program with END


Source (for the Torus formulas):


Mathematics Program Library:  Sinclair Enterprise Programmable  Sinclair Radionics Inc.  New York; Cambridgeshire, London.  1975


That is all this time, see you next time!


Eddie 


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


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. 


Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...