Constants

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
grsbanks
Posts: 680
Joined: Tue Apr 25, 2017 9:23 am
Location: Preston, Lancs, UK

Constants

Post by grsbanks » Sat Dec 16, 2017 1:57 pm

A library of physical constants was asked for recently so I came up with this solution to the problem. The constants here are based on those embedded in the HP-35S:

Code: Select all

00 { 1070-Byte Prgm }
01▸LBL "CONST"
02▸LBL A
03 "c"
04 KEY 1 XEQ 01
05 "g"
06 KEY 2 XEQ 02
07 "G"
08 KEY 3 XEQ 03
09 "Vm"
10 KEY 4 XEQ 04
11 "NA"
12 KEY 5 XEQ 05
13 "Rydb"
14 KEY 6 XEQ 06
15 KEY 7 GTO G
16 KEY 8 GTO B
17 KEY 9 GTO I
18 MENU
19 STOP
20 GTO A
21▸LBL I
22 EXITALL
23 STOP
24 GTO A
25▸LBL 01
26 299792458
27 RTN
28▸LBL 02
29 9.80665
30 RTN
31▸LBL 03
32 6673ᴇ-14
33 RTN
34▸LBL 04
35 0.022413996
36 RTN
37▸LBL 05
38 602214199ᴇ15
39 RTN
40▸LBL 06
41 10973731.5685
42 RTN
43▸LBL B
44 "eV"
45 KEY 1 XEQ 11
46 "me"
47 KEY 2 XEQ 12
48 "mp"
49 KEY 3 XEQ 13
50 "mn"
51 KEY 4 XEQ 14
52 "mμ"
53 KEY 5 XEQ 15
54 "k"
55 KEY 6 XEQ 16
56 KEY 7 GTO A
57 KEY 8 GTO C
58 KEY 9 GTO I
59 MENU
60 STOP
61 GTO B
62▸LBL 11
63 1602176462ᴇ-28
64 RTN
65▸LBL 12
66 910938188ᴇ23
67 RTN
68▸LBL 13
69 167262158ᴇ-35
70 RTN
71▸LBL 14
72 167492716ᴇ-35
73 RTN
74▸LBL 15
75 188353109ᴇ-36
76 RTN
77▸LBL 16
78 13806503ᴇ-30
79 RTN
80▸LBL C
81 "h"
82 KEY 1 XEQ 21
83 "MagFQ"
84 KEY 2 XEQ 22
85 "ao"
86 KEY 3 XEQ 23
87 "ᴇo"
88 KEY 4 XEQ 24
89 "R"
90 KEY 5 XEQ 25
91 "F"
92 KEY 6 XEQ 26
93 KEY 7 GTO B
94 KEY 8 GTO D
95 KEY 9 GTO I
96 MENU
97 STOP
98 GTO C
99▸LBL 21
100 662606876ᴇ-42
101 RTN
102▸LBL 22
103 2067833636ᴇ-24
104 RTN
105▸LBL 23
106 5291772083ᴇ-20
107 RTN
108▸LBL 24
109 8854187817ᴇ-21
110 RTN
111▸LBL 25
112 8.314472
113 RTN
114▸LBL 26
115 96485.3415
116 RTN
117▸LBL D
118 "u"
119 KEY 1 XEQ 31
120 "μo"
121 KEY 2 XEQ 32
122 "μB"
123 KEY 3 XEQ 33
124 "μN"
125 KEY 4 XEQ 34
126 "μP"
127 KEY 5 XEQ 35
128 "μe"
129 KEY 6 XEQ 36
130 KEY 7 GTO C
131 KEY 8 GTO E
132 KEY 9 GTO I
133 MENU
134 STOP
135 GTO D
136▸LBL 31
137 166053873ᴇ-35
138 RTN
139▸LBL 32
140 1.2566370614ᴇ-6
141 RTN
142▸LBL 33
143 927400899ᴇ-32
144 RTN
145▸LBL 34
146 505078317ᴇ-35
147 RTN
148▸LBL 35
149 1410606633ᴇ-35
150 RTN
151▸LBL 36
152 -928476362ᴇ-32
153 RTN
154▸LBL E
155 "μn"
156 KEY 1 XEQ 41
157 "μμ"
158 KEY 2 XEQ 42
159 "re"
160 KEY 3 XEQ 43
161 "Zo"
162 KEY 4 XEQ 44
163 "/\c"
164 KEY 5 XEQ 45
165 "/\cn"
166 KEY 6 XEQ 46
167 KEY 7 GTO D
168 KEY 8 GTO F
169 KEY 9 GTO I
170 MENU
171 STOP
172 GTO E
173▸LBL 41
174 -9662364ᴇ-33
175 RTN
176▸LBL 42
177 -449044813ᴇ-34
178 RTN
179▸LBL 43
180 2817940285ᴇ-24
181 RTN
182▸LBL 44
183 376.730313461
184 RTN
185▸LBL 45
186 2426310215ᴇ-21
187 RTN
188▸LBL 46
189 1319590898ᴇ-24
190 RTN
191▸LBL F
192 "/\cp"
193 KEY 1 XEQ 51
194 "a"
195 KEY 2 XEQ 52
196 "s"
197 KEY 3 XEQ 53
198 "t"
199 KEY 4 XEQ 54
200 "atm"
201 KEY 5 XEQ 55
202 "gP"
203 KEY 6 XEQ 56
204 KEY 7 GTO E
205 KEY 8 GTO G
206 KEY 9 GTO I
207 MENU
208 STOP
209 GTO F
210▸LBL 51
211 1321409847ᴇ-24
212 RTN
213▸LBL 52
214 0.007297352533
215 RTN
216▸LBL 53
217 5.6704ᴇ-8
218 RTN
219▸LBL 54
220 273.15
221 RTN
222▸LBL 55
223 101325
224 RTN
225▸LBL 56
226 267522212
227 RTN
228▸LBL G
229 CLMENU
230 "C1"
231 KEY 1 XEQ 61
232 "C2"
233 KEY 2 XEQ 62
234 "Go"
235 KEY 3 XEQ 63
236 "e"
237 KEY 4 XEQ 64
238 KEY 7 GTO F
239 KEY 8 GTO A
240 KEY 9 GTO I
241 MENU
242 STOP
243 GTO G
244▸LBL 61
245 374177107ᴇ-24
246 RTN
247▸LBL 62
248 0.014387752
249 RTN
250▸LBL 63
251 7.748091696ᴇ-5
252 RTN
253▸LBL 64
254 2.71828182846
255 RTN
256 END
The raw file of this is available at http://howto-pages.org/SwissMicros/const.raw
Not SwissMicros staff, just an enthusiast.

