(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; automaticGrouping; currentKernel; ] :[font = title; inactive; preserveAspect; startGroup] 18. Probabilistic System Assessment :[font = section; inactive; preserveAspect; startGroup] 18.1 Use of Statistics Packages :[font = input; preserveAspect] Needs["Statistics`Master`"] Needs["Graphics`Graphics`"] :[font = input; preserveAspect] LogUniformDistribution::usage = "LogUniformDistribution[min, max] represents the continuous loguniform distribution with endpoints min and max with min < max. Log[10, x] of the random variable x is uniformly distributed on [Log[10, min], Log[10, max]]"; LogUniformDistribution/: Domain[LogUniformDistribution[min_:1, max_:10]] := {min, max} LogUniformDistribution/: Random[LogUniformDistribution[min_:1, max_:10]] := 10.0^Random[Real, {N[Log[10, min]], N[Log[10, max]]}] LogUniformDistribution/: PDF[LogUniformDistribution[min_:1, max_:10], x_] := With[{result = 1/(x*Log[max/min])}, If[NumberQ[N[result]],N[result],result]] :[font = input; preserveAspect; startGroup] ?LogUniformDistribution :[font = info; inactive; preserveAspect; endGroup] LogUniformDistribution[min, max] represents the continuous loguniform distribution with endpoints min and max with min < max. Log[10, x] of the random variable x is uniformly distributed on [Log[10, min], Log[10, max]] :[font = input; preserveAspect; startGroup] q = LogUniformDistribution[3, 300] :[font = output; output; inactive; preserveAspect; endGroup] LogUniformDistribution[3, 300] ;[o] LogUniformDistribution[3, 300] :[font = input; preserveAspect; startGroup] PDF[q, x] :[font = output; output; inactive; preserveAspect; endGroup] 1/(x*Log[100]) ;[o] 1 ---------- x Log[100] :[font = input; preserveAspect; startGroup] Plot[PDF[q, x], {x, 3, 300}]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.0031746 0.0147151 8.13186 [ [(50)] .18254 .01472 0 2 Msboxa [(100)] .34127 .01472 0 2 Msboxa [(150)] .5 .01472 0 2 Msboxa [(200)] .65873 .01472 0 2 Msboxa [(250)] .81746 .01472 0 2 Msboxa [(300)] .97619 .01472 0 2 Msboxa [(0.01)] .01131 .09603 1 0 Msboxa [(0.02)] .01131 .17735 1 0 Msboxa [(0.03)] .01131 .25867 1 0 Msboxa [(0.04)] .01131 .33999 1 0 Msboxa [(0.05)] .01131 .42131 1 0 Msboxa [(0.06)] .01131 .50263 1 0 Msboxa [(0.07)] .01131 .58395 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .18254 .01472 m .18254 .02097 L s P [(50)] .18254 .01472 0 2 Mshowa p .002 w .34127 .01472 m .34127 .02097 L s P [(100)] .34127 .01472 0 2 Mshowa p .002 w .5 .01472 m .5 .02097 L s P [(150)] .5 .01472 0 2 Mshowa p .002 w .65873 .01472 m .65873 .02097 L s P [(200)] .65873 .01472 0 2 Mshowa p .002 w .81746 .01472 m .81746 .02097 L s P [(250)] .81746 .01472 0 2 Mshowa p .002 w .97619 .01472 m .97619 .02097 L s P [(300)] .97619 .01472 0 2 Mshowa p .001 w .05556 .01472 m .05556 .01847 L s P p .001 w .0873 .01472 m .0873 .01847 L s P p .001 w .11905 .01472 m .11905 .01847 L s P p .001 w .15079 .01472 m .15079 .01847 L s P p .001 w .21429 .01472 m .21429 .01847 L s P p .001 w .24603 .01472 m .24603 .01847 L s P p .001 w .27778 .01472 m .27778 .01847 L s P p .001 w .30952 .01472 m .30952 .01847 L s P p .001 w .37302 .01472 m .37302 .01847 L s P p .001 w .40476 .01472 m .40476 .01847 L s P p .001 w .43651 .01472 m .43651 .01847 L s P p .001 w .46825 .01472 m .46825 .01847 L s P p .001 w .53175 .01472 m .53175 .01847 L s P p .001 w .56349 .01472 m .56349 .01847 L s P p .001 w .59524 .01472 m .59524 .01847 L s P p .001 w .62698 .01472 m .62698 .01847 L s P p .001 w .69048 .01472 m .69048 .01847 L s P p .001 w .72222 .01472 m .72222 .01847 L s P p .001 w .75397 .01472 m .75397 .01847 L s P p .001 w .78571 .01472 m .78571 .01847 L s P p .001 w .84921 .01472 m .84921 .01847 L s P p .001 w .88095 .01472 m .88095 .01847 L s P p .001 w .9127 .01472 m .9127 .01847 L s P p .001 w .94444 .01472 m .94444 .01847 L s P p .002 w 0 .01472 m 1 .01472 L s P p .002 w .02381 .09603 m .03006 .09603 L s P [(0.01)] .01131 .09603 1 0 Mshowa p .002 w .02381 .17735 m .03006 .17735 L s P [(0.02)] .01131 .17735 1 0 Mshowa p .002 w .02381 .25867 m .03006 .25867 L s P [(0.03)] .01131 .25867 1 0 Mshowa p .002 w .02381 .33999 m .03006 .33999 L s P [(0.04)] .01131 .33999 1 0 Mshowa p .002 w .02381 .42131 m .03006 .42131 L s P [(0.05)] .01131 .42131 1 0 Mshowa p .002 w .02381 .50263 m .03006 .50263 L s P [(0.06)] .01131 .50263 1 0 Mshowa p .002 w .02381 .58395 m .03006 .58395 L s P [(0.07)] .01131 .58395 1 0 Mshowa p .001 w .02381 .03098 m .02756 .03098 L s P p .001 w .02381 .04724 m .02756 .04724 L s P p .001 w .02381 .06351 m .02756 .06351 L s P p .001 w .02381 .07977 m .02756 .07977 L s P p .001 w .02381 .1123 m .02756 .1123 L s P p .001 w .02381 .12856 m .02756 .12856 L s P p .001 w .02381 .14482 m .02756 .14482 L s P p .001 w .02381 .16109 m .02756 .16109 L s P p .001 w .02381 .19362 m .02756 .19362 L s P p .001 w .02381 .20988 m .02756 .20988 L s P p .001 w .02381 .22614 m .02756 .22614 L s P p .001 w .02381 .24241 m .02756 .24241 L s P p .001 w .02381 .27493 m .02756 .27493 L s P p .001 w .02381 .2912 m .02756 .2912 L s P p .001 w .02381 .30746 m .02756 .30746 L s P p .001 w .02381 .32373 m .02756 .32373 L s P p .001 w .02381 .35625 m .02756 .35625 L s P p .001 w .02381 .37252 m .02756 .37252 L s P p .001 w .02381 .38878 m .02756 .38878 L s P p .001 w .02381 .40504 m .02756 .40504 L s P p .001 w .02381 .43757 m .02756 .43757 L s P p .001 w .02381 .45384 m .02756 .45384 L s P p .001 w .02381 .4701 m .02756 .4701 L s P p .001 w .02381 .48636 m .02756 .48636 L s P p .001 w .02381 .51889 m .02756 .51889 L s P p .001 w .02381 .53515 m .02756 .53515 L s P p .001 w .02381 .55142 m .02756 .55142 L s P p .001 w .02381 .56768 m .02756 .56768 L s P p .001 w .02381 .60021 m .02756 .60021 L s P p .001 w .02381 .61647 m .02756 .61647 L s P p .002 w .02381 0 m .02381 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p .004 w .03333 .60332 m .03456 .53611 L .03579 .48267 L .03824 .40307 L .0407 .34662 L .04315 .30449 L .04561 .27185 L .04807 .24582 L .05298 .20691 L .05789 .17922 L .0628 .1585 L .06771 .14241 L .07262 .12956 L .08244 .11033 L .09226 .09661 L .10208 .08633 L .1119 .07835 L .12173 .07197 L .13155 .06675 L .15119 .05872 L .17083 .05284 L .19048 .04835 L .21012 .0448 L .22976 .04193 L .26905 .03757 L .30833 .03442 L .34762 .03203 L .3869 .03015 L .42619 .02865 L .46548 .02741 L .50476 .02637 L .54405 .02549 L .58333 .02473 L .62262 .02408 L .6619 .0235 L .70119 .02299 L .74048 .02254 L .77976 .02213 L .81905 .02176 L .85833 .02143 L .89762 .02113 L .9369 .02085 L .97619 .0206 L s P P % End of Graphics MathPictureEnd :[font = input; preserveAspect] logunidata = Table[Random[q], {i, 1, 1000}]; :[font = input; preserveAspect; startGroup] binned = BinCounts[logunidata, {3, 300, 25}] :[font = output; output; inactive; preserveAspect; endGroup] {482, 139, 110, 50, 47, 49, 25, 23, 15, 26, 26, 8} ;[o] {482, 139, 110, 50, 47, 49, 25, 23, 15, 26, 26, 8} :[font = input; preserveAspect; startGroup] plotted = BarChart[binned, PlotRange -> All]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 48; pictureTop = 7; pictureWidth = 253; pictureHeight = 156; endGroup; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations -0.0246166 0.0807103 0.0147151 0.00122117 [ [(1)] .05609 .01472 0 2 Msboxa [(2)] .1368 .01472 0 2 Msboxa [(3)] .21751 .01472 0 2 Msboxa [(4)] .29822 .01472 0 2 Msboxa [(5)] .37893 .01472 0 2 Msboxa [(6)] .45964 .01472 0 2 Msboxa [(7)] .54036 .01472 0 2 Msboxa [(8)] .62107 .01472 0 2 Msboxa [(9)] .70178 .01472 0 2 Msboxa [(10)] .78249 .01472 0 2 Msboxa [(11)] .8632 .01472 0 2 Msboxa [(12)] .94391 .01472 0 2 Msboxa [(100)] -0.00483 .13683 1 0 Msboxa [(200)] -0.00483 .25895 1 0 Msboxa [(300)] -0.00483 .38107 1 0 Msboxa [(400)] -0.00483 .50318 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .05609 .01472 m .05609 .02097 L s P [(1)] .05609 .01472 0 2 Mshowa p .002 w .1368 .01472 m .1368 .02097 L s P [(2)] .1368 .01472 0 2 Mshowa p .002 w .21751 .01472 m .21751 .02097 L s P [(3)] .21751 .01472 0 2 Mshowa p .002 w .29822 .01472 m .29822 .02097 L s P [(4)] .29822 .01472 0 2 Mshowa p .002 w .37893 .01472 m .37893 .02097 L s P [(5)] .37893 .01472 0 2 Mshowa p .002 w .45964 .01472 m .45964 .02097 L s P [(6)] .45964 .01472 0 2 Mshowa p .002 w .54036 .01472 m .54036 .02097 L s P [(7)] .54036 .01472 0 2 Mshowa p .002 w .62107 .01472 m .62107 .02097 L s P [(8)] .62107 .01472 0 2 Mshowa p .002 w .70178 .01472 m .70178 .02097 L s P [(9)] .70178 .01472 0 2 Mshowa p .002 w .78249 .01472 m .78249 .02097 L s P [(10)] .78249 .01472 0 2 Mshowa p .002 w .8632 .01472 m .8632 .02097 L s P [(11)] .8632 .01472 0 2 Mshowa p .002 w .94391 .01472 m .94391 .02097 L s P [(12)] .94391 .01472 0 2 Mshowa p .002 w 0 .01472 m 1 .01472 L s P p .002 w .00767 .13683 m .01392 .13683 L s P [(100)] -0.00483 .13683 1 0 Mshowa p .002 w .00767 .25895 m .01392 .25895 L s P [(200)] -0.00483 .25895 1 0 Mshowa p .002 w .00767 .38107 m .01392 .38107 L s P [(300)] -0.00483 .38107 1 0 Mshowa p .002 w .00767 .50318 m .01392 .50318 L s P [(400)] -0.00483 .50318 1 0 Mshowa p .001 w .00767 .03914 m .01142 .03914 L s P p .001 w .00767 .06356 m .01142 .06356 L s P p .001 w .00767 .08799 m .01142 .08799 L s P p .001 w .00767 .11241 m .01142 .11241 L s P p .001 w .00767 .16126 m .01142 .16126 L s P p .001 w .00767 .18568 m .01142 .18568 L s P p .001 w .00767 .2101 m .01142 .2101 L s P p .001 w .00767 .23453 m .01142 .23453 L s P p .001 w .00767 .28337 m .01142 .28337 L s P p .001 w .00767 .3078 m .01142 .3078 L s P p .001 w .00767 .33222 m .01142 .33222 L s P p .001 w .00767 .35664 m .01142 .35664 L s P p .001 w .00767 .40549 m .01142 .40549 L s P p .001 w .00767 .42991 m .01142 .42991 L s P p .001 w .00767 .45434 m .01142 .45434 L s P p .001 w .00767 .47876 m .01142 .47876 L s P p .001 w .00767 .52761 m .01142 .52761 L s P p .001 w .00767 .55203 m .01142 .55203 L s P p .001 w .00767 .57645 m .01142 .57645 L s P p .001 w .00767 .60088 m .01142 .60088 L s P p .002 w .00767 0 m .00767 .61803 L s P P p p p 1 0 0 r .02381 .01472 m .02381 .60332 L .08838 .60332 L .08838 .01472 L F P p .004 w .02381 .01472 m .02381 .60332 L .08838 .60332 L .08838 .01472 L .02381 .01472 L s P P p p 1 0 0 r .10452 .01472 m .10452 .18446 L .16909 .18446 L .16909 .01472 L F P p .004 w .10452 .01472 m .10452 .18446 L .16909 .18446 L .16909 .01472 L .10452 .01472 L s P P p p 1 0 0 r .18523 .01472 m .18523 .14904 L .2498 .14904 L .2498 .01472 L F P p .004 w .18523 .01472 m .18523 .14904 L .2498 .14904 L .2498 .01472 L .18523 .01472 L s P P p p 1 0 0 r .26594 .01472 m .26594 .07577 L .33051 .07577 L .33051 .01472 L F P p .004 w .26594 .01472 m .26594 .07577 L .33051 .07577 L .33051 .01472 L .26594 .01472 L s P P p p 1 0 0 r .34665 .01472 m .34665 .07211 L .41122 .07211 L .41122 .01472 L F P p .004 w .34665 .01472 m .34665 .07211 L .41122 .07211 L .41122 .01472 L .34665 .01472 L s P P p p 1 0 0 r .42736 .01472 m .42736 .07455 L .49193 .07455 L .49193 .01472 L F P p .004 w .42736 .01472 m .42736 .07455 L .49193 .07455 L .49193 .01472 L .42736 .01472 L s P P p p 1 0 0 r .50807 .01472 m .50807 .04524 L .57264 .04524 L .57264 .01472 L F P p .004 w .50807 .01472 m .50807 .04524 L .57264 .04524 L .57264 .01472 L .50807 .01472 L s P P p p 1 0 0 r .58878 .01472 m .58878 .0428 L .65335 .0428 L .65335 .01472 L F P p .004 w .58878 .01472 m .58878 .0428 L .65335 .0428 L .65335 .01472 L .58878 .01472 L s P P p p 1 0 0 r .66949 .01472 m .66949 .03303 L .73406 .03303 L .73406 .01472 L F P p .004 w .66949 .01472 m .66949 .03303 L .73406 .03303 L .73406 .01472 L .66949 .01472 L s P P p p 1 0 0 r .7502 .01472 m .7502 .04647 L .81477 .04647 L .81477 .01472 L F P p .004 w .7502 .01472 m .7502 .04647 L .81477 .04647 L .81477 .01472 L .7502 .01472 L s P P p p 1 0 0 r .83091 .01472 m .83091 .04647 L .89548 .04647 L .89548 .01472 L F P p .004 w .83091 .01472 m .83091 .04647 L .89548 .04647 L .89548 .01472 L .83091 .01472 L s P P p p 1 0 0 r .91162 .01472 m .91162 .02448 L .97619 .02448 L .97619 .01472 L F P p .004 w .91162 .01472 m .91162 .02448 L .97619 .02448 L .97619 .01472 L .91162 .01472 L s P P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath % End of Graphics MathPictureEnd :[font = section; inactive; preserveAspect; startGroup] 18.2 An Environmental Example: Migration :[font = input; preserveAspect] T[L_, P_, H_, K_] := (3.1688*10^-8*L*P)/(H*K) :[font = input; preserveAspect; startGroup] T[100, 0.38, 0.01, 3*10^-5] :[font = output; output; inactive; preserveAspect; endGroup] 4.013813333333333333 ;[o] 4.01381 :[font = subsection; inactive; preserveAspect; startGroup] 18.2.1 Mathematica Implementation :[font = input; preserveAspect] TruncateRandom[dist_, a_, b_] := Module[{q}, (Label[start]; q = Random[dist]; If[q < a || q > b, Goto[start], q])] :[font = input; preserveAspect] Randomizer := {L -> 100, P -> Random[UniformDistribution[0.35, 0.40]], H -> Random[LogUniformDistribution[0.003, 0.03]], K -> TruncateRandom[NormalDistribution[3 10^-5, 10^-5], 0.5 10^-5, 5.5 10^-5]} :[font = input; preserveAspect; startGroup] T[L, P, H, K] :[font = output; output; inactive; preserveAspect; endGroup] (3.1688*10^-8*L*P)/(H*K) ;[o] -8 3.1688 10 L P --------------- H K :[font = input; preserveAspect; startGroup] T[L, P, H, K] /. Randomizer :[font = output; output; inactive; preserveAspect; endGroup] 9.397891148473637904 ;[o] 9.39789 :[font = input; preserveAspect] Tdata = Table[T[L, P, H, K] /. Randomizer, {i, 1, 1000}]; :[font = input; preserveAspect; startGroup] LocationReport[Tdata] :[font = output; output; inactive; preserveAspect; endGroup] {Mean -> 5.938062183125716479, HarmonicMean -> 3.333123393996158354, Median -> 4.282367108210451561} ;[o] {Mean -> 5.93806, HarmonicMean -> 3.33312, Median -> 4.28237} :[font = input; preserveAspect; startGroup] DispersionReport[Tdata] :[font = output; output; inactive; preserveAspect; endGroup] {Variance -> 28.06268091960812415, StandardDeviation -> 5.297422101325145881, SampleRange -> 54.19387725168694444, MeanDeviation -> 3.669835040114213492, MedianDeviation -> 2.302953578002094029, QuartileDeviation -> 2.724825781537037381} ;[o] {Variance -> 28.0627, StandardDeviation -> 5.29742, SampleRange -> 54.1939, MeanDeviation -> 3.66984, MedianDeviation -> 2.30295, QuartileDeviation -> 2.72483} :[font = input; preserveAspect; startGroup] Quartiles[Tdata] :[font = output; output; inactive; preserveAspect; endGroup] {2.400906691428517173, 4.282367108210451561, 7.850558254502591935} ;[o] {2.40091, 4.28237, 7.85056} :[font = input; preserveAspect; startGroup] {Min[Tdata], Max[Tdata]} :[font = output; output; inactive; preserveAspect; endGroup] {0.8486435299151746625, 55.0425207816021191} ;[o] {0.848644, 55.0425} :[font = input; preserveAspect; startGroup] BinCounts[Log[10, Tdata], {-0.5, 2, 0.125}] :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 9, 40, 83, 115, 116, 132, 111, 120, 113, 87, 48, 13, 8, 2, 3, 0, 0} ;[o] {0, 0, 0, 9, 40, 83, 115, 116, 132, 111, 120, 113, 87, 48, 13, 8, 2, 3, 0, 0} :[font = input; preserveAspect; startGroup] BarChart[%]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations -0.019802 0.049505 0.0147151 0.00445912 [ [(1)] .0297 .01472 0 2 Msboxa [(2)] .07921 .01472 0 2 Msboxa [(3)] .12871 .01472 0 2 Msboxa [(4)] .17822 .01472 0 2 Msboxa [(5)] .22772 .01472 0 2 Msboxa [(6)] .27723 .01472 0 2 Msboxa [(7)] .32673 .01472 0 2 Msboxa [(8)] .37624 .01472 0 2 Msboxa [(9)] .42574 .01472 0 2 Msboxa [(10)] .47525 .01472 0 2 Msboxa [(11)] .52475 .01472 0 2 Msboxa [(12)] .57426 .01472 0 2 Msboxa [(13)] .62376 .01472 0 2 Msboxa [(14)] .67327 .01472 0 2 Msboxa [(15)] .72277 .01472 0 2 Msboxa [(16)] .77228 .01472 0 2 Msboxa [(17)] .82178 .01472 0 2 Msboxa [(18)] .87129 .01472 0 2 Msboxa [(19)] .92079 .01472 0 2 Msboxa [(20)] .9703 .01472 0 2 Msboxa [(0)] -0.0125 .01472 1 0 Msboxa [(20)] -0.0125 .1039 1 0 Msboxa [(40)] -0.0125 .19308 1 0 Msboxa [(60)] -0.0125 .28226 1 0 Msboxa [(80)] -0.0125 .37144 1 0 Msboxa [(100)] -0.0125 .46063 1 0 Msboxa [(120)] -0.0125 .54981 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .0297 .01472 m .0297 .02097 L s P [(1)] .0297 .01472 0 2 Mshowa p .002 w .07921 .01472 m .07921 .02097 L s P [(2)] .07921 .01472 0 2 Mshowa p .002 w .12871 .01472 m .12871 .02097 L s P [(3)] .12871 .01472 0 2 Mshowa p .002 w .17822 .01472 m .17822 .02097 L s P [(4)] .17822 .01472 0 2 Mshowa p .002 w .22772 .01472 m .22772 .02097 L s P [(5)] .22772 .01472 0 2 Mshowa p .002 w .27723 .01472 m .27723 .02097 L s P [(6)] .27723 .01472 0 2 Mshowa p .002 w .32673 .01472 m .32673 .02097 L s P [(7)] .32673 .01472 0 2 Mshowa p .002 w .37624 .01472 m .37624 .02097 L s P [(8)] .37624 .01472 0 2 Mshowa p .002 w .42574 .01472 m .42574 .02097 L s P [(9)] .42574 .01472 0 2 Mshowa p .002 w .47525 .01472 m .47525 .02097 L s P [(10)] .47525 .01472 0 2 Mshowa p .002 w .52475 .01472 m .52475 .02097 L s P [(11)] .52475 .01472 0 2 Mshowa p .002 w .57426 .01472 m .57426 .02097 L s P [(12)] .57426 .01472 0 2 Mshowa p .002 w .62376 .01472 m .62376 .02097 L s P [(13)] .62376 .01472 0 2 Mshowa p .002 w .67327 .01472 m .67327 .02097 L s P [(14)] .67327 .01472 0 2 Mshowa p .002 w .72277 .01472 m .72277 .02097 L s P [(15)] .72277 .01472 0 2 Mshowa p .002 w .77228 .01472 m .77228 .02097 L s P [(16)] .77228 .01472 0 2 Mshowa p .002 w .82178 .01472 m .82178 .02097 L s P [(17)] .82178 .01472 0 2 Mshowa p .002 w .87129 .01472 m .87129 .02097 L s P [(18)] .87129 .01472 0 2 Mshowa p .002 w .92079 .01472 m .92079 .02097 L s P [(19)] .92079 .01472 0 2 Mshowa p .002 w .9703 .01472 m .9703 .02097 L s P [(20)] .9703 .01472 0 2 Mshowa p .002 w 0 .01472 m 1 .01472 L s P p .002 w 0 .01472 m .00625 .01472 L s P [(0)] -0.0125 .01472 1 0 Mshowa p .002 w 0 .1039 m .00625 .1039 L s P [(20)] -0.0125 .1039 1 0 Mshowa p .002 w 0 .19308 m .00625 .19308 L s P [(40)] -0.0125 .19308 1 0 Mshowa p .002 w 0 .28226 m .00625 .28226 L s P [(60)] -0.0125 .28226 1 0 Mshowa p .002 w 0 .37144 m .00625 .37144 L s P [(80)] -0.0125 .37144 1 0 Mshowa p .002 w 0 .46063 m .00625 .46063 L s P [(100)] -0.0125 .46063 1 0 Mshowa p .002 w 0 .54981 m .00625 .54981 L s P [(120)] -0.0125 .54981 1 0 Mshowa p .001 w 0 .03255 m .00375 .03255 L s P p .001 w 0 .05039 m .00375 .05039 L s P p .001 w 0 .06822 m .00375 .06822 L s P p .001 w 0 .08606 m .00375 .08606 L s P p .001 w 0 .12173 m .00375 .12173 L s P p .001 w 0 .13957 m .00375 .13957 L s P p .001 w 0 .15741 m .00375 .15741 L s P p .001 w 0 .17524 m .00375 .17524 L s P p .001 w 0 .21092 m .00375 .21092 L s P p .001 w 0 .22875 m .00375 .22875 L s P p .001 w 0 .24659 m .00375 .24659 L s P p .001 w 0 .26443 m .00375 .26443 L s P p .001 w 0 .3001 m .00375 .3001 L s P p .001 w 0 .31794 m .00375 .31794 L s P p .001 w 0 .33577 m .00375 .33577 L s P p .001 w 0 .35361 m .00375 .35361 L s P p .001 w 0 .38928 m .00375 .38928 L s P p .001 w 0 .40712 m .00375 .40712 L s P p .001 w 0 .42495 m .00375 .42495 L s P p .001 w 0 .44279 m .00375 .44279 L s P p .001 w 0 .47846 m .00375 .47846 L s P p .001 w 0 .4963 m .00375 .4963 L s P p .001 w 0 .51414 m .00375 .51414 L s P p .001 w 0 .53197 m .00375 .53197 L s P p .001 w 0 .56765 m .00375 .56765 L s P p .001 w 0 .58548 m .00375 .58548 L s P p .001 w 0 .60332 m .00375 .60332 L s P p .002 w 0 0 m 0 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p 1 0 0 r .0099 .01472 m .0099 .01472 L .0495 .01472 L .0495 .01472 L F P p .004 w .0099 .01472 m .0099 .01472 L .0495 .01472 L .0495 .01472 L .0099 .01472 L s P P p p 1 0 0 r .05941 .01472 m .05941 .01472 L .09901 .01472 L .09901 .01472 L F P p .004 w .05941 .01472 m .05941 .01472 L .09901 .01472 L .09901 .01472 L .05941 .01472 L s P P p p 1 0 0 r .10891 .01472 m .10891 .01472 L .14851 .01472 L .14851 .01472 L F P p .004 w .10891 .01472 m .10891 .01472 L .14851 .01472 L .14851 .01472 L .10891 .01472 L s P P p p 1 0 0 r .15842 .01472 m .15842 .05485 L .19802 .05485 L .19802 .01472 L F P p .004 w .15842 .01472 m .15842 .05485 L .19802 .05485 L .19802 .01472 L .15842 .01472 L s P P p p 1 0 0 r .20792 .01472 m .20792 .19308 L .24752 .19308 L .24752 .01472 L F P p .004 w .20792 .01472 m .20792 .19308 L .24752 .19308 L .24752 .01472 L .20792 .01472 L s P P p p 1 0 0 r .25743 .01472 m .25743 .38482 L .29703 .38482 L .29703 .01472 L F P p .004 w .25743 .01472 m .25743 .38482 L .29703 .38482 L .29703 .01472 L .25743 .01472 L s P P p p 1 0 0 r .30693 .01472 m .30693 .52751 L .34653 .52751 L .34653 .01472 L F P p .004 w .30693 .01472 m .30693 .52751 L .34653 .52751 L .34653 .01472 L .30693 .01472 L s P P p p 1 0 0 r .35644 .01472 m .35644 .53197 L .39604 .53197 L .39604 .01472 L F P p .004 w .35644 .01472 m .35644 .53197 L .39604 .53197 L .39604 .01472 L .35644 .01472 L s P P p p 1 0 0 r .40594 .01472 m .40594 .60332 L .44554 .60332 L .44554 .01472 L F P p .004 w .40594 .01472 m .40594 .60332 L .44554 .60332 L .44554 .01472 L .40594 .01472 L s P P p p 1 0 0 r .45545 .01472 m .45545 .50968 L .49505 .50968 L .49505 .01472 L F P p .004 w .45545 .01472 m .45545 .50968 L .49505 .50968 L .49505 .01472 L .45545 .01472 L s P P p p 1 0 0 r .50495 .01472 m .50495 .54981 L .54455 .54981 L .54455 .01472 L F P p .004 w .50495 .01472 m .50495 .54981 L .54455 .54981 L .54455 .01472 L .50495 .01472 L s P P p p 1 0 0 r .55446 .01472 m .55446 .5186 L .59406 .5186 L .59406 .01472 L F P p .004 w .55446 .01472 m .55446 .5186 L .59406 .5186 L .59406 .01472 L .55446 .01472 L s P P p p 1 0 0 r .60396 .01472 m .60396 .40266 L .64356 .40266 L .64356 .01472 L F P p .004 w .60396 .01472 m .60396 .40266 L .64356 .40266 L .64356 .01472 L .60396 .01472 L s P P p p 1 0 0 r .65347 .01472 m .65347 .22875 L .69307 .22875 L .69307 .01472 L F P p .004 w .65347 .01472 m .65347 .22875 L .69307 .22875 L .69307 .01472 L .65347 .01472 L s P P p p 1 0 0 r .70297 .01472 m .70297 .07268 L .74257 .07268 L .74257 .01472 L F P p .004 w .70297 .01472 m .70297 .07268 L .74257 .07268 L .74257 .01472 L .70297 .01472 L s P P p p 1 0 0 r .75248 .01472 m .75248 .05039 L .79208 .05039 L .79208 .01472 L F P p .004 w .75248 .01472 m .75248 .05039 L .79208 .05039 L .79208 .01472 L .75248 .01472 L s P P p p 1 0 0 r .80198 .01472 m .80198 .02363 L .84158 .02363 L .84158 .01472 L F P p .004 w .80198 .01472 m .80198 .02363 L .84158 .02363 L .84158 .01472 L .80198 .01472 L s P P p p 1 0 0 r .85149 .01472 m .85149 .02809 L .89109 .02809 L .89109 .01472 L F P p .004 w .85149 .01472 m .85149 .02809 L .89109 .02809 L .89109 .01472 L .85149 .01472 L s P P p p 1 0 0 r .90099 .01472 m .90099 .01472 L .94059 .01472 L .94059 .01472 L F P p .004 w .90099 .01472 m .90099 .01472 L .94059 .01472 L .94059 .01472 L .90099 .01472 L s P P p p 1 0 0 r .9505 .01472 m .9505 .01472 L .9901 .01472 L .9901 .01472 L F P p .004 w .9505 .01472 m .9505 .01472 L .9901 .01472 L .9901 .01472 L .9505 .01472 L s P P P % End of Graphics MathPictureEnd :[font = section; inactive; preserveAspect; startGroup] 18.3 A Financial Example: Aggregation :[font = input; preserveAspect] Emms[Eoss_, Ecss_, noss_, ncss_] := (Eoss*noss + Ecss*ncss)/(noss + ncss) :[font = input; preserveAspect; startGroup] Emms[26.3, 21.1, 1, 0.5] :[font = output; output; inactive; preserveAspect; endGroup] 24.56666666666666666 ;[o] 24.5667 :[font = subsection; inactive; preserveAspect; startGroup] 18.3.1 Mathematica Implementation of Probabilistic Aggregation :[font = input; preserveAspect] Randomizer := {noss -> 1, Eoss -> Random[UniformDistribution[24, 30]], Ecss -> Random[LogUniformDistribution[5, 50]], ncss -> 0.5} :[font = input; preserveAspect; startGroup] Emms[Eoss, Ecss, noss, ncss] :[font = output; output; inactive; preserveAspect; endGroup] (Ecss*ncss + Eoss*noss)/(ncss + noss) ;[o] Ecss ncss + Eoss noss --------------------- ncss + noss :[font = input; preserveAspect; startGroup] Emms[Eoss, Ecss, noss, ncss] /. Randomizer :[font = output; output; inactive; preserveAspect; endGroup] 21.92367644678764767 ;[o] 21.9237 :[font = input; preserveAspect; startGroup] Edata = Table[Emms[Eoss, Ecss, noss, ncss] /. Randomizer, {i, 1, 1000}]; LocationReport[Edata] :[font = output; output; inactive; preserveAspect; endGroup] {Mean -> 24.65907911673668939, HarmonicMean -> 23.93291903047939432, Median -> 23.60661645335496746} ;[o] {Mean -> 24.6591, HarmonicMean -> 23.9329, Median -> 23.6066} :[font = input; preserveAspect; startGroup] bindata = BinCounts[Edata, {15, 40, 2.5}] :[font = output; output; inactive; preserveAspect; endGroup] {0, 125, 285, 179, 148, 113, 86, 56, 8, 0} ;[o] {0, 125, 285, 179, 148, 113, 86, 56, 8, 0} :[font = input; preserveAspect; startGroup] bins = Table[16.25 + 2.5 (n - 1), {n, 1, 10}] :[font = output; output; inactive; preserveAspect; endGroup] {16.25, 18.75, 21.25, 23.75, 26.25, 28.75, 31.25, 33.75, 36.25, 38.75} ;[o] {16.25, 18.75, 21.25, 23.75, 26.25, 28.75, 31.25, 33.75, 36.25, 38.75} :[font = input; preserveAspect; startGroup] BarChart[bindata, PlotRange -> All, BarValues -> True, BarLabels -> Map[ToString, bins], DefaultFont -> {"Courier", 6}]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 6 scalefont setfont % Scaling calculations -0.0344995 0.0971817 0.0147151 0.00206528 [ [(16.25)] .06268 .01472 0 2 Msboxa [(18.75)] .15986 .01472 0 2 Msboxa [(21.25)] .25705 .01472 0 2 Msboxa [(23.75)] .35423 .01472 0 2 Msboxa [(26.25)] .45141 .01472 0 2 Msboxa [(28.75)] .54859 .01472 0 2 Msboxa [(31.25)] .64577 .01472 0 2 Msboxa [(33.75)] .74295 .01472 0 2 Msboxa [(36.25)] .84014 .01472 0 2 Msboxa [(38.75)] .93732 .01472 0 2 Msboxa [(50)] -0.00813 .11798 1 0 Msboxa [(100)] -0.00813 .22124 1 0 Msboxa [(150)] -0.00813 .32451 1 0 Msboxa [(200)] -0.00813 .42777 1 0 Msboxa [(250)] -0.00813 .53103 1 0 Msboxa [(0)] .06268 .01472 0 0 Msboxa [(125)] .15986 .30378 0 0 Msboxa [(285)] .25705 .63422 0 0 Msboxa [(179)] .35423 .4153 0 0 Msboxa [(148)] .45141 .35128 0 0 Msboxa [(113)] .54859 .27899 0 0 Msboxa [(86)] .64577 .22323 0 0 Msboxa [(56)] .74295 .16127 0 0 Msboxa [(8)] .84014 .06214 0 0 Msboxa [(0)] .93732 .01472 0 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .06268 .01472 m .06268 .02097 L s P [(16.25)] .06268 .01472 0 2 Mshowa p .002 w .15986 .01472 m .15986 .02097 L s P [(18.75)] .15986 .01472 0 2 Mshowa p .002 w .25705 .01472 m .25705 .02097 L s P [(21.25)] .25705 .01472 0 2 Mshowa p .002 w .35423 .01472 m .35423 .02097 L s P [(23.75)] .35423 .01472 0 2 Mshowa p .002 w .45141 .01472 m .45141 .02097 L s P [(26.25)] .45141 .01472 0 2 Mshowa p .002 w .54859 .01472 m .54859 .02097 L s P [(28.75)] .54859 .01472 0 2 Mshowa p .002 w .64577 .01472 m .64577 .02097 L s P [(31.25)] .64577 .01472 0 2 Mshowa p .002 w .74295 .01472 m .74295 .02097 L s P [(33.75)] .74295 .01472 0 2 Mshowa p .002 w .84014 .01472 m .84014 .02097 L s P [(36.25)] .84014 .01472 0 2 Mshowa p .002 w .93732 .01472 m .93732 .02097 L s P [(38.75)] .93732 .01472 0 2 Mshowa p .002 w 0 .01472 m 1 .01472 L s P p .002 w .00437 .11798 m .01062 .11798 L s P [(50)] -0.00813 .11798 1 0 Mshowa p .002 w .00437 .22124 m .01062 .22124 L s P [(100)] -0.00813 .22124 1 0 Mshowa p .002 w .00437 .32451 m .01062 .32451 L s P [(150)] -0.00813 .32451 1 0 Mshowa p .002 w .00437 .42777 m .01062 .42777 L s P [(200)] -0.00813 .42777 1 0 Mshowa p .002 w .00437 .53103 m .01062 .53103 L s P [(250)] -0.00813 .53103 1 0 Mshowa p .001 w .00437 .03537 m .00812 .03537 L s P p .001 w .00437 .05602 m .00812 .05602 L s P p .001 w .00437 .07667 m .00812 .07667 L s P p .001 w .00437 .09733 m .00812 .09733 L s P p .001 w .00437 .13863 m .00812 .13863 L s P p .001 w .00437 .15928 m .00812 .15928 L s P p .001 w .00437 .17994 m .00812 .17994 L s P p .001 w .00437 .20059 m .00812 .20059 L s P p .001 w .00437 .2419 m .00812 .2419 L s P p .001 w .00437 .26255 m .00812 .26255 L s P p .001 w .00437 .2832 m .00812 .2832 L s P p .001 w .00437 .30385 m .00812 .30385 L s P p .001 w .00437 .34516 m .00812 .34516 L s P p .001 w .00437 .36581 m .00812 .36581 L s P p .001 w .00437 .38646 m .00812 .38646 L s P p .001 w .00437 .40712 m .00812 .40712 L s P p .001 w .00437 .44842 m .00812 .44842 L s P p .001 w .00437 .46908 m .00812 .46908 L s P p .001 w .00437 .48973 m .00812 .48973 L s P p .001 w .00437 .51038 m .00812 .51038 L s P p .001 w .00437 .55169 m .00812 .55169 L s P p .001 w .00437 .57234 m .00812 .57234 L s P p .001 w .00437 .59299 m .00812 .59299 L s P p .001 w .00437 .61365 m .00812 .61365 L s P p .002 w .00437 0 m .00437 .61803 L s P P p p p p 1 0 0 r .02381 .01472 m .02381 .01472 L .10155 .01472 L .10155 .01472 L F P p .004 w .02381 .01472 m .02381 .01472 L .10155 .01472 L .10155 .01472 L .02381 .01472 L s P P p p 1 0 0 r .12099 .01472 m .12099 .27287 L .19874 .27287 L .19874 .01472 L F P p .004 w .12099 .01472 m .12099 .27287 L .19874 .27287 L .19874 .01472 L .12099 .01472 L s P P p p 1 0 0 r .21817 .01472 m .21817 .60332 L .29592 .60332 L .29592 .01472 L F P p .004 w .21817 .01472 m .21817 .60332 L .29592 .60332 L .29592 .01472 L .21817 .01472 L s P P p p 1 0 0 r .31535 .01472 m .31535 .3844 L .3931 .3844 L .3931 .01472 L F P p .004 w .31535 .01472 m .31535 .3844 L .3931 .3844 L .3931 .01472 L .31535 .01472 L s P P p p 1 0 0 r .41254 .01472 m .41254 .32038 L .49028 .32038 L .49028 .01472 L F P p .004 w .41254 .01472 m .41254 .32038 L .49028 .32038 L .49028 .01472 L .41254 .01472 L s P P p p 1 0 0 r .50972 .01472 m .50972 .24809 L .58746 .24809 L .58746 .01472 L F P p .004 w .50972 .01472 m .50972 .24809 L .58746 .24809 L .58746 .01472 L .50972 .01472 L s P P p p 1 0 0 r .6069 .01472 m .6069 .19233 L .68465 .19233 L .68465 .01472 L F P p .004 w .6069 .01472 m .6069 .19233 L .68465 .19233 L .68465 .01472 L .6069 .01472 L s P P p p 1 0 0 r .70408 .01472 m .70408 .13037 L .78183 .13037 L .78183 .01472 L F P p .004 w .70408 .01472 m .70408 .13037 L .78183 .13037 L .78183 .01472 L .70408 .01472 L s P P p p 1 0 0 r .80126 .01472 m .80126 .03124 L .87901 .03124 L .87901 .01472 L F P p .004 w .80126 .01472 m .80126 .03124 L .87901 .03124 L .87901 .01472 L .80126 .01472 L s P P p p 1 0 0 r .89845 .01472 m .89845 .01472 L .97619 .01472 L .97619 .01472 L F P p .004 w .89845 .01472 m .89845 .01472 L .97619 .01472 L .97619 .01472 L .89845 .01472 L s P P P p [(0)] .06268 .01472 0 0 Mshowa [(125)] .15986 .30378 0 0 Mshowa [(285)] .25705 .63422 0 0 Mshowa [(179)] .35423 .4153 0 0 Mshowa [(148)] .45141 .35128 0 0 Mshowa [(113)] .54859 .27899 0 0 Mshowa [(86)] .64577 .22323 0 0 Mshowa [(56)] .74295 .16127 0 0 Mshowa [(8)] .84014 .06214 0 0 Mshowa [(0)] .93732 .01472 0 0 Mshowa P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath % End of Graphics MathPictureEnd :[font = section; inactive; preserveAspect; startGroup] 18.4 A More Structured Approach to PSA :[font = input; preserveAspect] CleanSlate[]; Needs["Prosysas`"] :[font = input; preserveAspect; startGroup] $ContextPath :[font = output; output; inactive; preserveAspect; endGroup] {"Prosysas`", "Graphics`Graphics`", "Utilities`FilterOptions`", "Statistics`NormalDistribution`", "Statistics`NonlinearFit`", "Statistics`MovingAverage`", "Statistics`LinearRegression`", "Statistics`InverseStatisticalFunctions`", "Statistics`HypothesisTests`", "Statistics`DiscreteDistributions`", "Statistics`DescriptiveStatistics`", "Statistics`DataManipulation`", "Statistics`ContinuousDistributions`", "Statistics`ConfidenceIntervals`", "Statistics`Common`HypothesisCommon`", "Statistics`Common`DistributionsCommon`", "CleanSlate`", "Global`", "System`"} ;[o] {Prosysas`, Graphics`Graphics`, Utilities`FilterOptions`, Statistics`NormalDistribution`, Statistics`NonlinearFit`, Statistics`MovingAverage`, Statistics`LinearRegression`, Statistics`InverseStatisticalFunctions`, Statistics`HypothesisTests`, Statistics`DiscreteDistributions`, Statistics`DescriptiveStatistics`, Statistics`DataManipulation`, Statistics`ContinuousDistributions`, Statistics`ConfidenceIntervals`, Statistics`Common`HypothesisCommon`, Statistics`Common`DistributionsCommon`, CleanSlate`, Global`, System`} :[font = input; preserveAspect; startGroup] ?Prosysas`* :[font = info; inactive; preserveAspect; endGroup] LogUniformDistribution Prosysas TruncateRandom MakeRandom :[font = input; preserveAspect; startGroup] T[L_, P_, H_, K_] := (3.1688*10^-8*L*P)/(H*K) ranset := MakeRandom[T[L, P, H, K], {{L, 100}, {P, Random[UniformDistribution[0.35, 0.40]]}, {H, Random[LogUniformDistribution[0.003, 0.03]]}, {K, TruncateRandom[NormalDistribution[3 10^-5, 10^-5], 0.5 10^-5, 5.5 10^-5]}}] ranset :[font = output; output; inactive; preserveAspect; endGroup] 1.696527811642706201 ;[o] 1.69653 :[font = input; preserveAspect; endGroup] Tdata = Table[ranset, {i, 1, 1000}]; :[font = section; inactive; preserveAspect; startGroup] 18.5 Expectations and Volume Integration :[font = input; preserveAspect] prod[x_, y_, z_] := x y z :[font = input; preserveAspect] Randomizera := {x -> Random[UniformDistribution[0.0, 1.0]], y -> Random[UniformDistribution[0.0, 1.0]], z -> Random[UniformDistribution[0.0, 1.0]] } :[font = input; preserveAspect; startGroup] prod[x, y, z] /. Randomizera :[font = output; output; inactive; preserveAspect; endGroup] 0.1811284749540624736 ;[o] 0.181128 :[font = input; preserveAspect; startGroup] average[n_] := Mean[ Table[prod[x, y, z] /. Randomizera, {i, 1, n}]]; nvalues = { 50, 50, 50, 250, 250, 250, 500, 500, 500, 750, 750, 750}; averages = Table[average[nvalues[[b]]], {b, 1, 12}]; PsaIntegralData = ListPlot[Transpose[{nvalues, averages}], PlotStyle -> {PointSize[0.01]}, PlotRange -> {0.09, 0.14}, AxesOrigin -> {0, 0.125}]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.00126984 -1.11246 12.3607 [ [(100)] .15079 .43262 0 2 Msboxa [(200)] .27778 .43262 0 2 Msboxa [(300)] .40476 .43262 0 2 Msboxa [(400)] .53175 .43262 0 2 Msboxa [(500)] .65873 .43262 0 2 Msboxa [(600)] .78571 .43262 0 2 Msboxa [(700)] .9127 .43262 0 2 Msboxa [(0.1)] .01131 .12361 1 0 Msboxa [(0.11)] .01131 .24721 1 0 Msboxa [(0.12)] .01131 .37082 1 0 Msboxa [(0.13)] .01131 .49443 1 0 Msboxa [(0.14)] .01131 .61803 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .15079 .43262 m .15079 .43887 L s P [(100)] .15079 .43262 0 2 Mshowa p .002 w .27778 .43262 m .27778 .43887 L s P [(200)] .27778 .43262 0 2 Mshowa p .002 w .40476 .43262 m .40476 .43887 L s P [(300)] .40476 .43262 0 2 Mshowa p .002 w .53175 .43262 m .53175 .43887 L s P [(400)] .53175 .43262 0 2 Mshowa p .002 w .65873 .43262 m .65873 .43887 L s P [(500)] .65873 .43262 0 2 Mshowa p .002 w .78571 .43262 m .78571 .43887 L s P [(600)] .78571 .43262 0 2 Mshowa p .002 w .9127 .43262 m .9127 .43887 L s P [(700)] .9127 .43262 0 2 Mshowa p .001 w .04921 .43262 m .04921 .43637 L s P p .001 w .0746 .43262 m .0746 .43637 L s P p .001 w .1 .43262 m .1 .43637 L s P p .001 w .1254 .43262 m .1254 .43637 L s P p .001 w .17619 .43262 m .17619 .43637 L s P p .001 w .20159 .43262 m .20159 .43637 L s P p .001 w .22698 .43262 m .22698 .43637 L s P p .001 w .25238 .43262 m .25238 .43637 L s P p .001 w .30317 .43262 m .30317 .43637 L s P p .001 w .32857 .43262 m .32857 .43637 L s P p .001 w .35397 .43262 m .35397 .43637 L s P p .001 w .37937 .43262 m .37937 .43637 L s P p .001 w .43016 .43262 m .43016 .43637 L s P p .001 w .45556 .43262 m .45556 .43637 L s P p .001 w .48095 .43262 m .48095 .43637 L s P p .001 w .50635 .43262 m .50635 .43637 L s P p .001 w .55714 .43262 m .55714 .43637 L s P p .001 w .58254 .43262 m .58254 .43637 L s P p .001 w .60794 .43262 m .60794 .43637 L s P p .001 w .63333 .43262 m .63333 .43637 L s P p .001 w .68413 .43262 m .68413 .43637 L s P p .001 w .70952 .43262 m .70952 .43637 L s P p .001 w .73492 .43262 m .73492 .43637 L s P p .001 w .76032 .43262 m .76032 .43637 L s P p .001 w .81111 .43262 m .81111 .43637 L s P p .001 w .83651 .43262 m .83651 .43637 L s P p .001 w .8619 .43262 m .8619 .43637 L s P p .001 w .8873 .43262 m .8873 .43637 L s P p .001 w .9381 .43262 m .9381 .43637 L s P p .001 w .96349 .43262 m .96349 .43637 L s P p .001 w .98889 .43262 m .98889 .43637 L s P p .002 w 0 .43262 m 1 .43262 L s P p .002 w .02381 .12361 m .03006 .12361 L s P [(0.1)] .01131 .12361 1 0 Mshowa p .002 w .02381 .24721 m .03006 .24721 L s P [(0.11)] .01131 .24721 1 0 Mshowa p .002 w .02381 .37082 m .03006 .37082 L s P [(0.12)] .01131 .37082 1 0 Mshowa p .002 w .02381 .49443 m .03006 .49443 L s P [(0.13)] .01131 .49443 1 0 Mshowa p .002 w .02381 .61803 m .03006 .61803 L s P [(0.14)] .01131 .61803 1 0 Mshowa p .001 w .02381 .02472 m .02756 .02472 L s P p .001 w .02381 .04944 m .02756 .04944 L s P p .001 w .02381 .07416 m .02756 .07416 L s P p .001 w .02381 .09889 m .02756 .09889 L s P p .001 w .02381 .14833 m .02756 .14833 L s P p .001 w .02381 .17305 m .02756 .17305 L s P p .001 w .02381 .19777 m .02756 .19777 L s P p .001 w .02381 .22249 m .02756 .22249 L s P p .001 w .02381 .27193 m .02756 .27193 L s P p .001 w .02381 .29666 m .02756 .29666 L s P p .001 w .02381 .32138 m .02756 .32138 L s P p .001 w .02381 .3461 m .02756 .3461 L s P p .001 w .02381 .39554 m .02756 .39554 L s P p .001 w .02381 .42026 m .02756 .42026 L s P p .001 w .02381 .44498 m .02756 .44498 L s P p .001 w .02381 .46971 m .02756 .46971 L s P p .001 w .02381 .51915 m .02756 .51915 L s P p .001 w .02381 .54387 m .02756 .54387 L s P p .001 w .02381 .56859 m .02756 .56859 L s P p .001 w .02381 .59331 m .02756 .59331 L s P p .002 w .02381 0 m .02381 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p .01 w .0873 .10503 Mdot .0873 .22901 Mdot .0873 .51218 Mdot .34127 .37969 Mdot .34127 .36275 Mdot .34127 .49228 Mdot .65873 .52892 Mdot .65873 .53495 Mdot .65873 .54806 Mdot .97619 .41822 Mdot .97619 .35086 Mdot .97619 .24827 Mdot P P % End of Graphics MathPictureEnd :[font = section; inactive; preserveAspect; startGroup] 18.6 Wozniakowski's Method and Hammersley Points :[font = input; preserveAspect] a[k_Integer, j_Integer] := IntegerDigits[k, Prime[j]]; :[font = input; preserveAspect; startGroup] a[38, 2] :[font = output; output; inactive; preserveAspect; endGroup] {1, 1, 0, 2} ;[o] {1, 1, 0, 2} :[font = input; preserveAspect; startGroup] phi[k_, j_] := Module[{b, len, pj}, pj = Prime[j]; b = IntegerDigits[k, pj]; len = Length[b]; Sum[b[[len - i]]/(pj^(i+1)), {i, 0, len-1}] ] phi[38, 2] :[font = output; output; inactive; preserveAspect; endGroup] 58/81 ;[o] 58 -- 81 :[font = input; preserveAspect; startGroup] 1/3^4 + 1/3^3 + 0/3^2 + 2/3 :[font = output; output; inactive; preserveAspect; endGroup] 58/81 ;[o] 58 -- 81 :[font = input; preserveAspect] Anzero[e_, d_] = Floor[(1/e)*(Log[1/e])^((d - 1)/2)]; Bnzero[e_, d_] = Floor[(1/e)*(Log[1/e])^(d - 1)]; Cnzero[e_, d_] = Floor[(1/e)*(Log[1/e])^d]; :[font = input; preserveAspect; startGroup] M[d_, n_] := (Product[Prime[i], {i, 1, d-1}])^Ceiling[N[Log[n]]] M[3, n] :[font = output; output; inactive; preserveAspect; endGroup] 6^Ceiling[Log[n]] ;[o] Ceiling[Log[n]] 6 :[font = input; preserveAspect] X[d_, n_] := Table[ Which[m < 2, 1 - k/n, m > 1, 1 - phi[k, m-1]], {k, 1, n}, {m, 1, d}] :[font = input; preserveAspect; startGroup] n = Bnzero[0.1, 3] :[font = output; output; inactive; preserveAspect; endGroup] 53 ;[o] 53 :[font = input; preserveAspect; startGroup] Short[S = X[3, 53],4] :[font = output; output; inactive; preserveAspect; endGroup] Short[{{52/53, 1/2, 2/3}, {51/53, 3/4, 1/3}, {50/53, 1/4, 8/9}, {49/53, 7/8, 5/9}, {48/53, 3/8, 2/9}, {47/53, 5/8, 7/9}, {46/53, 1/8, 4/9}, {45/53, 15/16, 1/9}, {44/53, 7/16, 26/27}, {43/53, 11/16, 17/27}, {42/53, 3/16, 8/27}, {41/53, 13/16, 23/27}, {40/53, 5/16, 14/27}, {39/53, 9/16, 5/27}, {38/53, 1/16, 20/27}, {37/53, 31/32, 11/27}, {36/53, 15/32, 2/27}, {35/53, 23/32, 25/27}, {34/53, 7/32, 16/27}, {33/53, 27/32, 7/27}, {32/53, 11/32, 22/27}, {31/53, 19/32, 13/27}, {30/53, 3/32, 4/27}, {29/53, 29/32, 19/27}, {28/53, 13/32, 10/27}, {27/53, 21/32, 1/27}, {26/53, 5/32, 80/81}, {25/53, 25/32, 53/81}, {24/53, 9/32, 26/81}, {23/53, 17/32, 71/81}, {22/53, 1/32, 44/81}, {21/53, 63/64, 17/81}, {20/53, 31/64, 62/81}, {19/53, 47/64, 35/81}, {18/53, 15/64, 8/81}, {17/53, 55/64, 77/81}, {16/53, 23/64, 50/81}, {15/53, 39/64, 23/81}, {14/53, 7/64, 68/81}, {13/53, 59/64, 41/81}, {12/53, 27/64, 14/81}, {11/53, 43/64, 59/81}, {10/53, 11/64, 32/81}, {9/53, 51/64, 5/81}, {8/53, 19/64, 74/81}, {7/53, 35/64, 47/81}, {6/53, 3/64, 20/81}, {5/53, 61/64, 65/81}, {4/53, 29/64, 38/81}, {3/53, 45/64, 11/81}, {2/53, 13/64, 56/81}, {1/53, 53/64, 29/81}, {0, 21/64, 2/81}}, 4] ;[o] 52 1 2 51 3 1 50 1 8 49 7 5 {{--, -, -}, {--, -, -}, {--, -, -}, {--, -, -}, 53 2 3 53 4 3 53 4 9 53 8 9 48 3 2 47 5 7 46 1 4 45 15 1 {--, -, -}, {--, -, -}, {--, -, -}, {--, --, -}, 53 8 9 53 8 9 53 8 9 53 16 9 44 7 26 3 45 11 2 13 56 {--, --, --}, <<40>>, {--, --, --}, {--, --, --}, 53 16 27 53 64 81 53 64 81 1 53 29 21 2 {--, --, --}, {0, --, --}} 53 64 81 64 81 :[font = input; preserveAspect; endGroup] Show[Graphics3D[Map[Point, S]]]; :[font = section; inactive; preserveAspect; startGroup] 18.7 Efficient Integration :[font = input; preserveAspect] g[r_List] := r[[1]]*r[[2]]*r[[3]] :[font = input; preserveAspect; startGroup] WozIntegral = N[Apply[Plus, Map[g, S]]/n] :[font = output; output; inactive; preserveAspect; endGroup] 0.129815251572327044 ;[o] 0.129815 :[font = input; preserveAspect] WozInt[f_, e_, d_] := Module[{n, S}, n = Bnzero[e, d]; S = X[d, n]; {n, N[Apply[Plus, Map[f, S]]/n]}]; :[font = input; preserveAspect; startGroup] WozInt[g, 0.06, 3] :[font = output; output; inactive; preserveAspect; endGroup] {131, 0.1279035208463875046} ;[o] {131, 0.127904} :[font = input; preserveAspect; startGroup] wozdata = Table[WozInt[g, u, 3], {u, 0.02, 0.2, 0.02}] :[font = output; output; inactive; preserveAspect; endGroup] {{765, 0.1258754874848712239}, {259, 0.1268406430136240304}, {131, 0.1279035208463875046}, {79, 0.1286793723702872878}, {53, 0.129815251572327044}, {37, 0.1299279290551813074}, {27, 0.1311442615454961134}, {20, 0.1313773148148148148}, {16, 0.1315104166666666667}, {12, 0.128022119341563786}} ;[o] {{765, 0.125875}, {259, 0.126841}, {131, 0.127904}, {79, 0.128679}, {53, 0.129815}, {37, 0.129928}, {27, 0.131144}, {20, 0.131377}, {16, 0.13151}, {12, 0.128022}} :[font = text; inactive; preserveAspect] We can compare these values with the sampled estimates established earlier: :[font = input; preserveAspect; startGroup] ListPlot[wozdata, PlotJoined -> True, PlotRange -> {0.09, 0.15}, AxesOrigin -> {0, 0.125}, PlotStyle -> {Thickness[0.001]}, Evaluate[Epilog -> {PointSize[0.01], Map[Point, Transpose[{nvalues, averages}]]}] ]; :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174; endGroup; endGroup] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.00863214 0.00126478 -0.927051 10.3006 [ [(100)] .13511 .36052 0 2 Msboxa [(200)] .26159 .36052 0 2 Msboxa [(300)] .38807 .36052 0 2 Msboxa [(400)] .51454 .36052 0 2 Msboxa [(500)] .64102 .36052 0 2 Msboxa [(600)] .7675 .36052 0 2 Msboxa [(700)] .89398 .36052 0 2 Msboxa [(0.1)] -0.00387 .10301 1 0 Msboxa [(0.11)] -0.00387 .20601 1 0 Msboxa [(0.12)] -0.00387 .30902 1 0 Msboxa [(0.13)] -0.00387 .41202 1 0 Msboxa [(0.14)] -0.00387 .51503 1 0 Msboxa [(0.15)] -0.00387 .61803 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .13511 .36052 m .13511 .36677 L s P [(100)] .13511 .36052 0 2 Mshowa p .002 w .26159 .36052 m .26159 .36677 L s P [(200)] .26159 .36052 0 2 Mshowa p .002 w .38807 .36052 m .38807 .36677 L s P [(300)] .38807 .36052 0 2 Mshowa p .002 w .51454 .36052 m .51454 .36677 L s P [(400)] .51454 .36052 0 2 Mshowa p .002 w .64102 .36052 m .64102 .36677 L s P [(500)] .64102 .36052 0 2 Mshowa p .002 w .7675 .36052 m .7675 .36677 L s P [(600)] .7675 .36052 0 2 Mshowa p .002 w .89398 .36052 m .89398 .36677 L s P [(700)] .89398 .36052 0 2 Mshowa p .001 w .03393 .36052 m .03393 .36427 L s P p .001 w .05922 .36052 m .05922 .36427 L s P p .001 w .08452 .36052 m .08452 .36427 L s P p .001 w .10981 .36052 m .10981 .36427 L s P p .001 w .16041 .36052 m .16041 .36427 L s P p .001 w .1857 .36052 m .1857 .36427 L s P p .001 w .211 .36052 m .211 .36427 L s P p .001 w .23629 .36052 m .23629 .36427 L s P p .001 w .28688 .36052 m .28688 .36427 L s P p .001 w .31218 .36052 m .31218 .36427 L s P p .001 w .33748 .36052 m .33748 .36427 L s P p .001 w .36277 .36052 m .36277 .36427 L s P p .001 w .41336 .36052 m .41336 .36427 L s P p .001 w .43866 .36052 m .43866 .36427 L s P p .001 w .46395 .36052 m .46395 .36427 L s P p .001 w .48925 .36052 m .48925 .36427 L s P p .001 w .53984 .36052 m .53984 .36427 L s P p .001 w .56514 .36052 m .56514 .36427 L s P p .001 w .59043 .36052 m .59043 .36427 L s P p .001 w .61573 .36052 m .61573 .36427 L s P p .001 w .66632 .36052 m .66632 .36427 L s P p .001 w .69161 .36052 m .69161 .36427 L s P p .001 w .71691 .36052 m .71691 .36427 L s P p .001 w .74221 .36052 m .74221 .36427 L s P p .001 w .7928 .36052 m .7928 .36427 L s P p .001 w .81809 .36052 m .81809 .36427 L s P p .001 w .84339 .36052 m .84339 .36427 L s P p .001 w .86868 .36052 m .86868 .36427 L s P p .001 w .91928 .36052 m .91928 .36427 L s P p .001 w .94457 .36052 m .94457 .36427 L s P p .001 w .96987 .36052 m .96987 .36427 L s P p .001 w .99516 .36052 m .99516 .36427 L s P p .002 w 0 .36052 m 1 .36052 L s P p .002 w .00863 .10301 m .01488 .10301 L s P [(0.1)] -0.00387 .10301 1 0 Mshowa p .002 w .00863 .20601 m .01488 .20601 L s P [(0.11)] -0.00387 .20601 1 0 Mshowa p .002 w .00863 .30902 m .01488 .30902 L s P [(0.12)] -0.00387 .30902 1 0 Mshowa p .002 w .00863 .41202 m .01488 .41202 L s P [(0.13)] -0.00387 .41202 1 0 Mshowa p .002 w .00863 .51503 m .01488 .51503 L s P [(0.14)] -0.00387 .51503 1 0 Mshowa p .002 w .00863 .61803 m .01488 .61803 L s P [(0.15)] -0.00387 .61803 1 0 Mshowa p .001 w .00863 .0206 m .01238 .0206 L s P p .001 w .00863 .0412 m .01238 .0412 L s P p .001 w .00863 .0618 m .01238 .0618 L s P p .001 w .00863 .0824 m .01238 .0824 L s P p .001 w .00863 .12361 m .01238 .12361 L s P p .001 w .00863 .14421 m .01238 .14421 L s P p .001 w .00863 .16481 m .01238 .16481 L s P p .001 w .00863 .18541 m .01238 .18541 L s P p .001 w .00863 .22661 m .01238 .22661 L s P p .001 w .00863 .24721 m .01238 .24721 L s P p .001 w .00863 .26781 m .01238 .26781 L s P p .001 w .00863 .28842 m .01238 .28842 L s P p .001 w .00863 .32962 m .01238 .32962 L s P p .001 w .00863 .35022 m .01238 .35022 L s P p .001 w .00863 .37082 m .01238 .37082 L s P p .001 w .00863 .39142 m .01238 .39142 L s P p .001 w .00863 .43262 m .01238 .43262 L s P p .001 w .00863 .45322 m .01238 .45322 L s P p .001 w .00863 .47383 m .01238 .47383 L s P p .001 w .00863 .49443 m .01238 .49443 L s P p .001 w .00863 .53563 m .01238 .53563 L s P p .001 w .00863 .55623 m .01238 .55623 L s P p .001 w .00863 .57683 m .01238 .57683 L s P p .001 w .00863 .59743 m .01238 .59743 L s P p .002 w .00863 0 m .00863 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p .001 w .97619 .36954 m .33621 .37948 L .17432 .39043 L .10855 .39842 L .07567 .41012 L .05543 .41128 L .04278 .42381 L .03393 .42621 L .02887 .42758 L .02381 .39165 L s P p .01 w .07187 .08752 Mdot .07187 .19084 Mdot .07187 .42681 Mdot .32483 .31641 Mdot .32483 .30229 Mdot .32483 .41023 Mdot .64102 .44077 Mdot .64102 .44579 Mdot .64102 .45672 Mdot .95722 .34851 Mdot .95722 .29239 Mdot .95722 .20689 Mdot P % End of Graphics MathPictureEnd :[font = section; inactive; preserveAspect; startGroup] 18.9 Appendix: Prosysas Package :[font = input; preserveAspect; endGroup; endGroup] BeginPackage["Prosysas`","Statistics`Master`", "Graphics`Graphics`"] Prosysas::usage = "Prosysas.m is a prototype package for probabilistic system assessment." (* Usage Messages for exported objects *) LogUniformDistribution::usage = "LogUniformDistribution[min, max] represents the continuous loguniform distribution with endpoints min and max with min < max. Log[10, x] of the random variable x is uniformly distributed on [Log[10, min], Log[10, max]]" TruncateRandom::usage = "TruncateRandom[dist, a, b] produces a random sampling of dist truncated between a and b" MakeRandom::usage = "MakeRandom[fn, {{x1, dist1}, {x2, dist2} ...}] produces a random sampling f with each variable xi replaced by a random sampling from disti" Begin["`Private`"] (* Function Definitions *) LogUniformDistribution/: Domain[LogUniformDistribution[min_:1, max_:10]] := {min, max} LogUniformDistribution/: Random[LogUniformDistribution[min_:1, max_:10]] := 10.0^Random[Real, {N[Log[10, min]], N[Log[10, max]]}] LogUniformDistribution/: PDF[LogUniformDistribution[min_:1, max_:10], x_] := With[{result = 1/(x*Log[max/min])}, If[NumberQ[N[result]],N[result],result]] TruncateRandom[dist_, a_, b_] := Module[{q}, (Label[start]; q = Random[dist]; If[q < a || q > b, Goto[start], q])] MakeRandom[fn_, vbles_List] := fn /. Map[((#[[1]] -> #[[2]])&), vbles] End[] EndPackage[] ^*)