Platonic solids

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
Giuseppe Casale
Posts: 8
Joined: Mon Mar 04, 2019 10:35 pm
Location: Osnago - Italy

Platonic solids

Post by Giuseppe Casale » Fri Mar 08, 2019 12:10 pm

This program will compute surface area, volume, inscribed sphere radius and circumscribed sphere radius for each of 5 platonic solids given the edge value.
The attached zip file contains raw file, listing, instructions and examples.

Code: Select all

00 { 671-Byte Prgm }
00 { 671-Byte Prgm }
01▸LBL "PLATO"			Main routine
02 0
03 STO "EDGE"			EDGE initializing
04 "TET"				
05 KEY 1 XEQ "TET"		Tetrahedron key
06 "CUB"
07 KEY 2 XEQ "CUB"		Cube key
08 "OCT"
09 KEY 3 XEQ "OCT"		Octahedron key
10 "DOD"
11 KEY 4 XEQ "DOD"		Dodecahedron key
12 "ICO"
13 KEY 5 XEQ "ICO"		Icosahedron key
14 MENU				Main menu
15 STOP
16▸LBL "TET"			Tetrahedron routine
17 XEQ "EDGE-IN"		EDGE	input
18 X↑2
19 3
20 SQRT
21 ×
22 STO "SUR"			Surface area
23 RCL "EDGE"
24 3
25 Y↑X
26 2
27 SQRT
28 ×
29 12
30 ÷
31 STO "VOL"			Volume
32 RCL "EDGE"
33 6
34 SQRT
35 ×
36 12
37 ÷
38 STO "I-RAD"			Inscribed sphere radius
39 RCL "EDGE"
40 6
41 SQRT
42 ×
43 4
44 ÷
45 STO "C-RAD"			Circumscribed sphere radius
46 XEQ "RESULT"		Shows results
47 RTN
48▸LBL "CUB"			Cube routine
49 XEQ "EDGE-IN"		EDGE	input
50 X↑2
51 6
52 ×
53 STO "SUR"			Surface area
54 RCL "EDGE"
55 3
56 Y↑X
57 STO "VOL"			Volume
58 RCL "EDGE"
59 2
60 ÷
61 STO "I-RAD"			Inscribed sphere radius
62 RCL "EDGE"
63 3
64 SQRT
65 ×
66 2
67 ÷
68 STO "C-RAD"			Circumscribed sphere radius
69 XEQ "RESULT"		Shows results
70 RTN
71▸LBL "OCT"			Octahedron rotine
72 XEQ "EDGE-IN"		EDGE	input
73 X↑2
74 3
75 SQRT
76 ×
77 2
78 ×
79 STO "SUR"			Surface area
80 RCL "EDGE"
81 3
82 Y↑X
83 2
84 SQRT
85 ×
86 3
87 ÷
88 STO "VOL"			Volume
89 RCL "EDGE"
90 6
91 SQRT
92 ×
93 6
94 ÷
95 STO "I-RAD"			Inscribed sphere radius
96 RCL "EDGE"
97 2
98 SQRT
99 ×
100 2
101 ÷
102 STO "C-RAD"		Circumscribed sphere radius
103 XEQ "RESULT"		Shows results
104 RTN
105▸LBL "DOD"			Dodecahedron routine
106 XEQ "EDGE-IN"		EDGE	input
107 5
108 SQRT
109 10
110 ×
111 25
112 +
113 SQRT
114 RCL "EDGE"
115 X↑2
116 ×
117 3
118 ×
119 STO "SUR"			Surface area
120 5
121 SQRT
122 7
123 ×
124 15
125 +
126 RCL "EDGE"
127 3
128 Y↑X
129 ×
130 4
131 ÷
132 STO "VOL"			Volume
133 5
134 SQRT
135 11
136 ×
137 25
138 +
139 10
140 ×
141 SQRT
142 RCL "EDGE"
143 ×
144 20
145 ÷
146 STO "I-RAD"		Inscribed sphere radius
147 5
148 SQRT
149 1
150 +
151 RCL "EDGE"
152 ×
153 3
154 SQRT
155 ×
156 4
157 ÷
158 STO "C-RAD"		Circumscribed sphere radius
159 XEQ "RESULT"		Shows results
160 RTN
161▸LBL "ICO"			Icosahedron routine
162 XEQ "EDGE-IN"		EDGE	input
163 X↑2
164 3
165 SQRT
166 ×
167 5
168 ×
169 STO "SUR"			Surface area
170 5
171 SQRT
172 3
173 +
174 5
175 ×
176 12
177 ÷
178 RCL "EDGE"
179 3
180 Y↑X
181 ×
182 STO "VOL"			Volume
183 5
184 SQRT
185 3
186 +
187 3
188 SQRT
189 ×
190 12
191 ÷
192 RCL "EDGE"
193 ×
194 STO "I-RAD"		Inscribed sphere radius
195 5
196 SQRT
197 2
198 ×
199 10
200 +
201 SQRT
202 4
203 ÷
204 RCL "EDGE"
205 ×
206 STO "C-RAD"		Circumscribed sphere radius
207 XEQ "RESULT"		Shows results
208 RTN
209▸LBL "EDGE-IN"		Requires EDGE value
210 INPUT "EDGE"
211 RTN
212▸LBL "RESULT"		Shows results
213 VIEW "SUR"			Surface area value
214 STOP
215 VIEW "VOL"			Volume value
216 STOP
217 VIEW "I-RAD"		Inscribed sphere radius
218 STOP
219 VIEW "C-RAD"		Circumscribed sphere radius
220 STOP
221 .END.
plato.zip
(51.45 KiB) Downloaded 21 times

Post Reply