MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with Manipulate

Will this solve your problem:

With[{generate =
    RandomVariate[Quiet@ExponentialDistribution[#1], #2 - 1] &},
    z = generate[\[Lambda], n];
    Button["generate", (z = generate[\[Lambda], n]) &],
    {{\[Lambda], 2}, 1, 100, 1},
    {{n, 10000}, 2, 1000000, 1000}]]]


On 11/14/2013 08:11 AM, Eduardo M. A. M. Mendes wrote:
> I need to create a simple demonstration based upon an exercise on poisson counting processes.  Here is the code
> Manipulate[n/Total[z],Style["Poisson Arrival Times",18,Bold],"",Delimiter,{{z,Flatten[{0,RandomVariate[Quiet@ExponentialDistribution[\[Lambda]],n-1]}]},Button["random",z=Flatten[{0,RandomVariate[Quiet@ExponentialDistribution[\[Lambda]],n-1]}]]&,Appearance->"Labeled"},"",Delimiter,{{\[Lambda],2,"\[Lambda]"},1,100,1,Appearance->"Labeled"},"",Delimiter,{{n,10000,"n"},1,1000000,1000,Appearance->"Labeled"},SaveDefinitions->True]
> The idea is to generate a sequence of random numbers, then take the sum of it and keep the last value.   Every time I hit "random"a new sequence is created.
> The above code returns the following error msg
> RandomVariate::array :  "\"The array dimensions -1 + n given in position 2 \
> of RandomVariate[ExponentialDistribution[=CE=BB], -1 + n] should be a list of \
> non-negative machine-sized integers giving the dimensions for the result. \""
> and some weird output.   After hitting "random",  the output is what I expect but the whole Manipulate output is still red indicating that there are problems.
> Could you be so kind to point out what I did wrong and how to fix it?   I feel that I did not quite get how Manipulate works.

  • Prev by Date: Re: Is Mathematica V.8.01 fully supported by Windows 8.1?
  • Next by Date: Re: Help with Manipulate
  • Previous by thread: Help with Manipulate
  • Next by thread: Re: Help with Manipulate