{VERSION 2 3 "APPLE_PPC_MAC" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 12 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Geneva" 1 10 0 0 0 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 11 12 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple P lot" 0 13 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 0" -1 256 1 {CSTYLE "" -1 -1 "Monaco" 1 9 0 0 255 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 0" -1 257 1 {CSTYLE "" -1 -1 "Geneva" 1 12 0 0 0 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 \+ Font 2" -1 258 1 {CSTYLE "" -1 -1 "Geneva" 1 10 0 0 0 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 714 "PROGRAM: Darts\nCALLI NG SEQUENCE: Darts(n, show)\nPARAMETERS:\n n - an integer\n s how - a Boolean variable (true or false)\nSYNOPSIS: \n - This pro gram simulates n throws of a dart at a circular dartboard of radius 1. The\n program displays a bar graph in which the area of the i 'th bar is equal to the\n fraction of the total falling in the \+ i'th region. If show = true, then the program\n prints a list \+ of distances that the dart landed from the center of the board. \+ \n - Note: this program requires the program \"Areabargraph(data, xmin, xmax, k)\" be \n initialized.\nRETURNED VALUES:\n - \+ none\nLOCATION:\n Folder: Chapter 2\n File: \"Darts.Chpt 2.map.r4\"\n\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 356 "Darts:=proc(n,sh ow)\n\011local result,count,U,x,y,distance:\n\011with(stats):\n\011res ult:=[]:\n\011count:=1:\n\011U:=random[uniform[-1,1]]('generator'):\n \011while count<(n+1) do\n\011\011x:=U(): y:=U():\n\011\011distance:= sqrt(x^2 + y^2):\n\011\011if distance<=1 then\n\011\011\011result:=[op (result),distance]:\n\011\011\011count:=count+1:\n\011\011fi:\n\011od: \n\011if show then print(result) fi;\n\011Areabargraph(result,0,1,10); \nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "Darts(10,true);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#7,$\"+8f#>v%!#5$\"+]Q_x7F&$\"+lkHB\\ F&$\"+L8AqoF&$\"+)R2P0(F&$\"+))o^DIF&$\"+/0'4()*F&$\"+ON$4]\"F&$\"+T7* y@(F&$\"+iYFaxF&" }}{PARA 13 "" 1 "" {INLPLOT "6$-%'CURVESG6$7J7$\"\"! F(F'7$$\"1+++++++5!#;F(F)F)7$F*$\"\"#F(7$$\"1+++++++?F,F.7$F1F(F3F37$$ \"1+++++++IF,F(F4F47$F5$\"\"\"F(7$$\"1+++++++SF,F87$F;F(F=7$F;F.7$$\"1 +++++++]F,F.7$F@F(FBFB7$$\"1+++++++gF,F(FCFC7$FDF87$$\"1+++++++qF,F87$ FHF(FJ7$FH$\"\"$F(7$$\"1+++++++!)F,FL7$FOF(FQFQ7$$\"1+++++++!*F,F(FRFR 7$FSF87$F8F87$F8F(-%'COLOURG6&%$RGBG$\"#5!\"\"F(F(-%&STYLEG6#%%LINEG" 2 254 254 254 6 0 1 0 2 9 0 4 2 1.000000 45.000000 45.000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "Darts(1000,false);" }}{PARA 13 "" 1 "" {INLPLOT "6$-%'CURVESG6$7J7$\"\"!F(7$F($\"1+++++++7$F<$\"1+++++++lF,7$$\"1+++++++SF,F@7$FCF( FE7$FC$\"1+++++++()F,7$$\"1+++++++]F,FG7$FJF(FL7$FJ$\"1++++++q5!#:7$$ \"1+++++++gF,FN7$FRF(FT7$FR$\"1++++++!R\"FP7$$\"1+++++++qF,FV7$FYF(Fen 7$FY$\"1++++++![\"FP7$$\"1+++++++!)F,Fgn7$FjnF(F\\o7$Fjn$\"1++++++!o\" FP7$$\"1+++++++!*F,F^o7$FaoF(Fco7$Fao$\"1++++++!*>FP7$$\"\"\"F(Feo7$Fh oF(-%'COLOURG6&%$RGBG$\"#5!\"\"F(F(-%&STYLEG6#%%LINEG" 2 254 254 254 6 0 1 0 2 9 0 4 2 1.000000 45.000000 45.000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "3 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }