Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape21b_acorn_eu_1991_april.wav » R.Mean/SD

R.Mean/SD

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape21b_acorn_eu_1991_april.wav
Filename: R.Mean/SD
Read OK:
File size: 0258 bytes
Load address: FFFF1A00
Exec address: FFFF8023
File contents
   10REM by Thomas How
   20REM (c) The Micro User
   30MODE 7:PRINT '''"Mean and Standard Deviation calculator"''''"Enter data in following format:"''"Value of X"
   40PRINT "Frequency (F) of that X"''"Repeat process for each value of X"
   50INPUT ''"How many data items ",d
   60CLS:DIM data(d,1):FOR C=0 TO d-1
   70INPUT '"Data 'X' ",N:data(C,0)=N
   80INPUT "Frequency 'F' ",F
   90data(C,1)=F:NEXT
  100PRINT ''"Calculating..."
  110M=0:V=0:FOR I=0 TO d-1:M=M+(data(I,0)*data(I,1)):V=V+(data(I,1)):NEXT:mean=M/V:PRINT '"   Mean = ";mean
  120T=0:R=0:FOR I=0 TO d-1:T=T+(data(I,0)*data(I,0)*data(I,1)):NEXT:R=T*(1/V):A=R-(mean*mean):SD=SQR(A):PRINT "   Standard Deviation = ";SD

� by Thomas How
� (c) The Micro User
h� 7:� '''"Mean and Standard Deviation calculator"''''"Enter data in following format:"''"Value of X"
(E� "Frequency (F) of that X"''"Repeat process for each value of X"
2 � ''"How many data items ",d
<�:� data(d,1):� C=0 � d-1
F � '"Data 'X' ",N:data(C,0)=N
P� "Frequency 'F' ",F
Zdata(C,1)=F:�
d� ''"Calculating..."
naM=0:V=0:� I=0 � d-1:M=M+(data(I,0)*data(I,1)):V=V+(data(I,1)):�:mean=M/V:� '"   Mean = ";mean
xT=0:R=0:� I=0 � d-1:T=T+(data(I,0)*data(I,0)*data(I,1)):�:R=T*(1/V):A=R-(mean*mean):SD=�(A):� "   Standard Deviation = ";SD
�
00000000  0d 00 0a 13 f4 20 62 79  20 54 68 6f 6d 61 73 20  |..... by Thomas |
00000010  48 6f 77 0d 00 14 18 f4  20 28 63 29 20 54 68 65  |How..... (c) The|
00000020  20 4d 69 63 72 6f 20 55  73 65 72 0d 00 1e 68 eb  | Micro User...h.|
00000030  20 37 3a f1 20 27 27 27  22 4d 65 61 6e 20 61 6e  | 7:. '''"Mean an|
00000040  64 20 53 74 61 6e 64 61  72 64 20 44 65 76 69 61  |d Standard Devia|
00000050  74 69 6f 6e 20 63 61 6c  63 75 6c 61 74 6f 72 22  |tion calculator"|
00000060  27 27 27 27 22 45 6e 74  65 72 20 64 61 74 61 20  |''''"Enter data |
00000070  69 6e 20 66 6f 6c 6c 6f  77 69 6e 67 20 66 6f 72  |in following for|
00000080  6d 61 74 3a 22 27 27 22  56 61 6c 75 65 20 6f 66  |mat:"''"Value of|
00000090  20 58 22 0d 00 28 45 f1  20 22 46 72 65 71 75 65  | X"..(E. "Freque|
000000a0  6e 63 79 20 28 46 29 20  6f 66 20 74 68 61 74 20  |ncy (F) of that |
000000b0  58 22 27 27 22 52 65 70  65 61 74 20 70 72 6f 63  |X"''"Repeat proc|
000000c0  65 73 73 20 66 6f 72 20  65 61 63 68 20 76 61 6c  |ess for each val|
000000d0  75 65 20 6f 66 20 58 22  0d 00 32 20 e8 20 27 27  |ue of X"..2 . ''|
000000e0  22 48 6f 77 20 6d 61 6e  79 20 64 61 74 61 20 69  |"How many data i|
000000f0  74 65 6d 73 20 22 2c 64  0d 00 3c 1d db 3a de 20  |tems ",d..<..:. |
00000100  64 61 74 61 28 64 2c 31  29 3a e3 20 43 3d 30 20  |data(d,1):. C=0 |
00000110  b8 20 64 2d 31 0d 00 46  20 e8 20 27 22 44 61 74  |. d-1..F . '"Dat|
00000120  61 20 27 58 27 20 22 2c  4e 3a 64 61 74 61 28 43  |a 'X' ",N:data(C|
00000130  2c 30 29 3d 4e 0d 00 50  18 e8 20 22 46 72 65 71  |,0)=N..P.. "Freq|
00000140  75 65 6e 63 79 20 27 46  27 20 22 2c 46 0d 00 5a  |uency 'F' ",F..Z|
00000150  11 64 61 74 61 28 43 2c  31 29 3d 46 3a ed 0d 00  |.data(C,1)=F:...|
00000160  64 18 f1 20 27 27 22 43  61 6c 63 75 6c 61 74 69  |d.. ''"Calculati|
00000170  6e 67 2e 2e 2e 22 0d 00  6e 61 4d 3d 30 3a 56 3d  |ng..."..naM=0:V=|
00000180  30 3a e3 20 49 3d 30 20  b8 20 64 2d 31 3a 4d 3d  |0:. I=0 . d-1:M=|
00000190  4d 2b 28 64 61 74 61 28  49 2c 30 29 2a 64 61 74  |M+(data(I,0)*dat|
000001a0  61 28 49 2c 31 29 29 3a  56 3d 56 2b 28 64 61 74  |a(I,1)):V=V+(dat|
000001b0  61 28 49 2c 31 29 29 3a  ed 3a 6d 65 61 6e 3d 4d  |a(I,1)):.:mean=M|
000001c0  2f 56 3a f1 20 27 22 20  20 20 4d 65 61 6e 20 3d  |/V:. '"   Mean =|
000001d0  20 22 3b 6d 65 61 6e 0d  00 78 7f 54 3d 30 3a 52  | ";mean..x.T=0:R|
000001e0  3d 30 3a e3 20 49 3d 30  20 b8 20 64 2d 31 3a 54  |=0:. I=0 . d-1:T|
000001f0  3d 54 2b 28 64 61 74 61  28 49 2c 30 29 2a 64 61  |=T+(data(I,0)*da|
00000200  74 61 28 49 2c 30 29 2a  64 61 74 61 28 49 2c 31  |ta(I,0)*data(I,1|
00000210  29 29 3a ed 3a 52 3d 54  2a 28 31 2f 56 29 3a 41  |)):.:R=T*(1/V):A|
00000220  3d 52 2d 28 6d 65 61 6e  2a 6d 65 61 6e 29 3a 53  |=R-(mean*mean):S|
00000230  44 3d b6 28 41 29 3a f1  20 22 20 20 20 53 74 61  |D=.(A):. "   Sta|
00000240  6e 64 61 72 64 20 44 65  76 69 61 74 69 6f 6e 20  |ndard Deviation |
00000250  3d 20 22 3b 53 44 0d ff                           |= ";SD..|
00000258
R.Mean/SD.m0
R.Mean/SD.m1
R.Mean/SD.m2
R.Mean/SD.m4
R.Mean/SD.m5