MathGroup Archive 2012

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

Search the Archive

Re: Cool example with ContourPlot+EvaluationMonitor

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125545] Re: Cool example with ContourPlot+EvaluationMonitor
  • From: Murta <rodrigomurtax at gmail.com>
  • Date: Sun, 18 Mar 2012 02:43:54 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jk1fpb$4v0$1@smc.vnet.net>

Nice!.. I played with the code and made it shorter.
It's the same thing.

Dynamic[
 ListPlot[data, Frame -> True, AspectRatio -> 1, PlotStyle -> Blue,
  PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, Epilog -> Circle[{0, 0}]]]
data = {}; freeze = 0.01

ContourPlot[x^2 + y^2 == 1, {x, -1.5, 1.5}, {y, -1.5, 1.5},
 EvaluationMonitor :> (AppendTo[data, {x, y}]; Pause[freeze])]

[]'s
Murta
On Mar 17, 4:51 am, psycho_dad <s.nesse... at gmail.com> wrote:
> The following example shows in real-time (sort of) how ContourPlot calculates a contour (in this example a unit circle):
>
> f[x_, y_, freeze_] := (Pause[freeze]; (x^2 + y^2))
> data = {}; freeze = 0.04;
> Dynamic[ListPlot[data, Frame -> True, AspectRatio -> 1,
>   PlotStyle -> Blue, PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}},
>   Epilog -> Circle[{0, 0}]]]
> ContourPlot[f[x, y, freeze] == 1, {x, -1.5, 1.5}, {y, -1.5, 1.5},
>   EvaluationMonitor :> AppendTo[data, {x, y}]];
>
> Initially I just wanted to get all the points from ContourPlot, but then it dawned on me that using Dynamic I could do that in real time! I hope you like it :D
>
> Cheers
>
> PS Change the parameter freeze (set to 0.04 secs) to make the animation slower or faster.
> PPS This is so cool, I just knew I had to share it!




  • Prev by Date: Re: Creating List
  • Next by Date: Re: Creating List
  • Previous by thread: Cool example with ContourPlot+EvaluationMonitor
  • Next by thread: Re: Cool example with ContourPlot+EvaluationMonitor