Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9170
| From | psycho_dad <s.nesseris@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Cool example with ContourPlot+EvaluationMonitor |
| Date | 2012-03-20 07:25 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jk9bde$bnr$1@smc.vnet.net> (permalink) |
| References | <jk1fpb$4v0$1@smc.vnet.net> <jk70d0$137$1@smc.vnet.net> |
Hi Ralph,
Well, the thing is that most Mathematica functions are sort of a "black box", ie you supply a set of functions and parameters and it produces a result. In this case you never see the intermediate steps/results, the source code is obviously not available and even if it was, according to the documentation in many cases it's not even human readable (for efficiency reasons).
Therefore, this example illustrates how one of the functions (ContourPlot) operates in real time: first it makes a grid in the 2D space specified by the user, eg {x, -1.5, 1.5} & {y, -1.5, 1.5}, and then it picks values of (x,y) close to the actual contour: my guess is it chooses the ones close to where Abs[x^2+y^2-1]<dr, where dr is a small number say 0.2 (of course this is just a guess). I'm posting some (quick and dirty) code below that illustrates this.
I hope this helps!
Cheers
PS Of course I have to mention that Mathematica also checks the corners of the region etc but that's another story ;)
--- Code ---
(* grab the data from ContourPlot *)
data = {};
ContourPlot[x^2 + y^2 == 1, {x, -1.5, 1.5}, {y, -1.5, 1.5},
EvaluationMonitor :> AppendTo[data, {x, y}]];
(* just take the grid *)
qq = data[[1 ;; 15*15]];
(* evaluate Abs[x^2+y^2-1] and take the ones <0.2, then plot *)
qq1 = Table[{Abs[qq[[i, 1]]^2 + qq[[i, 2]]^2 - 1], qq[[i, 1]],
qq[[i, 2]]}, {i, 1, Length[qq]}] // Sort;
qq1 = qq1[[1 ;; 32]][[All, {2, 3}]];
ListPlot[{qq, qq1}, PlotStyle -> {Blue, Red}, AspectRatio -> 1]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cool example with ContourPlot+EvaluationMonitor psycho_dad <s.nesseris@gmail.com> - 2012-03-17 07:51 +0000
Re: Cool example with ContourPlot+EvaluationMonitor Murta <rodrigomurtax@gmail.com> - 2012-03-18 07:50 +0000
Re: Cool example with ContourPlot+EvaluationMonitor Ralph Dratman <ralph.dratman@gmail.com> - 2012-03-19 10:05 +0000
Re: Cool example with ContourPlot+EvaluationMonitor psycho_dad <s.nesseris@gmail.com> - 2012-03-20 07:25 +0000
Re: Cool example with ContourPlot+EvaluationMonitor David Kahle <david.kahle@gmail.com> - 2012-03-20 07:20 +0000
Re: Cool example with ContourPlot+EvaluationMonitor "Kevin J. McCann" <kjm@KevinMcCann.com> - 2012-03-20 07:22 +0000
Re: Cool example with ContourPlot+EvaluationMonitor psycho_dad <s.nesseris@gmail.com> - 2012-03-21 10:44 +0000
Re: Cool example with ContourPlot+EvaluationMonitor "djmpark" <djmpark@comcast.net> - 2012-03-23 06:35 +0000
csiph-web