MathGroup Archive 2013

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

Search the Archive

Re: updating a simulation within Manipulate.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130086] Re: updating a simulation within Manipulate.
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Fri, 8 Mar 2013 06:24:23 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <khbn20$ceg$1@smc.vnet.net>
  • Reply-to: nma at 12000.org

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
>







  • Prev by Date: Re: Mathematica 9 install
  • Next by Date: Re: updating a simulation within Manipulate.
  • Previous by thread: Re: updating a simulation within Manipulate.
  • Next by thread: Re: Fixed Typo in Code---> Re: updating a simulation