Bernd
Posts: 10
Joined: Sat Jul 22, 2017 8:17 pm

Re: Constants

Post by Bernd » Sun Jan 07, 2018 8:36 pm

Hello grsbanks,
Thanks for programming the constants library. I like it very much. I have updated the constants from the latest CODATA set (2015).
See attached listing. I hope that they will be useful for somebody else.

Code: Select all

00 { 1069-Byte Prgm }
01▸LBL "CONST"
02▸LBL A
03 "c"
04 KEY 1 XEQ 01
05 "g"
06 KEY 2 XEQ 02
07 "G"
08 KEY 3 XEQ 03
09 "Vm"
10 KEY 4 XEQ 04
11 "NA"
12 KEY 5 XEQ 05
13 "Rydb"
14 KEY 6 XEQ 06
15 KEY 7 GTO G
16 KEY 8 GTO B
17 KEY 9 GTO I
18 MENU
19 STOP
20 GTO A
21▸LBL I
22 EXITALL
23 STOP
24 GTO A
25▸LBL 01
26 299792458
27 RTN
28▸LBL 02
29 9.80665
30 RTN
31▸LBL 03
32 667408ᴇ-16
33 RTN
34▸LBL 04
35 0.022710947
36 ENTER
37 RTN
38▸LBL 05
39 6022140857ᴇ14
40 RTN
41▸LBL 06
42 10973731.568508
43 RTN
44▸LBL B
45 "eV"
46 KEY 1 XEQ 11
47 "me"
48 KEY 2 XEQ 12
49 "mp"
50 KEY 3 XEQ 13
51 "mn"
52 KEY 4 XEQ 14
53 "mμ"
54 KEY 5 XEQ 15
55 "k"
56 KEY 6 XEQ 16
57 KEY 7 GTO A
58 KEY 8 GTO C
59 KEY 9 GTO I
60 MENU
61 STOP
62 GTO B
63▸LBL 11
64 16021766208ᴇ-29
65 RTN
66▸LBL 12
67 910938356ᴇ-39
68 RTN
69▸LBL 13
70 1672621898ᴇ-36
71 RTN
72▸LBL 14
73 1674927471ᴇ-36
74 ENTER
75 RTN
76▸LBL 15
77 1883531594ᴇ-37
78 RTN
79▸LBL 16
80 138064852ᴇ-31
81 RTN
82▸LBL C
83 "h"
84 KEY 1 XEQ 21
85 "MagFQ"
86 KEY 2 XEQ 22
87 "ao"
88 KEY 3 XEQ 23
89 "ᴇo"
90 KEY 4 XEQ 24
91 "R"
92 KEY 5 XEQ 25
93 "F"
94 KEY 6 XEQ 26
95 KEY 7 GTO B
96 KEY 8 GTO D
97 KEY 9 GTO I
98 MENU
99 STOP
100 GTO C
101▸LBL 21
102 662607004ᴇ-42
103 RTN
104▸LBL 22
105 2067833831ᴇ-24
106 RTN
107▸LBL 23
108 52917721067ᴇ-21
109 RTN
110▸LBL 24
111 XEQ 32
112 XEQ 01
113 X↑2
114 ×
115 1/X
116 RTN
117▸LBL 25
118 8.3144598
119 RTN
120▸LBL 26
121 96485.33289
122 RTN
123▸LBL D
124 "u"
125 KEY 1 XEQ 31
126 "μo"
127 KEY 2 XEQ 32
128 "μB"
129 KEY 3 XEQ 33
130 "μN"
131 KEY 4 XEQ 34
132 "μP"
133 KEY 5 XEQ 35
134 "μe"
135 KEY 6 XEQ 36
136 KEY 7 GTO C
137 KEY 8 GTO E
138 KEY 9 GTO I
139 MENU
140 STOP
141 GTO D
142▸LBL 31
143 166053904ᴇ-35
144 RTN
145▸LBL 32
146 4ᴇ-7
147 PI
148 ×
149 RTN
150▸LBL 33
151 9274009994ᴇ-33
152 RTN
153▸LBL 34
154 5050783699ᴇ-36
155 RTN
156▸LBL 35
157 14106067873ᴇ-36
158 RTN
159▸LBL 36
160 -928476462ᴇ-32
161 RTN
162▸LBL E
163 "μn"
164 KEY 1 XEQ 41
165 "μμ"
166 KEY 2 XEQ 42
167 "re"
168 KEY 3 XEQ 43
169 "Zo"
170 KEY 4 XEQ 44
171 "/\c"
172 KEY 5 XEQ 45
173 "/\cn"
174 KEY 6 XEQ 46
175 KEY 7 GTO D
176 KEY 8 GTO F
177 KEY 9 GTO I
178 MENU
179 STOP
180 GTO E
181▸LBL 41
182 -9662365ᴇ-33
183 RTN
184▸LBL 42
185 -449044826ᴇ-34
186 RTN
187▸LBL 43
188 28179403227ᴇ-25
189 RTN
190▸LBL 44
191 XEQ 01
192 XEQ 32
193 ×
194 RTN
195▸LBL 45
196 24263102367ᴇ-22
197 RTN
198▸LBL 46
199 131959090481ᴇ-26
200 RTN
201▸LBL F
202 "/\cp"
203 KEY 1 XEQ 51
204 "a"
205 KEY 2 XEQ 52
206 "s"
207 KEY 3 XEQ 53
208 "t"
209 KEY 4 XEQ 54
210 "atm"
211 KEY 5 XEQ 55
212 "gP"
213 KEY 6 XEQ 56
214 KEY 7 GTO E
215 KEY 8 GTO G
216 KEY 9 GTO I
217 MENU
218 STOP
219 GTO F
220▸LBL 51
221 132140985396ᴇ-26
222 RTN
223▸LBL 52
224 0.0072973525664
225 RTN
226▸LBL 53
227 5.670367ᴇ-8
228 RTN
229▸LBL 54
230 273.15
231 RTN
232▸LBL 55
233 101325
234 RTN
235▸LBL 56
236 2.6752219ᴇ-8
237 RTN
238▸LBL G
239 CLMENU
240 "C1"
241 KEY 1 XEQ 61
242 "C2"
243 KEY 2 XEQ 62
244 "Go"
245 KEY 3 XEQ 63
246 "e"
247 KEY 4 XEQ 64
248 KEY 7 GTO F
249 KEY 8 GTO A
250 KEY 9 GTO I
251 MENU
252 STOP
253 GTO G
254▸LBL 61
255 374177179ᴇ-24
256 RTN
257▸LBL 62
258 0.0143877736
259 RTN
260▸LBL 63
261 7.748091731ᴇ-5
262 RTN
263▸LBL 64
264 1
265 E↑X
266 RTN
267 END
Attachments
const.zip
(922 Bytes) Downloaded 70 times

