Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16223 > unrolled thread

Help with Manipulate

Started by"Eduardo M. A. M. Mendes" <emammendes@gmail.com>
First post2013-11-14 06:50 +0000
Last post2013-11-15 11:54 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Help with Manipulate "Eduardo M. A. M. Mendes" <emammendes@gmail.com> - 2013-11-14 06:50 +0000
    Re: Help with Manipulate "Dr. Wolfgang Hintze" <weh@snafu.de> - 2013-11-15 11:54 +0000

#16223 — Help with Manipulate

From"Eduardo M. A. M. Mendes" <emammendes@gmail.com>
Date2013-11-14 06:50 +0000
SubjectHelp with Manipulate
Message-ID<l61rs7$qrb$1@smc.vnet.net>
Hello

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.

Many thanks

Ed

[toc] | [next] | [standalone]


#16227

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2013-11-15 11:54 +0000
Message-ID<l65223$5an$1@smc.vnet.net>
In reply to#16223
Am Donnerstag, 14. November 2013 07:50:47 UTC+1 schrieb Eduardo M. A. M. Mendes:
> Hello
>
>
>
> 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.
>
>
>
> Many thanks
>
>
>
> Ed

Ed, I have simplified your code so that it now runs without error.
I suggest to increase the complexitiy step by step and watch whre the error pops up.

Manipulate[
 n/Total[z], {{z,
   Flatten[{0,
     RandomVariate[Quiet[ExponentialDistribution[\[Lambda]]],
      n - 1]}]},
     Button["random",
    z = Flatten[{0,
       RandomVariate[Quiet[ExponentialDistribution[\[Lambda]]],
        n - 1]}]] & }, {\[Lambda], 1, 10}, {{n, 2}, 1, 100}]

Best regards,
Wolfgang

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web