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: [mg52732] Re: [mg52710] a strange line of code
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sat, 11 Dec 2004 05:21:41 -0500 (EST)
  • References: <200412100124.UAA18993@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Highlight "/@", "#", or "&" and push the Help key.

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

{x, #}& is a pure function whose argument is #.
({x, #}&[y] is {x, y}, for instance.)

x# (1 - #) & is another pure function.
(x# (1 - #) &[y] / x y (1 - y), for instance.)

Union[Drop[NestList[x# (1 - #) &, 0.2, 300], 100]] evaluates to a list, as follows.

The second pure function is applied to 0.2 (as a starting point) a total of 300 times, so the result of NestList is 301 values from those iterations.

Drop removes the first 100, to leave 201.

Union sorts those 201 values and removes duplicates, if any.

The first pure function is mapped (see Map in Help) onto the Union result.

Bobby

On Thu, 9 Dec 2004 20:24:06 -0500 (EST), Stefan Schuster <bi1169*delete_from_star_to_star* at fh-weihenstephan.de> wrote:

> Hello,
>
> 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]]];
>
> thanks in advance
>
> Stefan
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • References:
  • Prev by Date: Re: a strange line of code
  • Next by Date: Bug in 5.1,Linux, GUIKit?
  • Previous by thread: Re: a strange line of code
  • Next by thread: Re: a strange line of code