Re: Extracting data points from Plot[]
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg822] Re: [mg773] Extracting data points from Plot[]
- From: tiggj at iswaps.lonnds.ml.com (Jason Tigg SWAP GROUP ANALYST X2312 LDN)
- Date: Mon, 24 Apr 1995 02:46:09 -0400
J. Gruyer wrote
> The Plot[] function does some intelligent picking of points, such that it
> usually does a pretty good job of following twists and turns in a function
> without plotting an excessive number of points. I'm not ecstatic about
> using Mma for final output, though, so I like to export these curves to a
> graphing program.
>
> So far, I haven't been able to figure out any way to get at this
> point-picking algorithm without using Plot[]. What I'm then left with is
> doing:
Here's a trick which I picked up at a Mathematica conference.
In[1] := data = {};
f[x_] := x^2;
Plot[ AppendTo[data, {x,f[x]}]; f[x], {x,0,2},
DisplayFunction -> Identity];
data // Short
Out[4] = {{0,0},{0.0833333, 0.00694444}, <<37>>, {2,4}}
This method can be used to investigate where FindMinimum samples a function
in its search for a minimum.
Jason Tigg