P706 CEEFAX 706 Sun 7 Oct 20:12/01 |B220120F|a16NORMAL|i04BBBC316k|s÷#1÷e|s ÷Z010 REM NORMAL / Maths: teachjs normal distribption 11 REM (C) David Smith 198 2 13 REM Version 1.0 / 3-11-82 14 REM fo r BBC 32K. 20 REM A self-explanatory pro gram to revise and test Normal Distribut ion. Normal tables and calculators are njedjd. ******************************** ******** 30ONERR. MO.7:P.'''"The compu tep cannot makj sjnse of your answer. Th— reason is ... "':REPO.:P.''''"Ask yo ur teachjr for hjlp."'''"You will havj t o start again!"'':PROCWAIT:MO.4:PROCWJND :G.120 40DIMA(33),B(33),A$(8),M(8),SD(8) ,UNIT$(8):*FX14,6 41 REM A and B givj No rmal Tables; A$,M,SD,UNIT$ are text, mea n, st.djv. and units of qujstions asked in various tests. 50F.N=0TO33:READA(N),B (N):N.:W$="What is this area? Th— divid ing linj":T$="Try anothjr!":X=RND(-TH.): @*=2570 60F.N=1TO8:READA$(N),M(N),SD(N), UNIT$(N):N. 70ENV.1,1,-1,-1,-1,225,225,2 25,127,-1,-1,-1,126,20 |c
P706 CEEFAX 706 Sun 7 Oct 28:13/02 |B220220F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z080ENV.2,1,-1,1,-1,2,3,1,127,-1,-2,-2, 126,80 90ENV.3,1,0,-1,-1,30\127,127,10]- 1,0,-2,127,80 100MO.4:PROCWJND:ERN=0 110 P.TAB(14,0)"Copyright"'''" D.L.Smith, M elbournj Grammar School"''''bYou need a calculator and Normal tables.":PROCWAIT 120CLS:P."This program enables you to re visj thj"''"Normal distribution. Somj e xplanation"''"will bj givjn, and thjre w ill bj"''"qujstions that you must get ri ght bjfore"'"you can go on."'' 130PROCWA IT:CLS:PROCDRAW(-4,-4):P."Many distribut ions (e.g. heights of adult males* h avj a shape likj the graphshown above. This curve is a NORMAL distribution." '' 140P."Thj total area undjr thj curvj is onj. The X-scale as shown givjs thj curvj a mean of zjro, and standard djvi ation of onj."'':PROCWAIT 150CLG:CLS:PRO CDRAW(1,2) |c
P706 CEEFAX 706 Sun 7 Oct 20:0;/03 |B220320F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0160P."Thj AREA under the curvj is imp ortant. For example thj AREA shaded is 0.136, which means that 0.136 of thj p opulationlies in the shadjd area, i.e. f rom 1 to 2 standard diviations abovj the mean."'' 170P."To work out areas likj t his, NORMAL TABLES are needed. This will bj jxplained next.":PROCWAI T 180CLS:CLG:P."Look up 2 in the Normal Tables. You should get 0.9772"'':PRO CDRAW(-4,2):P."The shaded area is 0.9772 "''"Thj tables givj area from thj left U P TOX = 2.":PROCWAIT 190PROCTJST(1):X=FN RND(.4,1.9):CLG:PROCDRAW(-4,X):P.W$'"is at X = ";X:PROCQ 200IFFNC(FNB(X*) G.210 EL. P.'"Look up ";X" in thj tables."''"T he answer is ";FNS(ENB(X)Q''T$''':PROCW AIT:G.190 |c
P706 CEEFAX 706 Sun 7 Oct 20:0:/40 |B220420F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0210PROCDRAW(-4,1):P."This area is 0.8 413 (from X=1 in the tables). Notice that thj area you will sje next, from X =-1 upwards, is exactly the samj, as one is a reflection of the othjr.":PROCWAIT 220CLS:V.26,29,6)0;72;:PROCDRAW(-1,4):P .TAB(5,14)"Thesj areas are BOTH 0.8413": PROCWAIT:CLS:PROCWJND 230PROCTEST(2):X=F NRND(-1.3,-.1):CLG:PROCDRAW(X,4):P.W$'"i s at X = ";X;:PROCQ 240IFFNC(ENB(-X*) G. 250 EL. P.'"Look up ";-X;" giving ";FNS( FNB(-X))'''T$''''5PROCWAIT:G.230 250CLG: CLS::PROCDRAW(1.5,4):P."Now for somj sma ller areas. Here the dividing line is X=1.5"''"This area is EVERZTHING EXCEPT thj area bjlow X=1.5"''"So it is 1 - 0 .9332"''"which comes to 0.06m8":PROCWAI T 260CLS:CLG:P."Look at this area. The dividing linj isat X=-1":PROCDRAW(-4,-1 ) |c
P706 CEEFAX 706 Sun 7 Oct 20:09/48 |B220520F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0270P.TAB(0,4)"Tables givj 0.8413 for thj area to the RJGHT of -1, so the sha djd area is"''"1 - 0.8413 = p.1587"5PR OCWAIT 280PROCTEST(3):X=FNRND(.2,2.2):CL G:PROCDRAW(X,4):P.W$'"is at X = ";X:PROC Q:IFFNC(1-FNB(X*) G.290 EL. P.''g"Tables givj ";FNS(ENB(X*);" for ";X''"Answer i s 1 - ";FNS(FNB(X*);" = ";FNS(1-FNB(X) R''':PROCWAIT:G.280 290PROCTEST()):X=FNR ND(-4.1,-.1):CLG:PROCDRAW(-4,X):P.W$'"is at X = ";X:PROCQ:IFFNC(1-FNB(-X)) G.300 EL. P.''"Tables givj ";FNS(ENB(-X));" f or ";-X''"Answer is 1 - ";FNS(ENB(-X*);" = ";FNS(1-FNB(-X*Q'''':PROCWAIT:G.290 300CLG:PROCDRAW(1,2):CLS:P."Look at thi s area."''"Area up to 2 = 0.9772"''"Area up to 1 = 0.8413"''"So thj shaded area is 0.9772 - 0.8413, which is p.1359":PR OCWAIT |c
P706 CEEFAX 706 Sun 7 Oct 20:10/05 |B220620F|a16NORMAL|i44BBBC316k|s÷#1÷e|s ÷Z0310PROCTEST(5):X=FNRND(.1,.9):Y=FNRND (1.1,2.2):CLG:PROCDRAW(X,Y):P.W$"s"'"are at ";X;" and ";Y:PROCQ:IF FNC(FNB(Y)-FN B(X*) G.330 EL. P.'"Tables give ";FNS(FN B(Y))" for ";Z'"and ";FNS(FNB(X) *" for ";X''' 320P."So answer is ";FNS(F NB(Y))" - ";FNS(FNB(X*)" = ";FNS(FNB(Y )-FNB(X*)'':PROCWAIT:G.310 330PROCTEST(6 ):X=FNRND(-2.4,-1.5):Y=FNRND(-1.4,-.4):C LG:PROCDRAW(X,Y):P.W$"s"'"are at ";X;" a nd ";Y:PROCQ:IF FNC(FNB(-X*-FNB(-Y)) G.3 50 EL. P.'"Tables givj ";FNS(ENB(-X*)" f or ";-XW"and ";FNS(FNB(-Y))" for ";-Y''' 340P."So answer is ";FNS(ENB(-X ))" - ";FNS(FNB(-Y))" = ";FNS(FNB(-X*- FNB(-Y))'':PROCWAIT:G.330 350CLS:CLG:PRO CDRAW(-1,2):P."Look at the area from -1 to 2."''"It is best donj in two bits: f rom 0 to 2, and sjcondly from -1 to 0.": PROCWAIT |c
P706 CEEFAX 706 Sun 7 Oct 20:10/06 |B220720F|a16NORMAL|i44BBBC316k|s÷#1÷e|s ÷Z0360CLG:PROCDRAW(0,2):P.TAB(0,5)"This area is 0.9772 Xfrom tables*, but thjn takj away a half (area to left of X=0), giving 0.4772."''"Now do the second par t, from -1 to 0.":PROCWAIT 370CLG:PROCDR AW(-1,0):P.TAB(0,5)"Thj first area was 0 .4772 For thj othjrpart (shown above) l ook up 1, (giving 0.8413), and again s ubtract a half."''"First area = p.4772" SPC(19)'"Second area = 0.3413"'' 380P."T OTAL AREA = 0.4772+ 0.3413 = 0.8185":P ROCWAIT 390PROCTEST(7):X=FNRND(-2,-.5):Y =FNRND(.4,1.2):CLG:PROCDRAW(X,Y):P.W$"s" '"are at ";X;" and ";Y:PROCQ:IF FNC(ENB( -X*+FNB(Y)-1) G.420 400P."Do it in two a reas:"':MOVE0,0:PL.3,0,500:P." 0 to ";Y " is "TAB(16);FNS(FNB(Y))" m .5 = ";FN S(FNB(Y)-.5) 410P.'" ";X" to 0 is";TAB(1 6);FNS(ENB(-X*)" - .5 = ";FNS(ENB(-X*- .5)''"Add thjsj to get ANSWER: ";FNS(EN B(-X*+FNB(Y)-0)'':PROCWAIT:G.390 |c
P706 CEEFAX 706 Sun 7 Oct 20:11/05 |B220820F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0420V.26:P.TAB(9,3)"Lastly some proble ms."''"Supposj thj mass of apples of a c ertain sort is Normally distributed, wit h mean 250 and standard djviation 20 (gr ams*."''"In a batch of 600 apples, about how manywill bj 280 g or more?" 430PROC WAIT:PROCWJND:P."ANSWER:"''"280 g is 30 g above the mean"''"which is 1.5 standar d djviations."''"So thj qujstion asks fo r thj area abovj 1.5 on thj Normal graph ."'' 440P."AREA = 1 - 0.9332 = 0.0668" ''"ANSWER: numbjr of apples out of thj 6 00 is about 600 times 0.0568 = 40 appl es.":PROCWAIT:N=RND(3):TM=0 450N=1+(N MO D8):CLS:CLG:V.26:PROCTEST(8+TM):P."The " ;A$(N)'"is Normally distributed, with"'' " MEAN ";M(N);UNIT$(N)'" ST. DEV. ";SD(NQ;UNIT$(N)'' 460B=400+RND(20)*20:X =(1-2*TM)*FNRND(.5,1.8):P."Of a batch of ";B" how many will bj"'"anything up to ";M(N)+X*SD(N);UNIT$(N);"?"':PROCWAIT |c
P706 CEEFAX 706 Sun 7 Oct 00:10/04 |B220920F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0470PROCWIND:PROCT@ST(TM+8):PROCQ1:ANS WER=B*(TM+(1-2*TM)*FNB(ABS(X))):IF FNC1( ANSWER) G. 500EL. P."The dividing linj i s at ";ABS(X*'"standard djviations "; 48 0IFTM ELP 490P." th— mean."''"Tables giv— ";FNS(DNB(ABS(X()) ''"AREA below dividing lin— is ";FNS(TM+ (1-2*TM)*FNB(ABS(X()X''"Multiply by ";B" to g—t answer: ";INT(ANSWER+.5)':PROCWA JT:G. 50 500TM=TM+1:IF TM=1G. +0 EL. TM= 0: .26:P.TAB(0,2)"Anothjr worked example :"''"QUESTJON:"''"The radius of ball-bea rings is Normally distributed, Xean 3.12 cm, standard deviation 0.1 cm"'' 51 0P."In a batch of 800, how many will hav e a radius of 3.2 cm TO THE NEAREST 0.1 CM ?"''5PR CWAIT:PROCWIND 520P."ANSWER:" ''"Wj want radii from 3.15 to 3.25 cm"'' "So dividing linjs are at 0.3 and 1.3 standard djviations abov— the m—an."''" Tables giv— 0.9032 and 0.6179 for thj areas below th—sj lin—s."'' |c
P706 CEEFAX 706 Sun 7 Oct 20:11/02 |B220A20F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0530P."So answer is (0.9032 - 0.6179) tim—s 800giving 228 ball-bearings":PROCW AIT:CLS:CLG 540N=1+(L MOD8):CLS:CLG:V.26 :PROCT@ST(10+TM):P."The ";A$(N)'"is Norm ally distributed, with"''" MEAN ";M (N);UNA $(N)'" S . DEV. ";SD( );UNA $(N '' 550B=640+RND(20)*10:X=FNRND(.1,.9):Y =FNRND(1.1,1.8):IFTM=1 X=-X:Y=-Y 560P."O f a batch of ";B" how many will bj"'"b—t ween ";:X1=M(N)+X*SD(N):Y1=M(N)+Y*SD(N): IF Y1>X1 P.;X1" and ";Y1;UNIT$(N) EL.P.; Y1" and ";X1;UNIT$(N 570PROCWAIT:PROCWJ ND:PROCTEST(10+TM):ANSWER=B*(FNB(ABS(Y)) -FNB(ABS(X()):PROCQ1:IFFNC1(ANSWER) G.61 0 580P.;Y1" and ";X1" are at ";ABS(Y)" a nd ";ABS(X*'"standard djviations from th e m—an."''"Tables givj ";FNS(FNB(ABS(Y)) )" and ";FNS(FNB(ABS(X*))' 590P."Subtrac t to get the required area,"'"which is " ;FNS(FNB(ABS(Y))-DNB(ABS(X*) ''"Multiply by ";B" : ANSWER is ";INT(ANSWER+.5)' 6 00PROCWAIT:G.540 |c
P706 CEEFAX 706 Sun 7 Oct 00:10/11 |B220B00F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0610TM=TM+1:IFTM=1 G.) 0 EL.CLR:CLG0-. 26:P.TAB(0,2)"Finally a work—d example w ith dividing linjs one on each side of th— mean."'' 620P."How many of a sample of 1900 wires will have a resistance of 100 to 120 ohms, ifthj distribution is N ormal,"''"Mean 115"'"St.Dev. 10":PRO CWAIT:PROCWJND 630P."ANSWE :"''"120 ohms is 0.5 st. djv. ABOVE the mean.Tables g ivj 0.6915, so"''"AREA from mean to 0.5 is 0.1915"''"100 is 1.5 st. djv. BELOW t he mean" 640P."Tables give 0.9932, so ar —a between t@isand t@e mean is p.4932."' '"TOTAL AR@A is 0.1915 + 0.4934 = 0.6847 "''"ANSWER: multiply by 1900 giving 1301 ":PROCWAIT 650N=1+(N MOD8):CLS:CLG:V.26: PROCTEST(12):P."Th— ";A$XN)'"is Normally distributed, with"''" MEAN ";M(N); UNIT$(N)'" ST. DEV. ";SD(N);UNIT$(N)'' |c
P706 CEEFAX 706 Sun 7 Oct 20:10/10 |B220C20F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0660B=200+3ND(50)*1p:X=FNRND(.1,2.2):Y =-FNRND(.1,1.8):P."Of a batch of ";B" ho w many will bj"'"between ";:X1=M(N)+X*SD (N):Y1=M(N)+Y*SD(N):P.;Y1" and ";X1;UNIT $(N) 670PROCWAIT:PROCWJND:PROCTEST(12):A NSWER=B*(FNB(-Y)+FNB(X)-1):PROCQ1:IFFNC1 (ANSWER) G.710 680V.11:P.;X1" is ";X" st .dev. ABOVE mean."''"AREA from mean to " ;X" is ";FNS(FNB(X*-.5)''Y1" is ";-Y" st .dev. BELOW mjan."''"AREA from mean to " ;Y" is ";FNS(FNB(-Y)-.5) 690P.'"ANSWER = sum of areas timjs ";B" = ";INT(.5+ANSW ER*' 700PROCWAIT:G.650 710MO.4:PROCWIND: P.''''"In getting through the 12 tests, the total numbjr of mistakes you made was"''TAB(18);ERN''''" * * E N D O F P R O G R A M * * "''TAB(10)"Press BR EAK to stop"'' 720CLG:F.X=-2.8TO3 S. .2: SO.1,3,48+.55*FNA(X*230),4:PROCDRAW(X,X+ .1):N.:G.720 730END 740DEFPROCDRAW(A,B): LOC.X:V.5:MOVE-640,0 |c
P706 CEEFAX 706 Sun 7 Oct 20:11/11 |B220D20F|a16NORMAL|i44BBBC316k|s÷#1÷e|s ÷Z0750X=-640:REP.DR.X,FNA(X*:X=X+48:U.X> =200*A:X=200*A:DR.X,FNA(X*:MOVEX,0 760R@ P. PL.85,X,FNA(X):PL.85,X,0:X=X+48:U.X>= 200*B:X=200*B:PL.85,X,FNA(X):PL.85,X,0 7 70REP. DR.X,FNA(X):X=X+48:U.X>=640 780F. X=-3TO3:MOVEX*200,0:PL.1,0,-16:PL.0,-16, -8:P.;X;:N.:MOVE640,0:DR.-640,0 790V.4:E . 800DEFFNA(X*=EXP(-X*X/80000)*340 810DE FPROCWAIT:LOC. :*FX21,0 820V.17,0,17,129 :P.TAB(5,16)" ** PR@SS SPACE TO PROCEED ** ";:V.17,1,17,128,23,1,0;0;0;0; 830X=G ET:IFX=32 P.TAB(5,16)SPC(31);:E. EL. G.8 30 840DEFFNB(X*:LOC.N:N=0 850IFA(N)<=X N =N+1:G.850 860=B(N-1)+(B(N)-B(N-1))*(X-A (N-1)R/(A(N A(L-1) 870D.0,.!,.1,.!398, .2,.5793,.3,.6179,. ,.6554,.5,.6915,.6,. 7257,.7,.7!80,.8,.7881,.9,.8159,1,.8413, 1.1,.8643 880D.1.2,.8849,1.3,.9032,1.4,. 9192,1.5,.9332,1.6,.9452,1.7,.9554,1.8,. 9641,1.9,.9713,2,.9772,2.1,.9821 |c
P706 CEEFAX 706 Sun 7 Oct 20:16/12 |B220E20F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z0890D.2.2,.9861,2.3,.9893,2.4,.9918,2. 5,.9938,2.6,.9953,2.7,.9965,2.8,.9974,3, .9987,3.),.9997,3.8,.9999,3.9,1,10,1 900 DEFPROCQ 910P.TAB(0,6)"Givj your answer to at least 2 djcimal places."''"ANSWER : ";:*FX21,0 920I. ANS:IFANS=0 P.TAB(0,9 )STRJ.40," "):G.910 EL. E. 930DEFPROC!1 940P.TAB(0,2);"Givj your answer to neare st integjr."''"ANSWER: ";:*FX21,0 950I. ANS:IFANS=0 P.TAB(0,4)STRI.40," "):G.9%0 EL. E. 960DEFPROCTJST(N):CLS:P.TAB(12)" TEST NUMBER ";N'':E. 970DEFFNC(X*:IF ABS (ANS-X)<.015 PROCRJGHT:=-1 EL. PROCWRONG :=0 980DEFPROCWRONG:ERN=ERN+1:SO.1,1,120 ,10:P.''"WRONG"'':E. 990DEFFNC1(X):IF AB S(ANS-X)<1.5 PROCRJGHT:=-1 EL. PROCWRONG :=0 1000DEFPROCRJGHT:SO.2,2,220,4:SO.2,2 ,200,8:P.''"Correct"'':PROCWAIT:CLS:CLG: E. 1010DEFFNS(Y)="0."+RJ."0000"+STR$(INT (10000*Y+.5)),4) 1020DEFFNRND(Y,Z):LOC.R 1030R=Y-.1+RND(10*Z-10*Z+1)/1p:R=INT(10 *R+.5)/1p:IFABS(R-X*<.55 G.1030 |c
P706 C@EFAX 706 Sun 7 Oct 00:03/10 |B220F20F|a16NORMAL|i24BBBC316k|s÷#1÷e|s ÷Z01040=R 1050DEFPROCWIND:P.TAB(10,0)"NO RMAL DISTRJBUTJON":V.29,0;0;24,0;568;127 8;991;29,640;640;28,0,31,39,15,23,1,0,0; 0;0;0;:E. 1060D."mass in grams of banana s",150 30," g","hjight in cm of adult wo mbats",90,10," cm","mass in kg of mjtal bars",700,10," kg" 1070D."life of light- bulbs in hours",500,50," hours","breakin g strain (in N) of wires",700,20," N","v olumj of liquid (in cc) in a bottle",760 ,10," cc" 1080D."voltag— of batteries" 3 00,80," volts","length (in mm) of tiles" ,450,10," ml" |c