[Date Index]
[Thread Index]
[Author Index]
Re: Help with Manipulate
*To*: mathgroup at smc.vnet.net
*Subject*: [mg132048] Re: Help with Manipulate
*From*: "Eduardo M. A. M. Mendes" <emammendes at gmail.com>
*Date*: Mon, 25 Nov 2013 23:58:33 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-outx@smc.vnet.net
*Delivered-to*: mathgroup-newsendx@smc.vnet.net
*References*: <20131114071144.3079F6A38@smc.vnet.net> <5284A878.90104@idi.ntnu.no> <20131115114037.753D56A3C@smc.vnet.net> <20131125082512.GV88904@wolfram.com>
Hello
Thank you.
Cheers
Ed
On Nov 25, 2013, at 6:25 AM, Itai Seggev <itais at wolfram.com> wrote:
>
> Button wants a function in the second argument, which is the function to be
> applied to its contents when pressed. This code creates a "pure function"
> (look at ref/Function in the documentation center) which ignores the button
> contents but assign the value of generate to z.
>
> On Fri, Nov 15, 2013 at 06:40:37AM -0500, Eduardo M. A. M. Mendes wrote:
>> Hello
>>
>> Many many thanks.
>>
>> I went through the code you sent me to see if I can understand it. There is one piece that I don't understand. Here is it
>>
>>
>>> (z = generate[\[Lambda], n]) &
>>
>> Why do I need &?
>>
>> Thanks again.
>>
>> Cheers
>>
>> Ed
>>
>>
>> On Nov 14, 2013, at 8:39 AM, Waclaw Kusnierczyk <waku at idi.ntnu.no> wrote:
>>
>>> Will this solve your problem:
>>>
>>> With[{generate =
>>> RandomVariate[Quiet@ExponentialDistribution[#1], #2 - 1] &},
>>> Module[{z},
>>> Manipulate[
>>> z = generate[\[Lambda], n];
>>> n/Total[z],
>>> Button["generate", (z = generate[\[Lambda], n]) &],
>>> {{\[Lambda], 2}, 1, 100, 1},
>>> {{n, 10000}, 2, 1000000, 1000}]]]
>>>
>>> Best,
>>> vQ
>>>
>>>
>>> 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.
>>
>>
> --
> Itai Seggev
> Mathematica Algorithms R&D
> 217-398-0700
Prev by Date:
**Re: Solving complicated matrix equations**
Next by Date:
**Re: NonlinearModelFit and Complex Data**
Previous by thread:
**Re: Help with Manipulate**
Next by thread:
**Re: Help with Manipulate**
| |