MathGroup Archive 2010

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

Search the Archive

Strange Nest behaviour with functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114099] Strange Nest behaviour with functions
  • From: István Zachar <zac at freemail.hu>
  • Date: Tue, 23 Nov 2010 06:01:36 -0500 (EST)

Dear Group,

could someone please explain why Nest yields different results for
pure and non pure functions for certain parameter values? The first
example (with r = 3.5) produces the same lists, while the second (with
r = 3.6) fails to do that. Should pure and non-pure functions differ
in this aspect? For larger values of r, the divergence is even more
pronounced.

In[60]:= func[r_,x_]:=r x (1-x);
		r=3.5;
		d1=Nest[r # (1-#)&,Range[0,1,0.2],100]
		d2=Nest[func[r,#]&,Range[0,1,0.2],100]
		d1==d2

Out[62]= {0.,0.826941,0.38282,0.38282,0.826941,0.}
Out[63]= {0.,0.826941,0.38282,0.38282,0.826941,0.}
Out[64]= True

In[65]:= r=3.6;
		d1=Nest[r # (1-#)&,Range[0,1,0.2],100]
		d2=Nest[func[r,#]&,Range[0,1,0.2],100]
		d1==d2

Out[66]= {0.,0.899672,0.456407,0.456408,0.899672,0.}
Out[67]= {0.,0.899672,0.456409,0.456409,0.899672,0.}
Out[68]= False


  • Prev by Date: Re: Finding shared element in two lists
  • Next by Date: Re: TeXForm issue
  • Previous by thread: Re: "OpenCLLink block size is invalid"
  • Next by thread: Re: Strange Nest behaviour with functions