MathGroup Archive 1994

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

Search the Archive

Re: Re: Question in ParametricPlot

  • To: MathGroup at christensen.cybernetics.net
  • Subject: [mg264] Re: [mg249] Re: [mg227] Question in ParametricPlot
  • From: Jeffrey Adams <jeff at tiag.com>
  • Date: Thu, 1 Dec 94 16:48:02 -0500

>The algorithm that Mathematica uses to generate plots is described 

>in a number of places; I know of no way short of duplicating that 

>algorithm explicitly to get one's hands on the list {t1, t2, ...}

Here is a method of easily getting a list of the independent variable  
as Mathematica generates a plot.

The credit for this "trick" goes to Tom Wickam-Jones at Wolfram  
Research, (at least he was the first person I've seen that  
illustrated this technique).

Example:
========
--------------------------------------
lst = {}

Plot[ AppendTo[lst, x]; x^2, {x,0,1}]
--------------------------------------

Now lst holds the values of x that were used by Mathematica to make  
the plot.

And so for any Parametric Plot you can get the same results for the  
independent variable:

Example:
========
--------------------------------------
lst = {}

ParametricPlot[
    AppendTo[lst, t];
	{Sin[t], Sin[2 t]}, {t,0,2Pi},
	Compiled ->False]
--------------------------------------

Now lst holds a list of the independent values of t used to make the
plot.  Notice the use of Compiled -> False to remove a warning  
message about Mathematica not being able to compile this function  
because of AppendTo being in there.

A very simple and elegant way of getting the values after you realize  
that as Mathematica has to evaluate the value of the function at each  
point it uses, you know the entire first argument of the plotting  
function will evaluate, in this case, the AppendTo as well.


Jeff Adams
jeff at tiag.com






  • Prev by Date: Timing
  • Next by Date: Re: MMA to Illustrator
  • Previous by thread: Re: Timing
  • Next by thread: Re: MMA to Illustrator