[comp.sys.handhelds] Periodic Table

fseipel@magnus.acs.ohio-state.edu (Frank E Seipel) (04/20/91)

{ from the Hewlett Packard calculator BBS (telnet hpcvbbs.hp.com) }:

Item: 262 by _ryanh at hpcvbbs.UUCP
Author: [Ryan Hill]
  Subj: Chemistry
  Keyw: atomic fmula weights and periodic table
  Date: Thu Apr 18 1991 20:15
 Lines: 17

This is a program that given an abbreviation, like Pb, will
give the atomic number, weight, and full name like a periodic
table.  I wish the search routine could be in machine language,
but I couldn't do that.  If you can, please do.  Or, given a
formula, like H2O, it will give the weight of the formula, typed in
as {"H" 2 "O" 1}.
There are five programs, FORM, for the formula mass.  FIND, takes
an abbreviation and gives info.  SHW, used by FIND to display values.
NAM, names of all of the elements.  ELM, atomic number, and weight
data on the elements.
Input for FIND just has to be a symbol for an element, don't use quotes!
Input for FORM goes like this.  You put the symbol in quotes,
followed by the amount of it, (don't forget to put 1 when it is only
one!) and so on.  This must be in a list though.
I wished that I could have a picture of the table, and flip through it
like the Chem Applications Pac cartridge.  If anybody can, please do.
Please upload any revisions. Thanks.                            

%%HP: T(1)A(D)F(.);
DIR
  FORM
    + 0 0 0 0 
 S T
Y Z
      + DUP 'S' STO
SIZE 1 SWAP
        FOR x 'S' x
GET 'Z' STO 1 324
          FOR I
'ELM' I 1 + GET
            IF Z ==
            THEN
'ELM' I 2 + GET 'Y'
STO 324 'I' STO
            END 3
          STEP 'S'
x 1 + GET Y * 'T'
STO+ 2
        STEP T
      ;
    ;
  FIND
    + "" + 
 A
      + 1 324
        FOR x 'ELM'
x 1 + GET
          IF A ==
          THEN x
'X' STO SHW
          END 3
        STEP
      ;
    ;
  SHW
    + 'ELM' X GET
DUP "ATOMIC#" 
TAG
SWAP 'NAM' SWAP GET
"NAME" 
TAG 'ELM' X
1 + GET "SYMBOL"

