MathGroup Archive 2000

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

Search the Archive

Compile Question: mg26177

  • To: mathgroup at
  • Subject: [mg26201] Compile Question: mg26177
  • From: Blimbaum Jerry DLPC <BlimbaumJE at>
  • Date: Thu, 30 Nov 2000 22:02:16 -0500 (EST)
  • Sender: owner-wri-mathgroup at

	Chris wrote:..basically..can't compile the following:

			 g[{r_,t_}]:=r Cos[n t];

	Here are some Timing results for comparison of the solutions offered
to this problem:   I used .001 instead of .5 for the xy Table: I'm using a
P3 600 MHz machine...V4 Mathematica

	Table[x Cos[4. y],{x,-1,1,.001},{y,-1,1,.001}];//Timing     = 76.19

	Compile[{{n,_Integer}}, Table[x Cos[n
y],{x,-1,1,.001},{y,-1,1,.001}]];//Timing = 7.96 seconds 

	Compile[{{n,_Integer},{delta,_Real}}, Table[x Cos[n
y],{x,-1,1,delta},{y,-1,1,delta}]];//Timing = 6.42 seconds  with delta =

	Another solution using Map (not shown here) took about 33 seconds..

	One reason I took an interest in this problem is that I tried to
solve it..wracked my 'grey cells' absolutely nowhere and then saw some
of the simplest solutions offered..thank Heaven for the bright people at
Mathgroup!!!   It's one of the things that makes using Mathematica so
interesting and valuable...

	Jerry Blimbaum  NSWC  Panama City, Fl


  • Prev by Date: Re: New version of Mathematica
  • Next by Date: Re: Polar plot with a twist.
  • Previous by thread: Newton Raphson fractals
  • Next by thread: Problem: Passing Variables within Expressions To Mathematica through JLink