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


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

Re: Help with Manipulate

Started byTomas Garza <tgarza10@msn.com>
First post2013-11-15 11:58 +0000
Last post2013-11-15 11:58 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help with Manipulate Tomas Garza <tgarza10@msn.com> - 2013-11-15 11:58 +0000

#16233 — Re: Help with Manipulate

FromTomas Garza <tgarza10@msn.com>
Date2013-11-15 11:58 +0000
SubjectRe: Help with Manipulate
Message-ID<l6529n$5c8$1@smc.vnet.net>
Try to debug your code with smaller values, so you can see the results before attempting to use thousands or millions of numbers. What I would do is define the z outside the Manipulate as a function of lambda and n, and then proceed small step by small step to look for mistakes. Leave aside the embellishments until you have the calculations running ok, and only then introduce titles and labels.
For example, I defined first

z[lambda_, n_]:=Flatten[{0,RandomVariate[Quiet@ExponentialDistribution[lambda],n-1]}]

and then tried

Manipulate[n/Total[z[lambda,n]],{{n,10},10,100,5},{{lambda,1},1,100}]

This works ok. From here on, you may (I didn't) introduce Style, Appearance, Delimiter, etc.
Good luck,

-Tomas




> From: emammendes@gmail.com
> Subject: Help with Manipulate
> To: mathgroup@smc.vnet.net
> Date: Thu, 14 Nov 2013 02:11:44 -0500
>
>
> 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] | [standalone]


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


csiph-web