TAG 'ELM' X 2 +
GET "ATWT" 
TAG 'X'
PURGE KILL
    ;
  NAM { "Hydrogen"
"Helium" "Lithium"
"Beryllium" "Boron"
"Carbon" "Nitrogen"
"Oxygen" "Flourine"
"Neon" "Sodium"
"Magnesium"
"Aluminum"
"Silicon"
"Phosphorous"
"Sulfur" "Chlorine"
"Argon" "Potassium"
"Calcium"
"Scandium"
"Titanium"
"Vanadium"
"Cromium"
"Manganese" "Iron"
"Cobalt" "Nickel"
"Copper" "Zinc"
"Gallium"
"Germanium"
"Arsenic"
"Selenium"
"Bromine" "Krypton"
"Rubidium"
"Strontium"
"Yttrium"
"Zirconium"
"Niobium"
"Molybdenum"
"Technetium"
"Ruthenium"
"Rhodium"
"Palladium"
"Silver" "Cadmium"
"Indium" "Tin"
"Antimony"
"Tellurium"
"Iodine" "Xenon"
"Cesium" "Barium"
"Lanthanum"
"Cerium"
"Praseodymeum"
"Neodymium"
"Promethium"
"Samarium"
"Europium"
"Gadolinium"
"Terbium"
"Dyprosium"
"Holmium" "Erbium"
"Thulium"
"Ytterbium"
"Lutetium"
"Hafneum"
"Tantalum"
"Tungsten"
"Rhenium" "Osmium"
"Iridium"
"Platinum" "Gold"
"Mercury"
"Thallium" "Lead"
"Bismuth"
"Polonium"
"Astatine" "Radon"
"Francium" "Radium"
"Actinium"
"Thorium"
"Protactinium"
"Uranium"
"Neptunium"
"Plutonium"
"Americium"
"Curium"
"Berkelium"
"Californium"
"Einsteinium"
"Fermium"
"Mendelevium"
"Nobilium"
"Lawrencium"
"Unknown" "Unknown"
"Unknown" "Unknown"
"" "Unknown" }
  ELM { 1 "H"
1.0079 2 "He"
4.0026 3 "Li" 6.941
4 "Be" 9.0122 5 "B"
10.81 6 "C" 12.011
7 "N" 14.007 8 "O"
15.999 9 "F" 18.998
10 "Ne" 20.179 11
"Na" 22.99 12 "Mg"
24.305 13 "Al"
26.982 14 "Si"
28.086 15 "P"
30.974 16 "S" 32.06
17 "Cl" 35.453 18
"Ar" 39.948 19 "K"
39.098 20 "Ca"
40.08 21 "Sc"
44.956 22 "Ti" 47.9
23 "V" 50.941 24
"Cr" 51.996 25 "Mn"
54.938 26 "Fe"
55.847 27 "Co"
58.933 28 "Ni"
58.71 29 "Cu"
63.546 30 "Zn"
65.38 31 "Ga" 69.72
32 "Ge" 72.59 33
"As" 74.922 34 "Se"
78.96 35 "Br"
79.904 36 "Kr" 83.8
37 "Rb" 85.468 38
"Sr" 87.62 39 "Y"
88.906 40 "Zr"
91.22 41 "Nb"
92.906 42 "Mo"
95.94 43 "Tc" 97 44
"Ru" 101.07 45 "Rh"
102.91 46 "Pd"
106.4 47 "Ag"
107.87 48 "Cd"
112.41 49 "In"
114.82 50 "Sn"
118.69 51 "Sb"
121.75 52 "Te"
127.6 53 "I" 126.9
54 "Xe" 131.3 55
"Cs" 132.91 56 "Ba"
137.33 57 "La"
138.91 58 "Ce"
140.12 59 "Pr"
140.91 60 "Nd"
144.24 61 "Pm" 145
62 "Sm" 150.4 63
"Eu" 151.96 64 "Gd"
157.25 96 "Tb"
158.93 66 "Dy"
162.5 67 "Ho"
164.93 68 "Er"
167.26 69 "Tm"
168.93 70 "Yb"
173.04 71 "Lu"
174.97 72 "Hf"
178.49 73 "Ta"
180.95 74 "W"
183.85 75 "Re"
186.21 76 "Os"
190.2 77 "Ir"
192.22 78 "Pt"
195.09 79 "Au"
196.97 80 "Hg"
200.59 81 "Tl"
204.37 82 "Pb"
207.2 83 "Bi"
208.98 84 "Po" 209
85 "At" 210 86 "Rn"
222 87 "Fr" 223 88
"Ra" 226.03 89 "Ac"
227 90 "Th" 232.04
91 "Pa" 231.04 92
"U" 238.03 93 "Np"
237.05 94 "Pu" 244
95 "Am" 243 96 "Cm"
247 97 "Bk" 247 98
"Cf" 251 99 "Es"
254 100 "Fm" 257
101 "Md" 258 102
"No" 259 103 "Lr"
260 104 "Unk" 261
105 "Unk" 262 106
"Unk" 263 107 "Unk"
264 109 "Unk" 266 }
END

fin@norge.unet.umn.edu (Craig A. Finseth) (04/24/91)

In article <1991Apr19.215621.2022@magnus.acs.ohio-state.edu> fseipel@magnus.acs.ohio-state.edu (Frank E Seipel) writes:
>{ from the Hewlett Packard calculator BBS (telnet hpcvbbs.hp.com) }:
>
>Item: 262 by _ryanh at hpcvbbs.UUCP
>Author: [Ryan Hill]
>  Subj: Chemistry
>  Keyw: atomic fmula weights and periodic table
>  Date: Thu Apr 18 1991 20:15
> Lines: 17
>
>This is a program that given an abbreviation, like Pb, will
>give the atomic number, weight, and full name like a periodic
>table.  I wish the search routine could be in machine language,
>but I couldn't do that.  If you can, please do.  Or, given a
	...

I tried downloading this last night and couln't.  After an hour or so
of hacking, I wound up with a re-written form.  It is several hundred
bytes smaller and runs faster.

Changes:

- Dropped the atomic numbers from the ELM list, as these are used as
an index into the list!

- Reworked the interfaces (e.g., you now enter atomic symbols in ""s, for
those of us who might have variable name conflicts).

- Used translation type 3 for the upload!

- Include checksum and size information.

I did not rewrite the "FORM" routine: I leave that as an excercise for
the reader.

SYMB		Accepts a name in quotes and returns the information on the
		element.
ANUM		Accepts an atomic number and returns the information on the
		element.
NAM		The 109 atomic names.
ELM		The 109 atomic properties as "symbol1 weight1 symbol2
		weight2..."

Craig A. Finseth			fin@unet.umn.edu [CAF13]
University Networking Services		+1 612 624 3375 desk
University of Minnesota			+1 612 625 0006 problems
130 Lind Hall, 207 Church St SE		+1 612 626 1002 FAX
Minneapolis MN 55455-0134, U.S.A.


Checksum: #10b9h
Size: 3579.5
------------------------------------------------------------
%%HP: T(3)A(D)F(.);
DIR
  SYMB
    \<< \-> S
      \<< 1 109
        FOR x 'ELM'
x 2 * 1 - GET
          IF S ==
          THEN x