User avatar
salvomic
Posts: 58
Joined: Sat Dec 30, 2017 9:09 am
Location: Ragusa, Sicily
Contact:

Re: Constants

Post by salvomic » Sat Feb 10, 2018 11:15 am

thank you both, very appreciated!

Please, could put here a list to explicate better the abbreviations (some not so clear at a glance: i.e. /\c for λc ...)?
There is no ℏ? In the HP35s catalog there is.
Ok, I could do [h] π 2 x ÷, I know...

However, it is a very useful program, I just installed it in my new DM42 :)

Salvo
∫aL√0mic (IT9CLU) - DM42 (SN: 00881), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, HP 35s, WP34s :: Free42

Olaf
Posts: 21
Joined: Fri Nov 03, 2017 9:15 am
Location: France

Re: Constants

Post by Olaf » Sat Feb 10, 2018 5:30 pm

I'm not sure many have had the chance to see my post in another thread viewtopic.php?f=15&t=280&p=4528#p452 about extending the help viewer as a very convenient constants library (with description, units, greek symbols...), supporting a copy-to-keyboard function to export constant value to the stack...

I still think it could be great to have these constant values together with textual explanation of the physical/chemical/mathematical backgrounds, and a way to easily make use of the constant when selected. Being based on HTML, it could offer a proper categorization of constants, with dedicated tables for each field of use.
I even think about equation lib being available in nearly the same way. Select an EQ and a new program containing your equation, ready to be SOLVEd , is stored (similar to file load from usb storage).

