Re: Button Question

*To*: mathgroup at smc.vnet.net*Subject*: [mg84346] Re: Button Question*From*: Albert Retey <awnl at arcor.net>*Date*: Thu, 20 Dec 2007 00:00:36 -0500 (EST)*References*: <fkanep$de5$1@smc.vnet.net>

John wrote: > The cell, pasted below, is in my notebook. When the cell is evaluated, > It prints a button, labeled simulate, but clicking on the button does > not print the six simulated integers that RandomInteger computed. > > The error message says that the list of probabilities, entered as > shown below, is not a probability distribution recognized by the > system, but {1/6,1/6,1/6,1/6,1/6,1/6} is a valid multinomial > distribution. > > ButtonEvaluator, not mispelled, is printed in red. The color red must > be an indication of an error of some kind, but I have no idea what it > is. > > Cell[ButtonBox["Simulate", Active -> True, > ButtonFunction -> > Print[RandomInteger[ > MultinomialDistribution[ > 100, {"1", "/", "6", "1", "/", "6", "1", "/", "6", "1", "/", > "6", "1", "/", "6", "1", "/", "6"}], 1]], > ButtonEvaluator -> Automatic] // DisplayForm, "Output"], since you use RandomInteger I guess you are using version 6. Then there is no need to struggle with ButtonBox for this. This works for me: Needs["MultivariateStatistics`"] Button["Simulate", Print[RandomInteger[MultinomialDistribution[100,{1/6,1/6,1/6,1/6,1/6,1/6}],1]] ] hth, albert