RE: how to extract parameter values

• To: mathgroup at smc.vnet.net
• Subject: [mg37316] RE: [mg37310] how to extract parameter values
• From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
• Date: Wed, 23 Oct 2002 02:56:50 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```
>-----Original Message-----
>From: Jan Mangaldan [mailto:jajem at yahoo.com]
To: mathgroup at smc.vnet.net
>Sent: Tuesday, October 22, 2002 10:49 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg37316] [mg37310] how to extract parameter values
>
>
>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 (~_~)

Jan,

In[1]:= a = {0.5, 0.25, 0.3}; b = {0.125, 0.35, 0.03};
In[2]:=
f[t_] := a . {Sin[t], Sin[2*t], Sin[3*t]};
g[t_] := b . {Cos[t], Cos[2*t], Cos[3*t]}

In[4]:= {tmin, tmax} = {0, 2*Pi};
In[5]:=
list = {}; s = {f[t], g[t]};
Timing[ParametricPlot[list = {list, t}; s,
{t, tmin, tmax}]]

ParametricPlot::"ppcom": "Function \!\(\(\(list = \(\({list, t}\)\)\)\) ;
s\) \
cannot be compiled; plotting will proceed with the uncompiled function."
Out[6]= {0.231 Second, - Graphics -}

In[7]:= tt = Flatten[list];
Length[tt]
ss = -Apply[Subtract, Partition[tt, 2, 1], {1}];
Out[8]= 271

In[10]:= ListPlot[tt]
In[11]:= ListPlot[ss, PlotJoined -> True, PlotRange -> All]

In[12]:= Timing[ParametricPlot[{f[t], g[t]}, {t, tmin, tmax}]]
Out[12]= {0.25 Second, - Graphics -}

You see the uncompiled version, including registering of the t-samples is
faster than the "compiled version"?

In[13]:=
Timing[ParametricPlot[Evaluate[{f[t], g[t]}], {t, tmin, tmax}]]
Out[13]= {0.04 Second, - Graphics -}

In[14]:=
list = {}; s = Compile[t,{f[t], g[t]}];
Timing[ParametricPlot[list = {list, t}; s[t],
{t, tmin, tmax}];]
Out[15]= {0.32 Second, Null}

In[16]:=
list = {}; s = Compile[t,Evaluate[{f[t], g[t]}]];
Timing[ParametricPlot[list = {list, t}; s[t],
{t, tmin, tmax}];]
Out[17]= {0.1 Second, Null}

--
Hartmut Wolf

```

• Prev by Date: RE: how to extract parameter values
• Next by Date: Re: magnify Help Browser
• Previous by thread: RE: how to extract parameter values
• Next by thread: RE: RE: how to extract parameter values