## Linear regression analysis program with graph plot for DM42

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.
keithdalby
Posts: 501
Joined: Mon Apr 24, 2017 6:38 pm

### Linear regression analysis program with graph plot for DM42

Here is my linear regression graph plotting program, which gives gradients, intercepts and standard errors in both (correctly!). It uses a menu too, and the graph can be manipulated in a few ways: explained below.

First, the code, including my timing programs too (sorry).

Code: Select all

``[OLDER CODE REMOVED``
Next, the .raw file.
[OLDER ATTACHMENT REMOVED]
To use, place a matrix on the X-register with dimensions Zx2, where Z is the number of data points. The left column of the matrix is the x-axis values and the right column of the matrix is the y-axis values.

You can exit out of this by pressing a different menu button (not the F1 button, that just redraws the graph. Maybe I'll change that to a 'BACK' button in a later version) or pressing R/S.

The other buttons that show gradient, error in gradient, intercept and error in intercept all show the values on the screen using the current display settings (to be updated in a future version) and leave values on the stack if you EXIT out. Pressing the CHNGE allows some graph manupulation, such as SWAPX which swaps the X and Y axes around (and indicates such with the flag 1 being set), Z^? raises an axis to a power (2, 0.5, -1, whatever you like, first you give the power, then you choose the axis to affect) and CHNGE does some other change to a given axis, but needs a program called CHANGE with the change to implement.

The menu works pretty well, and I'm happy with the outcome so far. I just need to tweak the display settings - I want the program to choose 3-sigfig SCI notation for the gradients, intercepts and errors being displayed, then return to the previous settings when the program is EXITed. Shouldn't be too tricky to do at some time soon.

Please let me know what you think and what I need to do to improve it. If it's broken, let me know! Uses the default statistical registers, Flag 1, 2 and Flag 81.
Last edited by keithdalby on Mon Apr 02, 2018 7:35 am, edited 2 times in total.

Walter
Posts: 840
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

### Re: Linear regression analysis program with graph plot for DM42

DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

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

### Re: Linear regression analysis program with graph plot for DM42

Walter wrote:
Mon Feb 12, 2018 10:20 am
Are you aware of this: http://www.hpmuseum.org/forum/thread-10110.html ?
Interesting. I've met this before. The differences for what we deal with in a high-school lab are small enough to be ignored. I wrote a [rather unsophisticated] Monte Carlo algorithm for Excel to get an alternative method of forming gradients, intercepts and their standard errors. It estimates errors around three times larger (or there abouts, does depend on the data, obviously), with values of gradient and intercept that lie well within the errors of each other (Monte Carlo compared against least squares). The way high schoolers have to estimate errors is mostly by eye, and high-school-endorsed estimates of errors tend to be even higher than the Monte Carlo estimates.

I share this guff with my A Level (ages 16-18) Physics students to help them justify to themselves why estimating errors by eye is acceptable. They often believe that physics, like mathematics, is pure and perfect. When they meet errors for the first time, they assume there's a 'correct' way to analyse them. Of course, every method produces estimates based on different assumptions. After meeting this idea, they're happier estimating errors using a less-rigorous method.

I wonder if I can program a Monte Carlo method into my DM-42 {he says, musing to himself}. It needs to randomly sample pairs of data points 20,000 times to produce a worthwhile estimate (~1% error in the error values). Might not have time to play with that until this summer.

Anyway, thank you for sharing Walter.

Edit to add: one-button axis swapping makes the issues in Walter's link easy to investigate

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

### Re: Linear regression analysis program with graph plot for DM42

The regression analysis program including preservation of user display state. I am sorry for the twistiest of spaghetti coding, I can write structured code but for some reason FOCAL just takes me right back to playing around with BASIC and bad habits return. Plus, not convinced FOCAL is that good for structured programming either.

As before, this program needs a matrix in the X-register when it is run, with Zx2 dimensions where Z is the number of data points. EXITing out of the program restores the previous display state.

Code: Select all

``[OLDER CODE REMOVED]``
And the .raw file:
[OLDER ATTACHMENT REMOVED]

Apart from playing with different ways of estimating gradients, intercepts and errors, I'm happy with this program and am happy to leave it as it is, but please let me know if I can improve it.
Last edited by keithdalby on Mon Apr 02, 2018 7:30 am, edited 1 time in total.

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

### Re: Linear regression analysis program with graph plot for DM42

Still chugging along with this. Now I have an 82240B I decided to add the ability to print results. The spaghetti code I'd written needed a lot of restructuring, which I've done now (update to follow when I've sorted the graph printing bit too), but...
IMG_20180311_172524~2.jpg (43.01 KiB) Viewed 1765 times
The graph is there. Tiny, but there (just a dump of the graph on the screen with PRLCD in GrMod 0).

So, I'm open to ideas. How can I print graphics across the full width of the paper? My idea was to simply slice the graph into three or four horizontal slithers and print each sequentially, but I'm not convinced that'll look any good.

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

### Re: Linear regression analysis program with graph plot for DM42

Some updates to the program structures (making better use of XEQ and RTN). The convention I've used is to have subroutines labeled with a . before the name.

If you want to try it out, put a matrix with data to plot in the X-register. The matrix should have two columns and as many rows as there are data points. The first column are the x-axis values, the second are the y-axis values.

I would run CUSTOMM first, which keeps a custom menu open, so that if you exit out you still see CLS, CONST, etc. The graphing program is called "GRAPH". If you wish to print the table, gradient, intercept and a teeny tiny graph, F4 is "PRINT" when the graph is visible on the screen. I've slipped a PSE in so that the menu can be briefly seen before the plot appears.

The .raw file:
[OLDER ATTACHMENT REMOVED]

The code:

Code: Select all

``[OLDER CODE REMOVED]``
Next step: the graphing subroutine needs a lot of work so that I can selectively plot horizontal slithers (as mentioned above). That won't be for a while now, perhaps not even until Easter.
Last edited by keithdalby on Mon Apr 02, 2018 7:29 am, edited 1 time in total.

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

### Re: Linear regression analysis program with graph plot for DM42

It's done, but it's not pretty. The program now prints the graph in slithers so that it prints the graph 131x128 pixels. Haven't bug-checked it as much as I ought to have done, but it seems to work okay for me.

The code is here (includes the other lab toys, such as the timing toys, the constants menu and the persistent custom menu):

Code: Select all

``[OLDER CODE REMOVED]``
Attached here is the .zip file containing the .raw file. It also contains my state file, which has a matrix "PENDLUM" that can be used to play around with the program if you want:

[OLDER ATTACHMENT REMOVED]

Thought you might get a kick out of seeing it in action, so I uploaded a video. My phone camera is pretty poor quality, but you get the jist:

Finally, when my production DM42 PCB arrived, it had the labtoys program on it already. I don't want to jump to conclusions, but I'd be thrilled if a program I'd written had made it onto every production model; however, the version that'd be on there is [more] buggy [than this version] and doesn't have the new features. If my old program is being shipped with the production units, could it be replaced with this version please? Thank you!
Last edited by keithdalby on Mon Apr 02, 2018 7:27 am, edited 2 times in total.

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

### Re: Linear regression analysis program with graph plot for DM42

Don't think it's printing the last slither, but I've put it all away now. I'll take a look another time.

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

### Re: Linear regression analysis program with graph plot for DM42

Aaaand, I've fixed the problem where the last slither wasn't printing (it turns out I cannot count to 9)

The code is here:

Code: Select all

``````00 { 6202-Byte Prgm }
01▸LBL ".STODSP"
02 "STO DISP MODE"
03 CLST
04 0
05 FS? 36
06 1
07 8
08 ×
09 0
10 FS? 37
11 1
12 4
13 ×
14 +
15 0
16 FS? 38
17 1
18 2
19 ×
20 +
21 0
22 FS? 39
23 1
24 +
25 +
26 STO "DIGITS"
27 CLST
28 10
29 FS? 40
30 1
31 ×
32 STO "DMODE"
33 CLST
34 1
35 FS? 41
36 1
37 ×
38 STO+ "DMODE"
39 CLST
40 CLA
41 RTN
42▸LBL ".CHGRMD"
43 "CHANGE GRMOD"
44 RCL "GrMod"
45 ENTER
46 ENTER
47 ENTER
48 3
49 X=Y?
50 SF 03
51 R↓
52 2
53 X=Y?
54 SF 04
55 R↓
56 0
57 X=Y?
58 SF 05
59 FS?C 03
60 0
61 FS?C 04
62 3
63 FS?C 05
64 2
65 STO "GrMod"
66 CLA
67 XEQ ".PLOT"
68 RTN
69▸LBL ".CHSCAL"
70 "CHANGE SCALE"
71 6
72 CF 83
73 FS?C 82
74 SF 83
75 FC?C 83
76 SF 82
77 CLA
78 XEQ ".PLOT"
79 RTN
80▸LBL ".CHPOW"
81 "CHANGE POWER"
82 RCL "DAT"
83 STO "PROCESS"
84 DIM?
85 X<>Y
86 STO "JMAX"
87 CLST
88 "POWER?"
89 AVIEW
90 INPUT "POW"
91 CLST
92 "AXIS? X=1, Y=2"
93 AVIEW
94 INPUT "AXIS"
95 1
96 STO "J"
97 INDEX "PROCESS"
98▸LBL 01
99 RCL "J"
100 RCL "AXIS"
101 STOIJ
102 RCLEL
103 RCL "POW"
104 Y↑X
105 STOEL
106 1
107 STO+ "J"
108 RCL "J"
109 RCL "JMAX"
110 X≥Y?
111 GTO 01
112 CLST
113 RCL "PROCESS"
114 STO "DAT"
115 CLV "PROCESS"
116 CLV "JMAX"
117 CLV "POW"
118 "DONE"
119 AVIEW
120 CLV "J"
121 CLV "AXIS"
122 CLA
123 RTN
124 END
125▸LBL ".CHNGE"
126 "NEEDS A PROG NA"
127 ├"MED    "CHANGE"
128 ├"", OK?"
129 PROMPT
130 RCL "DAT"
131 STO "PROCESS"
132 DIM?
133 X<>Y
134 STO "JMAX"
135 "AXIS? X=1, Y=2"
136 AVIEW
137 INPUT "AXIS"
138 1
139 STO "J"
140 INDEX "PROCESS"
141▸LBL 01
142 RCL "J"
143 RCL "AXIS"
144 STOIJ
145 RCLEL
146 XEQ "CHANGE"
147 STOEL
148 1
149 STO+ "J"
150 RCL "J"
151 RCL "JMAX"
152 X≥Y?
153 GTO 01
154 CLST
155 RCL "PROCESS"
156 STO "DAT"
157 CLV "PROCESS"
158 CLV "JMAX"
159 "DONE"
160 AVIEW
161 CLV "J"
162 CLV "AXIS"
163 RTN
164 END
165▸LBL ".SWAPXY"
166 CLST
167 RCL "DAT"
168 STO "TEMP"
169 1
170 STO "J"
171 RCL "TEMP"
172 DIM?
173 X<>Y
174 STO "MAXJ"
175 INDEX "TEMP"
176▸LBL 01
177 RCL "J"
178 1
179 STOIJ
180 RCLEL
181 RCL "J"
182 2
183 STOIJ
184 RCLEL
185 R↓
186 R↓
187 R↓
188 RCL "J"
189 2
190 STOIJ
191 R↓
192 R↓
193 STOEL
194 RCL "J"
195 1
196 STOIJ
197 R↓
198 R↓
199 R↓
200 STOEL
201 1
202 STO+ "J"
203 RCL "J"
204 RCL "MAXJ"
205 X≥Y?
206 GTO 01
207 RCL "TEMP"
208 STO "DAT"
209 CLV "J"
210 CLV "JMAX"
211 CLV "TEMP"
212 FC?C 01
213 SF 02
214 FS?C 02
215 SF 01
216 FS? 01
217 "DONE (INVERTED)"
218 FC? 01
219 "DONE (UNINVERTE"
220 FC? 01
221 ├"D)"
222 PROMPT
223 CLA
224 RTN
225 END
226▸LBL ".EXIT"
227 CF 81
228 CF 01
229 RCL "DMODE"
230 ENTER
231 ENTER
232 ENTER
233 0
234 X=Y?
235 SCI IND "DIGITS"
236 R↓
237 1
238 X=Y?
239 ENG IND "DIGITS"
240 R↓
241 10
242 X=Y?
243 FIX IND "DIGITS"
244 R↓
245 11
246 X=Y?
247 ALL
248 CLST
249 CLV "DMODE"
250 CLV "DIGITS"
251 CLV "MAXJ"
252 CLV "DINT"
253 CLV "JMAX"
254 CLV "PROCESS"
255 CLA
256 RCL "DAT"
257 GTO "CUSTOMM"
258 END
259▸LBL ".GRD"
260 "y=mx+c, m="
261 XEQ ".CGRD"
262 PROMPT
263 RTN
264▸LBL ".CGRD"
265 RCL "DAT"
266 CLΣ
267 Σ+
268 LINF
269 0
270 SLOPE
272 CLST
274 ARCL ST X
275 CLST
276 RTN
277▸LBL ".DGRD"
278 "y=mx+c, Dm="
279 XEQ ".CDGRD"
280 PROMPT
281 RTN
282▸LBL ".CDGRD"
283 RCL "DAT"
284 CLΣ
285 Σ+
286 LINF
287 0
288 SLOPE
290 CLST
292 RCL 14
293 RCL 13
294 X↑2
295 RCL 16
296 ÷
297 -
298 RCL 15
299 RCL 11
300 RCL 13
301 ×
302 RCL 16
303 ÷
304 -
306 ×
307 -
308 RCL 16
309 2
310 -
311 ÷
312 X↑2
313 SQRT
314 RCL 16
315 ÷
316 RCL 12
317 RCL 11
318 X↑2
319 RCL 16
320 ÷
321 -
322 ÷
323 SQRT
325 CLST
328 ARCL ST X
329 CLST
330 RTN
331▸LBL ".INT"
332 "y=mx+c, c="
333 XEQ ".CINT"
334 PROMPT
335 RTN
336▸LBL ".CINT"
337 RCL "DAT"
338 CLΣ
339 Σ+
340 LINF
341 0
342 YINT
343 STO "INT"
344 CLST
345 RCL "INT"
346 ARCL ST X
347 CLST
348 RTN
349▸LBL ".DINT"
350 "y=mx+c, Dc="
351 XEQ ".CDINT"
352 PROMPT
353 RTN
354▸LBL ".CDINT"
355 RCL "DAT"
356 CLΣ
357 Σ+
358 LINF
359 0
360 SLOPE
362 YINT
363 STO "INT"
365 RCL 14
366 RCL 13
367 X↑2
368 RCL 16
369 ÷
370 -
371 RCL 15
372 RCL 11
373 RCL 13
374 ×
375 RCL 16
376 ÷
377 -
379 ×
380 -
381 RCL 16
382 2
383 -
384 ÷
385 X↑2
386 SQRT
387 RCL 11
388 RCL 16
389 ÷
390 X↑2
391 RCL 11
392 X↑2
393 RCL 16
394 ÷
395 +/-
396 RCL 12
397 +
398 ÷
399 RCL 16
400 1/X
401 +
402 RCL 16
403 ÷
404 ×
405 SQRT
406 STO "DINT"
407 CLST
408 RCL "INT"
409 RCL "DINT"
410 ARCL ST X
411 CLST
412 RTN
413▸LBL ".SETSCL"
414 RCL "MAXY"
415 ABS
416 RCL "MINY"
417 ABS
418 X≥Y?
419 SF 84
420 X<Y?
421 SF 85
422 FS? 84
423 RCL "MINY"
424 FS? 84
425 +/-
426 FS? 84
427 STO "MAXY"
428 FS? 85
429 RCL "MAXY"
430 FS? 85
431 +/-
432 FS? 85
433 STO "MINY"
434 CF 84
435 CF 85
436 RCL "MAXX"
437 ABS
438 RCL "MINX"
439 ABS
440 X≥Y?
441 SF 84
442 X<Y?
443 SF 85
444 FS? 84
445 RCL "MINX"
446 FS? 84
447 +/-
448 FS? 84
449 STO "MAXX"
450 FS? 85
451 RCL "MAXX"
452 FS? 85
453 +/-
454 FS? 85
455 STO "MINX"
456 CF 84
457 CF 85
458 RTN
459▸LBL ".PLOT"
460 "BACK"
461 KEY 1 GTO "GRAPH"
462 "GrMod"
463 KEY 2 XEQ ".CHGRMD"
464 "SCALE"
465 KEY 3 XEQ ".CHSCAL"
466 "PRINT"
467 KEY 4 GTO ".PRNT"
468 CLA
469 KEY 5 GTO "GRAPH"
470 KEY 6 GTO "GRAPH"
471 KEY 7 GTO "GRAPH"
472 KEY 8 GTO "GRAPH"
473 KEY 9 GTO "GRAPH"
475 CLST
476 PSE
477 XEQ ".PPLOT"
478 CLST
479 STOP
480 RCL "DAT"
481 RTN
482 END
483▸LBL ".PPLOT"
484 CLLCD
485 RCL "DAT"
486 DIM?
487 X<>Y
488 STO "MAXJ"
489 INDEX "DAT"
490 1
491 STO "J"
492 1
493 RCL "J"
494 X<>Y
495 STOIJ
496 RCLEL
497 STO "MINX"
498 STO "MAXX"
499 2
500 RCL "J"
501 X<>Y
502 STOIJ
503 RCLEL
504 STO "MINY"
505 STO "MAXY"
506▸LBL 01
507 1
508 STO+ "J"
509 RCL "MAXJ"
510 RCL "J"
511 X>Y?
512 GTO 03
513 1
514 RCL "J"
515 X<>Y
516 STOIJ
517 RCLEL
518 STO "TEMP"
519 RCL "MAXX"
520 RCL "TEMP"
521 X>Y?
522 STO "MAXX"
523 RCL "MINX"
524 RCL "TEMP"
525 X<Y?
526 STO "MINX"
527 2
528 RCL "J"
529 X<>Y
530 STOIJ
531 RCLEL
532 STO "TEMP"
533 RCL "MAXY"
534 RCL "TEMP"
535 X>Y?
536 STO "MAXY"
537 RCL "MINY"
538 RCL "TEMP"
539 X<Y?
540 STO "MINY"
541 GTO 01
542▸LBL 03
543 FS? 82
544 XEQ ".SETSCL"
545 1
546 STO "J"
547▸LBL 02
548 RCL "J"
549 1
550 STOIJ
551 RCLEL
552 RCL "MINX"
553 -
554 RCL "MAXX"
555 RCL "MINX"
556 -
557 ÷
558 RCL "ResX"
559 3
560 -
561 ×
562 2
563 +
564 STO "TX"
565 RCL "J"
566 2
567 STOIJ
568 RCLEL
569 RCL "MINY"
570 -
571 RCL "MAXY"
572 RCL "MINY"
573 -
574 ÷
575 RCL "ResY"
576 +/-
577 3
578 +
579 ×
580 RCL "ResY"
581 +
582 1
583 -
584 STO "TY"
585 RCL "TX"
586 PIXEL
587 RCL "TY"
588 1
589 +
590 RCL "TX"
591 1
592 +
593 PIXEL
594 RCL "TY"
595 1
596 -
597 RCL "TX"
598 1
599 +
600 PIXEL
601 RCL "TY"
602 1
603 -
604 RCL "TX"
605 1
606 -
607 PIXEL
608 RCL "TY"
609 1
610 +
611 RCL "TX"
612 1
613 -
614 PIXEL
615 1
616 STO+ "J"
617 RCL "J"
618 RCL "MAXJ"
619 X≥Y?
620 GTO 02
621 1
622 STO "I"
623 1
624 STO "J"
625 0
626 RCL "MINX"
627 -
628 RCL "MAXX"
629 RCL "MINX"
630 -
631 ÷
632 RCL "ResX"
633 3
634 -
635 ×
636 2
637 +
638 STO "0I"
639 0
640 RCL "MINY"
641 -
642 RCL "MAXY"
643 RCL "MINY"
644 -
645 ÷
646 RCL "ResY"
647 +/-
648 2
649 +
650 ×
651 RCL "ResY"
652 +
653 STO "0J"
654 RCL "MINX"
655 0
656 X<Y?
657 GTO 05
658 RCL "MAXX"
659 0
660 X>Y?
661 GTO 05
662▸LBL 04
663 RCL "J"
664 RCL "0I"
665 PIXEL
666 1
667 STO+ "J"
668 RCL "J"
669 RCL "ResY"
670 X≥Y?
671 GTO 04
672▸LBL 05
673 RCL "MINY"
674 0
675 X<Y?
676 GTO 06
677 RCL "MAXY"
678 0
679 X>Y?
680 GTO 06
681 RCL "0J"
682 RCL "I"
683 PIXEL
684 1
685 STO+ "I"
686 RCL "I"
687 RCL "ResX"
688 X≥Y?
689 GTO 05
690▸LBL 06
691 CLV "0J"
692 CLV "0I"
693 CLV "TY"
694 CLV "TX"
695 CLV "TEMP"
696 CLV "J"
697 RCL "DAT"
698 CLΣ
699 Σ+
700 LINF
701 0
702 SLOPE
704 YINT
705 STO "INT"
706 CORR
707 STO "PMCC"
708 1
709 ENTER
710 STO "I"
711▸LBL 72
712 RCL "I"
713 RCL "ResX"
714 ÷
715 RCL "MAXX"
716 RCL "MINX"
717 -
718 ×
719 RCL "MINX"
720 +
722 ×
723 RCL "INT"
724 +
725 STO "LY"
726 RCL "LY"
727 RCL "MINY"
728 -
729 RCL "ResY"
730 2
731 -
732 ×
733 RCL "MAXY"
734 RCL "MINY"
735 -
736 ÷
737 +/-
738 RCL "ResY"
739 +
740 STO "J"
741 RCL "J"
742 1
743 X>Y?
744 GTO 75
745 RCL "J"
746 RCL "ResY"
747 X<Y?
748 GTO 75
749 RCL "J"
750 RCL "I"
751 PIXEL
752▸LBL 75
753 1
754 ENTER
755 RCL "I"
756 +
757 STO "I"
758 RCL "I"
759 RCL "ResX"
760 X≥Y?
761 GTO 72
762 CLV "J"
763 CLV "LY"
764 CLV "I"
765 CLV "MAXY"
766 CLV "MINY"
767 CLV "MAXX"
768 CLV "MINX"
769 RTN
770 END
771▸LBL ".PRPLOT"
772 0
773 STO "GrMod"
774 1
775 STO "LAYERS"
776 128
777 STO "PrResY"
778 CLLCD
779 RCL "DAT"
780 DIM?
781 X<>Y
782 STO "MAXJ"
783 INDEX "DAT"
784 1
785 STO "J"
786 1
787 RCL "J"
788 X<>Y
789 STOIJ
790 RCLEL
791 STO "MINX"
792 STO "MAXX"
793 2
794 RCL "J"
795 X<>Y
796 STOIJ
797 RCLEL
798 STO "MINY"
799 STO "MAXY"
800▸LBL 01
801 1
802 STO+ "J"
803 RCL "MAXJ"
804 RCL "J"
805 X>Y?
806 GTO 03
807 1
808 RCL "J"
809 X<>Y
810 STOIJ
811 RCLEL
812 STO "TEMP"
813 RCL "MAXX"
814 RCL "TEMP"
815 X>Y?
816 STO "MAXX"
817 RCL "MINX"
818 RCL "TEMP"
819 X<Y?
820 STO "MINX"
821 2
822 RCL "J"
823 X<>Y
824 STOIJ
825 RCLEL
826 STO "TEMP"
827 RCL "MAXY"
828 RCL "TEMP"
829 X>Y?
830 STO "MAXY"
831 RCL "MINY"
832 RCL "TEMP"
833 X<Y?
834 STO "MINY"
835 GTO 01
836▸LBL 03
837 FS? 82
838 XEQ ".SETSCL"
839▸LBL 20
840 1
841 STO "J"
842▸LBL 02
843 RCL "J"
844 1
845 STOIJ
846 RCLEL
847 RCL "MINX"
848 -
849 RCL "MAXX"
850 RCL "MINX"
851 -
852 ÷
853 RCL "ResX"
854 3
855 -
856 ×
857 2
858 +
859 STO "TX"
860 RCL "J"
861 2
862 STOIJ
863 RCLEL
864 RCL "MINY"
865 -
866 RCL "MAXY"
867 RCL "MINY"
868 -
869 ÷
870 RCL "PrResY"
871 +/-
872 3
873 +
874 ×
875 RCL "PrResY"
876 +
877 1
878 -
879 RCL "LAYERS"
880 1
881 -
882 16
883 ×
884 -
885 STO "TY"
886 STO "tTY"
887 RCL "TX"
888 STO "tTX"
889 1
890 RCL "tTY"
891 X<Y?
892 GTO 10
893 1
894 RCL "tTX"
895 X<Y?
896 GTO 10
897 RCL "ResX"
898 RCL "tTX"
899 X>Y?
900 GTO 10
901 RCL "ResY"
902 RCL "tTY"
903 X>Y?
904 GTO 10
905 RCL "tTY"
906 RCL "tTX"
907 PIXEL
908▸LBL 10
909 RCL "TY"
910 1
911 +
912 STO "tTY"
913 RCL "TX"
914 1
915 +
916 STO "tTX"
917 1
918 RCL "tTY"
919 X<Y?
920 GTO 11
921 1
922 RCL "tTX"
923 X<Y?
924 GTO 11
925 RCL "ResX"
926 RCL "tTX"
927 X>Y?
928 GTO 11
929 RCL "ResY"
930 RCL "tTY"
931 X>Y?
932 GTO 11
933 RCL "tTY"
934 RCL "tTX"
935 PIXEL
936▸LBL 11
937 RCL "TY"
938 1
939 -
940 STO "tTY"
941 RCL "TX"
942 1
943 +
944 STO "tTX"
945 1
946 RCL "tTY"
947 X<Y?
948 GTO 12
949 1
950 RCL "tTX"
951 X<Y?
952 GTO 12
953 RCL "ResX"
954 RCL "tTX"
955 X>Y?
956 GTO 12
957 RCL "ResY"
958 RCL "tTY"
959 X>Y?
960 GTO 12
961 RCL "tTY"
962 RCL "tTX"
963 PIXEL
964▸LBL 12
965 RCL "TY"
966 1
967 -
968 STO "tTY"
969 RCL "TX"
970 1
971 -
972 STO "tTX"
973 1
974 RCL "tTY"
975 X<Y?
976 GTO 13
977 1
978 RCL "tTX"
979 X<Y?
980 GTO 13
981 RCL "ResX"
982 RCL "tTX"
983 X>Y?
984 GTO 13
985 RCL "ResY"
986 RCL "tTY"
987 X>Y?
988 GTO 13
989 RCL "tTY"
990 RCL "tTX"
991 PIXEL
992▸LBL 13
993 RCL "TY"
994 1
995 +
996 STO "tTY"
997 RCL "TX"
998 1
999 -
1000 STO "tTX"
1001 1
1002 RCL "tTY"
1003 X<Y?
1004 GTO 14
1005 1
1006 RCL "tTX"
1007 X<Y?
1008 GTO 14
1009 RCL "ResX"
1010 RCL "tTX"
1011 X>Y?
1012 GTO 14
1013 RCL "ResY"
1014 RCL "tTY"
1015 X>Y?
1016 GTO 14
1017 RCL "tTY"
1018 RCL "tTX"
1019 PIXEL
1020▸LBL 14
1021 1
1022 STO+ "J"
1023 RCL "J"
1024 RCL "MAXJ"
1025 X≥Y?
1026 GTO 02
1027 1
1028 STO "I"
1029 1
1030 STO "J"
1031 0
1032 RCL "MINX"
1033 -
1034 RCL "MAXX"
1035 RCL "MINX"
1036 -
1037 ÷
1038 RCL "ResX"
1039 3
1040 -
1041 ×
1042 2
1043 +
1044 STO "0I"
1045 0
1046 RCL "MINY"
1047 -
1048 RCL "MAXY"
1049 RCL "MINY"
1050 -
1051 ÷
1052 RCL "PrResY"
1053 +/-
1054 3
1055 +
1056 ×
1057 RCL "PrResY"
1058 +
1059 RCL "LAYERS"
1060 1
1061 -
1062 16
1063 ×
1064 -
1065 STO "0J"
1066 RCL "MINX"
1067 0
1068 X<Y?
1069 GTO 05
1070 RCL "MAXX"
1071 0
1072 X>Y?
1073 GTO 05
1074▸LBL 04
1075 1
1076 RCL "J"
1077 RCL "LAYERS"
1078 1
1079 -
1080 16
1081 ×
1082 -
1083 X<Y?
1084 GTO 15
1085 1
1086 RCL "0I"
1087 X<Y?
1088 GTO 15
1089 RCL "ResY"
1090 RCL "J"
1091 RCL "LAYERS"
1092 1
1093 -
1094 16
1095 ×
1096 -
1097 X>Y?
1098 GTO 15
1099 RCL "ResX"
1100 RCL "0I"
1101 X>Y?
1102 GTO 15
1103 RCL "J"
1104 RCL "LAYERS"
1105 1
1106 -
1107 16
1108 ×
1109 -
1110 RCL "0I"
1111 PIXEL
1112▸LBL 15
1113 1
1114 STO+ "J"
1115 RCL "J"
1116 RCL "LAYERS"
1117 1
1118 -
1119 16
1120 ×
1121 -
1122 RCL "ResY"
1123 X≥Y?
1124 GTO 04
1125▸LBL 05
1126 RCL "MINY"
1127 0
1128 X<Y?
1129 GTO 06
1130 RCL "MAXY"
1131 0
1132 X>Y?
1133 GTO 06
1134 1
1135 RCL "0J"
1136 X<Y?
1137 GTO 16
1138 1
1139 RCL "I"
1140 X<Y?
1141 GTO 16
1142 RCL "ResY"
1143 RCL "0J"
1144 X>Y?
1145 GTO 16
1146 RCL "ResX"
1147 RCL "I"
1148 X>Y?
1149 GTO 16
1150 RCL "0J"
1151 RCL "I"
1152 PIXEL
1153▸LBL 16
1154 1
1155 STO+ "I"
1156 RCL "I"
1157 RCL "ResX"
1158 X≥Y?
1159 GTO 05
1160▸LBL 06
1161 CLV "tTX"
1162 CLV "tTY"
1163 CLV "0J"
1164 CLV "0I"
1165 CLV "TY"
1166 CLV "TX"
1167 CLV "TEMP"
1168 CLV "J"
1169 RCL "DAT"
1170 CLΣ
1171 Σ+
1172 LINF
1173 0
1174 SLOPE
1176 YINT
1177 STO "INT"
1178 CORR
1179 STO "PMCC"
1180 1
1181 ENTER
1182 STO "I"
1183▸LBL 72
1184 RCL "I"
1185 RCL "ResX"
1186 ÷
1187 RCL "MAXX"
1188 RCL "MINX"
1189 -
1190 ×
1191 RCL "MINX"
1192 +
1194 ×
1195 RCL "INT"
1196 +
1197 STO "LY"
1198 RCL "LY"
1199 RCL "MINY"
1200 -
1201 RCL "PrResY"
1202 2
1203 -
1204 ×
1205 RCL "MAXY"
1206 RCL "MINY"
1207 -
1208 ÷
1209 +/-
1210 RCL "PrResY"
1211 +
1212 RCL "LAYERS"
1213 1
1214 -
1215 16
1216 ×
1217 -
1218 STO "J"
1219 RCL "J"
1220 1
1221 X>Y?
1222 GTO 75
1223 RCL "J"
1224 RCL "ResY"
1225 X<Y?
1226 GTO 75
1227 1
1228 RCL "J"
1229 X<Y?
1230 GTO 75
1231 1
1232 RCL "I"
1233 X<Y?
1234 GTO 75
1235 RCL "ResY"
1236 RCL "J"
1237 X>Y?
1238 GTO 75
1239 RCL "ResX"
1240 RCL "I"
1241 X>Y?
1242 GTO 75
1243 RCL "J"
1244 RCL "I"
1245 PIXEL
1246▸LBL 75
1247 1
1248 STO+ "I"
1249 RCL "I"
1250 RCL "ResX"
1251 X≥Y?
1252 GTO 72
1253 9
1254 RCL "LAYERS"
1255 X≥Y?
1256 GTO 21
1257 1
1258 STO+ "LAYERS"
1259 PRLCD
1260 CLLCD
1261 GTO 20
1262▸LBL 21
1263 CLV "J"
1264 CLV "LAYERS"
1265 CLV "PrResY"
1266 CLV "LY"
1267 CLV "I"
1268 CLV "MAXY"
1269 CLV "MINY"
1270 CLV "MAXX"
1271 CLV "MINX"
1272 RTN
1273 END
1275 "BACK"
1276 KEY 1 GTO "GRAPH"
1277 "SWAPX"
1278 KEY 2 XEQ ".SWAPXY"
1279 "Z↑?"
1280 KEY 4 XEQ ".CHPOW"
1281 CLA
1282 KEY 3 GTO ".CHMENU"
1283 KEY 5 GTO ".CHMENU"
1284 "CHNGE"
1285 KEY 6 XEQ ".CHNGE"
1286 KEY 9 GTO ".EXIT"
1288 STOP
1290 END
1291▸LBL ".PRNT"
1292 RCL "DAT"
1293 PRON
1294 MAN
1295 "---------------"
1296 ├"---------"
1297 PRA
1298 "|NAME:         "
1299 ├"        |"
1300 PRA
1301 "---------------"
1302 ├"---------"
1303 PRA
1306 PRA
1307 "---------------"
1308 ├"---------"
1309 "   X           "
1310 ├"     Y   "
1311 PRA
1312 "---------------"
1313 ├"---------"
1314 PRA
1315 SCI 02
1316 INDEX "DAT"
1317 DIM?
1318 X<>Y
1319 STO "JMAX"
1320 1
1321 STO "J"
1322▸LBL 01
1323 RCL "J"
1324 1
1325 STOIJ
1326 RCLEL
1327 CLA
1328 ARCL ST X
1329 ├"      "
1330 RCL "J"
1331 2
1332 STOIJ
1333 RCLEL
1334 ARCL ST X
1335 PRA
1336 1
1337 STO+ "J"
1338 RCL "J"
1339 RCL "JMAX"
1340 X≥Y?
1341 GTO 01
1342 "---------------"
1343 ├"---------"
1344 PRA
1347 "       y = Mx +"
1348 ├" C       "
1349 AVIEW
1350 CLA
1351 "  (ERRORS IN BR"
1352 ├"ACKETS)  "
1353 AVIEW
1355 CLA
1356 "M = "
1357 XEQ ".CGRD"
1358 ├" ("
1359 XEQ ".CDGRD"
1360 ├")"
1361 AVIEW
1363 CLA
1364 "C = "
1365 XEQ ".CINT"
1366 ├" ("
1367 XEQ ".CDINT"
1368 ├")"
1369 AVIEW
1370 CLA
1371 RCL "GrMod"
1372 STO "TPGrMod"
1373 0
1374 STO "GrMod"
1375 XEQ ".PRPLOT"
1376 CLLCD
1381 SCI 04
1382 RCL "TPGrMod"
1383 STO "GrMod"
1384 CLV "TPGrMod"
1385 CLST
1386 CLV "PrRes"
1387 CLV "LAYER"
1388 PROFF
1389 GTO ".PLOT"
1390 END
1391▸LBL "TIMER"
1392 CLST
1393 0
1394 FS? 36
1395 1
1396 8
1397 ×
1398 0
1399 FS? 37
1400 1
1401 4
1402 ×
1403 +
1404 0
1405 FS? 38
1406 1
1407 2
1408 ×
1409 +
1410 0
1411 FS? 39
1412 1
1413 +
1414 +
1415 STO "DIGITS"
1416 CLST
1417 10
1418 FS? 40
1419 1
1420 ×
1421 STO "DMODE"
1422 CLST
1423 1
1424 FS? 41
1425 1
1426 ×
1427 STO+ "DMODE"
1428 CLST
1429 FIX 00
1430 "HOW MANY OSCILL"
1431 ├"ATIONS?"
1432 AVIEW
1433 INPUT "N"
1434 0
1435 STO "M"
1436 "PRESS R/S TO ST"
1437 ├"ART"
1438 PROMPT
1439 TIME
1440 →HR
1441 3600
1442 ×
1443 STO "T0"
1444▸LBL 01
1445 CLST
1446 "ITERATION="
1447 RCL "M"
1448 ARCL ST X
1449 PROMPT
1450 1
1451 STO+ "M"
1452 RCL "M"
1453 RCL "N"
1454 X>Y?
1455 GTO 01
1456 TIME
1457 →HR
1458 3600
1459 ×
1460 RCL "T0"
1461 -
1462 STO "T"
1463 RCL "DMODE"
1464 ENTER
1465 ENTER
1466 ENTER
1467 0
1468 X=Y?
1469 SCI IND "DIGITS"
1470 R↓
1471 1
1472 X=Y?
1473 ENG IND "DIGITS"
1474 R↓
1475 10
1476 X=Y?
1477 FIX IND "DIGITS"
1478 R↓
1479 11
1480 X=Y?
1481 ALL
1482 CLST
1483 "FULL TIME/s="
1484 RCL "T"
1485 ARCL ST X
1486 SF 26
1487 TONE 9
1488 CF 26
1489 PROMPT
1490 RCL "N"
1491 ÷
1492 STO "DT"
1493 "T/s="
1494 RCL "DT"
1495 ARCL ST X
1496 PROMPT
1497 CLST
1498 RCL "T"
1499 RCL "DT"
1500 CLV "T0"
1501 CLV "M"
1502 CLV "N"
1503 CLV "DMODE"
1504 CLV "DIGITS"
1505 END
1506▸LBL "INTVL"
1507 1
1508 STO "N"
1509 "SECONDS INTERVA"
1510 ├"L?"
1511 AVIEW
1512 INPUT "DT"
1513 TIME
1514 →HR
1515 3600
1516 ×
1517 STO "T"
1518▸LBL 01
1519 RCL "T"
1520 RCL "DT"
1521 +
1522 STO "T"
1523▸LBL 02
1524 TIME
1525 →HR
1526 3600
1527 ×
1528 RCL "T"
1529 X>Y?
1530 GTO 02
1531 "TIME/SEC="
1532 RCL "N"
1533 RCL "DT"
1534 ×
1535 ARCL ST X
1536 AVIEW
1537 SF 26
1538 TONE 9
1539 CF 26
1540 1
1541 STO+ "N"
1542 GTO 01
1543 END
1544▸LBL "CLOCK"
1545 TIME
1546 →HR
1547 3600
1548 ×
1549 STO "T0"
1550▸LBL 01
1551 "TIME/MS="
1552 TIME
1553 →HR
1554 3600
1555 ×
1556 RCL "T0"
1557 -
1558 1ᴇ3
1559 ×
1560 AIP
1561 AVIEW
1562 GTO 01
1563 STOP
1564 END
1565▸LBL "CLS"
1566 CLST
1567 X↑2
1568 CLA
1569 END
1570▸LBL "CONSTS"
1571▸LBL 01
1572 "mu0"
1573 KEY 1 XEQ 51
1574 "eps0"
1575 KEY 2 XEQ 52
1576 "h"
1577 KEY 3 XEQ 53
1578 "G"
1579 KEY 4 XEQ 54
1580 "NA"
1581 KEY 5 XEQ 55
1582 "R"
1583 KEY 6 XEQ 56
1584 KEY 7 GTO 05
1585 KEY 8 GTO 02
1586 KEY 9 GTO 09
1588 STOP
1589 GTO 01
1590▸LBL 09
1591 XEQ "CUSTOMM"
1592 STOP
1593 GTO "CONSTS"
1594▸LBL 02
1595 "k"
1596 KEY 1 XEQ 57
1597 "me"
1598 KEY 2 XEQ 58
1599 "e/me"
1600 KEY 3 XEQ 59
1601 "mp"
1602 KEY 4 XEQ 60
1603 "e/mp"
1604 KEY 5 XEQ 61
1605 "mn"
1606 KEY 6 XEQ 62
1607 KEY 7 GTO 01
1608 KEY 8 GTO 03
1609 KEY 9 GTO 09
1611 STOP
1612 GTO 02
1613▸LBL 03
1614 "u"
1615 KEY 1 XEQ 63
1616 "msun"
1617 KEY 2 XEQ 64
1618 "rsun"
1619 KEY 3 XEQ 65
1620 "mear"
1621 KEY 4 XEQ 66
1622 "rear"
1623 KEY 5 XEQ 67
1624 "eMeV"
1625 KEY 6 XEQ 68
1626 KEY 7 GTO 02
1627 KEY 8 GTO 04
1628 KEY 9 GTO 09
1630 STOP
1631 GTO 03
1632▸LBL 04
1633 "muMeV"
1634 KEY 1 XEQ 69
1635 "piMeV"
1636 KEY 2 XEQ 70
1637 "p0MeV"
1638 KEY 3 XEQ 71
1639 "KMeV"
1640 KEY 4 XEQ 72
1641 "K0MeV"
1642 KEY 5 XEQ 73
1643 "pMeV"
1644 KEY 6 XEQ 74
1645 KEY 7 GTO 03
1646 KEY 8 GTO 05
1647 KEY 9 GTO 09
1649 STOP
1650 GTO 04
1651▸LBL 05
1652 "nMeV"
1653 KEY 1 XEQ 75
1654 "uMeV"
1655 KEY 2 XEQ 76
1656 CLA
1657 KEY 3 GTO 05
1658 "c"
1659 KEY 4 XEQ 79
1660 "e"
1661 KEY 5 XEQ 77
1662 "g"
1663 KEY 6 XEQ 78
1664 KEY 7 GTO 04
1665 KEY 8 GTO 01
1666 KEY 9 GTO 09
1668 STOP
1669 GTO 05
1670▸LBL 51
1671 1.256637061435917295385057353311801ᴇ-6
1672 RTN
1673▸LBL 52
1674 885ᴇ-14
1675 RTN
1676▸LBL 53
1677 663ᴇ-36
1678 RTN
1679▸LBL 54
1680 667ᴇ-13
1681 RTN
1682▸LBL 55
1683 602ᴇ21
1684 RTN
1685▸LBL 56
1686 8.31
1687 RTN
1688▸LBL 57
1689 138ᴇ-25
1690 RTN
1691▸LBL 58
1692 911ᴇ-33
1693 RTN
1694▸LBL 59
1695 176ᴇ9
1696 RTN
1697▸LBL 60
1698 1673ᴇ-30
1699 RTN
1700▸LBL 61
1701 958ᴇ5
1702 RTN
1703▸LBL 62
1704 1675ᴇ-30
1705 RTN
1706▸LBL 63
1707 1661ᴇ-30
1708 RTN
1709▸LBL 64
1710 199ᴇ28
1711 RTN
1712▸LBL 65
1713 696ᴇ6
1714 RTN
1715▸LBL 66
1716 598ᴇ22
1717 RTN
1718▸LBL 67
1719 637ᴇ4
1720 RTN
1721▸LBL 68
1722 0.510999
1723 RTN
1724▸LBL 69
1725 105.659
1726 RTN
1727▸LBL 70
1728 139.576
1729 RTN
1730▸LBL 71
1731 134.972
1732 RTN
1733▸LBL 72
1734 493.821
1735 RTN
1736▸LBL 73
1737 497.762
1738 RTN
1739▸LBL 74
1740 938.257
1741 RTN
1742▸LBL 75
1743 939.551
1744 RTN
1745▸LBL 76
1746 931.3
1747 RTN
1748▸LBL 77
1749 16ᴇ-20
1750 RTN
1751▸LBL 78
1752 9.81
1753 RTN
1754▸LBL 79
1755 3ᴇ8
1756 RTN
1757 END
1758▸LBL "GRAPH"
1759 FC? 81
1760 CF 01
1761 FS? 81
1762 RCL "DAT"
1763 STO "DAT"
1764 FC? 81
1765 XEQ ".STODSP"
1766 SCI 04
1767 CLST
1768 RCL "DAT"
1769 SF 81
1770 "PLOT"
1771 KEY 1 GTO ".PLOT"
1772 "CHNGE"
1773 KEY 2 GTO ".CHMENU"
1775 KEY 3 XEQ ".GRD"
1776 "ErGrd"
1777 KEY 4 XEQ ".DGRD"
1778 "INTCT"
1779 KEY 5 XEQ ".INT"
1780 "ErInt"
1781 KEY 6 XEQ ".DINT"
1782 KEY 9 GTO ".EXIT"
1784 STOP
1785 GTO "GRAPH"
1786 END
1787▸LBL "CUSTOMM"
1788 "CLS"
1789 KEY 1 XEQ "CLS"
1790 "CONST"
1791 KEY 2 XEQ "CONSTS"
1792 "GRAPH"
1793 KEY 3 XEQ "GRAPH"
1794 "CLOCK"
1795 KEY 4 XEQ "CLOCK"
1796 "INTVL"
1797 KEY 5 XEQ "INTVL"
1798 "TIMER"
1799 KEY 6 XEQ "TIMER"
1800 CLA
1801 KEY 7 GTO "CUSTOMM"
1802 KEY 8 GTO "CUSTOMM"
1803 KEY 9 XEQ "CUSTOMM"
1805 STOP
1806 XEQ "CUSTOMM"
1807 END
1808▸LBL "CHANGE"
1809 SIN
1810 END``````
The .raw file is here:
labtoys.zip