MathGroup Archive 2004

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

Search the Archive

Re: a strange line of code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52715] Re: a strange line of code
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 11 Dec 2004 05:21:08 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 12/9/04 at 8:24 PM,
bi1169*delete_from_star_to_star* at fh-weihenstephan.de (Stefan
Schuster) wrote:

>in a notebook, I found and function to calculate the Feigenbaum
>bifurcation Diagram. I principial understand the Feigenbaum, and I
>think I'm also able to write such an funcion by myself, but not in
>this compact way.

>Can someone please explain me the meaning of the Symbols #, @ and &

>Here is the Code:

>Feigenbaum = Compile[{{
>?, _Real}}, ({?, #} &) /@ Union[Drop[NestList[ ? # (1 - #) &, 0.2,
>300], 100]]];

the '#' character represents the first argument to a pure function.

the '&' character is the final delimiter of a pure function, i.e.,

f[x_]:= 2 x  is equivalent to

f = 2 #& in that both will multiply an argument by 2.

Finally, the code above uses '/@' which is different than '@'. '/@' is short hand for Map. '@' is used for the prefix form of a function. That is using the f above, f@3 would yield 6 while f/@{2,3} would yield {4,6}

BTW, all of this information can be easily found using the online help. For example, typling ?# will result in a message saying essentially what I posted above.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: [Splines] Defining piecewise functions over a variable number of intervals
  • Next by Date: multiple outputs from a function
  • Previous by thread: Re: a strange line of code
  • Next by thread: Re: a strange line of code