RE: how to extract parameter values
- To: mathgroup at smc.vnet.net
- Subject: [mg37320] RE: [mg37310] how to extract parameter values
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 23 Oct 2002 02:56:59 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Jan, Why do you want the t values? They are only an artifact of Mathematica's plot making? If what you really want is the points then here is an example of what you can do. We extract the graphics, g, and the points, pts, from the Line in g. Then show them both. curve[t_] := {t, Sin[t]} g = First[ ParametricPlot[Evaluate[curve[t]], {t, 0, 2Pi}, DisplayFunction -> Identity]]; pts = Cases[g, Line[a_] -> a, Infinity] // First; Show[Graphics[ {g, AbsolutePointSize[5], Point /@ pts}], Frame -> True, ImageSize -> 450]; In general you could solve for t from the x or y point coordinates (trivial in my example) but the method you propose is better. Add Compiled -> False to eliminate the error message and don't worry about the extra time because you are asking for extra information. I don't think there is actually significant extra time. list = {}; ParametricPlot[(AppendTo[list, t]; curve[t]), {t, 0, 2Pi}, Compiled -> False]; For our example, the two methods give the same t values, but list is not in order. If you look at the two set of t values you can see how the Mathematica plotting routine backtracks to fill in regions of high curvature. (First /@ pts) == Sort[list] True David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Jan Mangaldan [mailto:jajem at yahoo.com] To: mathgroup at smc.vnet.net I'd like to know how I can extract the parameter values used by ParametricPlot in plotting a curve, e.g. if ParametricPlot used points corresponding to parameter values 2, 4, 6, etc... I need a way to get the list {2, 4, 6, ...}. One solution I know is this: list={}; ParametricPlot[(AppendTo[list,t]; {f[t] g[t]}),{t,tmin,tmax}]; The problem with this is that I get an error that ParametricPlot cannot compile the function, and that the plotting time is considerably slowed down. especially if I have a high PlotPoints setting. Any ideas? Jan Mangaldan (~_~) __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/