MathGroup Archive 1997

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

Search the Archive

Re: Noah's List


I wrote:

>I have two lists, x and y, each containing n elements. I would like to
>generate a new list, {{x[[1]],y[[1]]}, {x[[2]],y[[2]]},...
>{x[[n]],y[[n]]}}, but have been unable to figure out a shorthand for it.

A collective thank you to the (currently 14) people who responded to this.
Transpose[{x,y}] was the most common suggestion with Thread[{x,y}] a
distant second. Also offered were MapThread[List,{x,y}] and
Table[{x[[k]],y[[k]]},{k,1,Length[x]}].

I am using the function to investigate the "square root" spiral, calculated
and drawn by Robert Stanley Beard some 40 years ago [See "Patterns in
Space", Creative Publications (1973), p.209]. The spiral may be thought of
as the concatenation of triangles with sides 1, n^(1/2), and (n+1)^(1/2),
for n=1 to infinity.

angle[n_]:=ArcTan[1/n^(1/2)]
x[n_]:=Range[n]^(1/2)*Cos[FoldList[Plus,0,angle[Range[n-1]]]]
y[n_]:=Range[n]^(1/2)*Sin[FoldList[Plus,0,angle[Range[n-1]]]]
z[n_]:=Transpose[{x[n],y[n]}]

sets up the data points as *exact* expressions.

ListPlot[z[111],PlotJoined->True,AspectRatio->Automatic]

will draw 3 revolutions of the spiral, omitting the triangles' spokes to
the origin. Thank you again.

--
HaHa
Rarebit Dreams




  • Prev by Date: combining lists
  • Next by Date: Re: Noah's List
  • Previous by thread: Re: Noah's List
  • Next by thread: Re: Noah's List