What do you DM42 users think about it ?
Is it worth asking Michael & David about this ? (suggested answer: of course !!)

Regards,

Olivier
-----------------------------------------------------------------
HP48G, DM42 (# 276), a slide rule and a C compiler :-)

User avatar
salvomic
Posts: 58
Joined: Sat Dec 30, 2017 9:09 am
Location: Ragusa, Sicily
Contact:

Re: Constants

Post by salvomic » Mon Feb 12, 2018 5:29 pm

thanks Olivier.
However the list of the HP-35s constants is here (scroll about at mean of the page).

Salvo
∫aL√0mic (IT9CLU) - DM42 (SN: 00881), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, HP 35s, WP34s :: Free42

keithdalby
Posts: 487
Joined: Mon Apr 24, 2017 6:38 pm

Re: Constants

Post by keithdalby » Tue Feb 13, 2018 5:49 pm

Thank you grsbanks. Your program inspired me to make one for the A Level Physics constants from here.

Code: Select all

00 { 671-Byte Prgm }
01▸LBL "CONSTS"
02▸LBL 01
03 "mu0"
04 KEY 1 GTO 51
05 "eps0"
06 KEY 2 GTO 52
07 "h"
08 KEY 3 GTO 53
09 "G"
10 KEY 4 GTO 54
11 "NA"
12 KEY 5 GTO 55
13 "R"
14 KEY 6 GTO 56
15 KEY 7 GTO 05
16 KEY 8 GTO 02
17 KEY 9 GTO 09
18 MENU
19 STOP
20 GTO 01
21▸LBL 09
22 EXITALL
23 STOP
24 GTO "CONSTS"
25▸LBL 02
26 "k"
27 KEY 1 GTO 57
28 "me"
29 KEY 2 GTO 58
30 "e/me"
31 KEY 3 GTO 59
32 "mp"
33 KEY 4 GTO 60
34 "e/mp"
35 KEY 5 GTO 61
36 "mn"
37 KEY 6 GTO 62
38 KEY 7 GTO 01
39 KEY 8 GTO 03
40 KEY 9 GTO 09
41 MENU
42 STOP
43 GTO 02
44▸LBL 03
45 "u"
46 KEY 1 GTO 63
47 "msun"
48 KEY 2 GTO 64
49 "rsun"
50 KEY 3 GTO 65
51 "mear"
52 KEY 4 GTO 66
53 "rear"
54 KEY 5 GTO 67
55 "eMeV"
56 KEY 6 GTO 68
57 KEY 7 GTO 02
58 KEY 8 GTO 04
59 KEY 9 GTO 09
60 MENU
61 STOP
62 GTO 03
63▸LBL 04
64 "muMeV"
65 KEY 1 GTO 69
66 "piMeV"
67 KEY 2 GTO 70
68 "p0MeV"
69 KEY 3 GTO 71
70 "KMeV"
71 KEY 4 GTO 72
72 "K0MeV"
73 KEY 5 GTO 73
74 "pMeV"
75 KEY 6 GTO 74
76 KEY 7 GTO 03
77 KEY 8 GTO 05
78 KEY 9 GTO 09
79 MENU
80 STOP
81 GTO 04
82▸LBL 05
83 "nMeV"
84 KEY 1 GTO 75
85 "uMeV"
86 KEY 2 GTO 76
87 CLA
88 KEY 3 GTO 05
89 KEY 4 GTO 05
90 "e"
91 KEY 5 GTO 77
92 "g"
93 KEY 6 GTO 78
94 KEY 7 GTO 04
95 KEY 8 GTO 01
96 KEY 9 GTO 09
97 MENU
98 STOP
99 GTO 05
100▸LBL 51
101 1.256637061435917295385057353311801ᴇ-6
102 RTN
103▸LBL 52
104 885ᴇ-14
105 RTN
106▸LBL 53
107 663ᴇ-36
108 RTN
109▸LBL 54
110 667ᴇ-13
111 RTN
112▸LBL 55
113 602ᴇ21
114 RTN
115▸LBL 56
116 8.31
117 RTN
118▸LBL 57
119 138ᴇ-25
120 RTN
121▸LBL 58
122 911ᴇ-33
123 RTN
124▸LBL 59
125 176ᴇ9
126 RTN
127▸LBL 60
128 1673ᴇ-30
129 RTN
130▸LBL 61
131 958ᴇ5
132 RTN
133▸LBL 62
134 1675ᴇ-30
135 RTN
136▸LBL 63
137 1661ᴇ-30
138 RTN
139▸LBL 64
140 199ᴇ28
141 RTN
142▸LBL 65
143 696ᴇ6
144 RTN
145▸LBL 66
146 598ᴇ22
147 RTN
148▸LBL 67
149 637ᴇ4
150 RTN
151▸LBL 68
152 0.510999
153 RTN
154▸LBL 69
155 105.659
156 RTN
157▸LBL 70
158 139.576
159 RTN
160▸LBL 71
161 134.972
162 RTN
163▸LBL 72
164 493.821
165 RTN
166▸LBL 73
167 497.762
168 RTN
169▸LBL 74
170 938.257
171 RTN
172▸LBL 75
173 939.551
174 RTN
175▸LBL 76
176 931.3
177 ENTER
178 RTN
179▸LBL 77
180 16ᴇ-20
181 RTN
182▸LBL 78
183 9.81
184 RTN
185 END
I left the speed of light off, not sure why, might add it later anyway. The file is here:
consts.zip
(590 Bytes) Downloaded 45 times

User avatar
pica
Posts: 19
Joined: Fri Mar 30, 2018 9:36 am
Location: eSwatini

Re: Constants

Post by pica » Fri Sep 07, 2018 7:40 am

Here is another way of doing constants. They are all in an nx2 matrix called Const.
As the DM42 cannot import a matrix directly, the program generates the constants matrix.
I usually edit it on a PC for ease of copying and pasting long numbers.
There is a short wrapper routine at the end to index the matrix and open it in the editor.
Scroll through the matrix, and the desired constant is left on the X-register on exit.
The program regenerates the matrix on each run, so any damage to it will be temporary.

The program is designed to be easily customised for the constants you like most.

Many of the constants are from NIST: https://physics.nist.gov/cuu/Constants/ ... lascii.txt

Code: Select all

00 { 496-Byte Prgm }
01▸LBL "Const" @ Prepare the matrix Const
02 2
03 ENTER
04 NEWMAT
05 STO "Const"
06 R↓ @ Helps keep X and Y registers intact
07 INDEX "Const"
08 GROW
09 "c" @ List of constants starts here
10 XEQ 01
11 299792458
12 XEQ 02
13 "Na"
14 XEQ 01
15 6.022140857ᴇ23
16 XEQ 02
17 "Vm"
18 XEQ 01
19 22.413962
20 XEQ 02
21 "atm"
22 XEQ 01
23 101.325
24 XEQ 02
25 "T"
26 XEQ 01
27 273.15
28 XEQ 02
29 "g"
30 XEQ 01
31 9.80665
32 XEQ 02
33 "h"
34 XEQ 01
35 6.626070040ᴇ-34
36 XEQ 02
37 "h/2pi"
38 XEQ 01
39 1.054571800ᴇ-34
40 XEQ 02
41 "e"
42 XEQ 01
43 1.6021766208ᴇ-19
44 XEQ 02
45 "G"
46 XEQ 01
47 6.67408ᴇ-11
48 XEQ 02
49 "e/m"
50 XEQ 01
51 -1.758820024ᴇ11
52 XEQ 02
53 "me"
54 XEQ 01
55 9.10938356ᴇ-31
56 XEQ 02
57 "mp"
58 XEQ 01
59 1.672621898ᴇ-27
60 XEQ 02
61 "mn"
62 XEQ 01
63 1.674927471ᴇ-27
64 XEQ 02
65 "Ee"
66 XEQ 01
67 8.18710565ᴇ-14
68 XEQ 02
69 "Ep"
70 XEQ 01
71 1.503277593ᴇ-10
72 XEQ 02
73 "En"
74 XEQ 01
75 1.505349739ᴇ-10
76 XEQ 02
77 "inch"
78 XEQ 01
79 2.54
80 XEQ 02
81 "LtYr"
82 XEQ 01
83 9461ᴇ12
84 XEQ 02
85 "pound"
86 XEQ 01
87 0.45359237 @ The last constant should not open a new row so do not execute LBL 02
88 STOEL
89▸LBL 03 @ Wrapper to read Const matrix. Could be a stand-alone routine.
90 INDEX "Const"
91 EDITN "Const"
92 RTN
93▸LBL 01
94 R↑ @ Helps keep X and Y regs intact
95 ASTO ST X
96▸LBL 02
97 STOEL
98 →
99 R↓ @ Helps keep X and Y regs intact
100 RTN

Post Reply