ANUM 110 'x' STO
          END
        NEXT
      \>>
    \>>
  ANUM
    \<< \-> N
      \<< N "ATOMIC#"
\->TAG 'NAM' N GET
"NAME" \->TAG 'ELM' N
2 * 1 - GET
"SYMBOL" \->TAG 'ELM'
N 2 * GET "ATWT"
\->TAG
      \>>
    \>>
  NAM { "Hydrogen"
"Helium" "Lithium"
"Beryllium" "Boron"
"Carbon" "Nitrogen"
"Oxygen" "Flourine"
"Neon" "Sodium"
"Magnesium"
"Aluminum"
"Silicon"
"Phosphorous"
"Sulfur" "Chlorine"
"Argon" "Potassium"
"Calcium"
"Scandium"
"Titanium"
"Vanadium"
"Cromium"
"Manganese" "Iron"
"Cobalt" "Nickel"
"Copper" "Zinc"
"Gallium"
"Germanium"
"Arsenic"
"Selenium"
"Bromine" "Krypton"
"Rubidium"
"Strontium"
"Yttrium"
"Zirconium"
"Niobium"
"Molybdenum"
"Technetium"
"Ruthenium"
"Rhodium"
"Palladium"
"Silver" "Cadmium"
"Indium" "Tin"
"Antimony"
"Tellurium"
"Iodine" "Xenon"
"Cesium" "Barium"
"Lanthanum"
"Cerium"
"Praseodymeum"
"Neodymium"
"Promethium"
"Samarium"
"Europium"
"Gadolinium"
"Terbium"
"Dyprosium"
"Holmium" "Erbium"
"Thulium"
"Ytterbium"
"Lutetium"
"Hafneum"
"Tantalum"
"Tungsten"
"Rhenium" "Osmium"
"Iridium"
"Platinum" "Gold"
"Mercury"
"Thallium" "Lead"
"Bismuth"
"Polonium"
"Astatine" "Radon"
"Francium" "Radium"
"Actinium"
"Thorium"
"Protactinium"
"Uranium"
"Neptunium"
"Plutonium"
"Americium"
"Curium"
"Berkelium"
"Californium"
"Einsteinium"
"Fermium"
"Mendelevium"
"Nobilium"
"Lawrencium"
"Unknown" "Unknown"
"Unknown" "Unknown"
"" "Unknown" }
  ELM { "H" 1.0079
"He" 4.0026 "Li"
6.941 "Be" 9.0122
"B" 10.81 "C"
12.011 "N" 14.007
"O" 15.999 "F"
18.998 "Ne" 20.179
"Na" 22.99 "Mg"
24.305 "Al" 26.982
"Si" 28.086 "P"
30.974 "S" 32.06
"Cl" 35.453 "Ar"
39.948 "K" 39.098
"Ca" 40.08 "Sc"
44.956 "Ti" 47.9
"V" 50.941 "Cr"
51.996 "Mn" 54.938
"Fe" 55.847 "Co"
58.933 "Ni" 58.71
"Cu" 63.546 "Zn"
65.38 "Ga" 69.72
"Ge" 72.59 "As"
74.922 "Se" 78.96
"Br" 79.904 "Kr"
83.8 "Rb" 85.468
"Sr" 87.62 "Y"
88.906 "Zr" 91.22
"Nb" 92.906 "Mo"
95.94 "Tc" 97 "Ru"
101.07 "Rh" 102.91
"Pd" 106.4 "Ag"
107.87 "Cd" 112.41
"In" 114.82 "Sn"
118.69 "Sb" 121.75
"Te" 127.6 "I"
126.9 "Xe" 131.3
"Cs" 132.91 "Ba"
137.33 "La" 138.91
"Ce" 140.12 "Pr"
140.91 "Nd" 144.24
"Pm" 145 "Sm" 150.4
"Eu" 151.96 "Gd"
157.25 "Tb" 158.93
"Dy" 162.5 "Ho"
164.93 "Er" 167.26
"Tm" 168.93 "Yb"
173.04 "Lu" 174.97
"Hf" 178.49 "Ta"
180.95 "W" 183.85
"Re" 186.21 "Os"
190.2 "Ir" 192.22
"Pt" 195.09 "Au"
196.97 "Hg" 200.59
"Tl" 204.37 "Pb"
207.2 "Bi" 208.98
"Po" 209 "At" 210
"Rn" 222 "Fr" 223
"Ra" 226.03 "Ac"
227 "Th" 232.04
"Pa" 231.04 "U"
238.03 "Np" 237.05
"Pu" 244 "Am" 243
"Cm" 247 "Bk" 247
"Cf" 251 "Es" 254
"Fm" 257 "Md" 258
"No" 259 "Lr" 260
"Unk" 261 "Unk" 262
"Unk" 263 "Unk" 264
"Unk" 0 "Unk" 266 }
END