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


Groups > comp.soft-sys.math.mathematica > #13776

Re: updating a simulation within Manipulate.

From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: updating a simulation within Manipulate.
Date 2013-03-08 11:22 +0000
Message-ID <khchkv$c7c$1@smc.vnet.net> (permalink)
References <khbn20$ceg$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


FYI;

On V 9.0.1 on windows, when I run the code, (checked the `keepWalking` box, then
I get flood of these errors  on the console:

RandomVariate::realprm: Parameter bias at position 1 in NormalDistribution[bias,1] is expected to be real. >>


On 3/7/2013 9:48 PM, W Craig Carter wrote:

>
> randomStep[bias_, stepList_] :=
>   Module[{angle = RandomVariate[NormalDistribution[bias, 1]]},
>    Join[stepList, {Last[stepList] + {Cos[angle], Sin[angle]}}]]
>
> walkerGraphic[stepList_, range_] :=
>   Graphics[GraphicsComplex[stepList, Disk /@ Range[Length[stepList]]],
>    PlotRange -> range {{-1, 1}, {-1, 1}}]
>
> DynamicModule[
>   {walkerPath = {{0, 0}}},
>   Manipulate[
>    If[keepWalking,  (*  kludge warning---testing for If[True...] seems inefficient   *)
>     walkerPath = randomStep[bias, walkerPath]
>     ];
>    If[reset,
>     reset = False; keepWalking = False;
>     walkerPath = {{0, 0}}
>     ];
>    walkerGraphic[walkerPath, range],
>    {{keepWalking, False}, {True, False}},
>    {{reset, False}, {True, False}},
>    Delimiter,
>    {{range, 20}, 0, 100},
>    {{a, 0}, -Pi, Pi,
>     AngularGauge[##, ImageSize -> 160 ,
>       ScaleOrigin -> {{-4 Pi, 4 Pi}, 1}] &}
>    ]
>   ]
>
>
>
> W Craig Carter
> Professor of Materials Science, MIT
>




Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

updating a simulation within Manipulate. W Craig Carter <ccarter@MIT.EDU> - 2013-03-08 03:48 +0000
  Re: updating a simulation within Manipulate. "Nasser M. Abbasi" <nma@12000.org> - 2013-03-08 11:22 +0000

csiph-web