MathGroup Archive 2005

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

Search the Archive

Re: Tilting at Windmills?

  • To: mathgroup at
  • Subject: [mg62127] Re: Tilting at Windmills?
  • From: p.ramsden at
  • Date: Sat, 12 Nov 2005 03:31:30 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Hi Matt,

Someone who knows about that sort of thing will be able to help out with your concerns about memory (though my guess, like yours, is that it's dynamically allocated and that's that!) I just wanted to talk about your cobweb algorithm itself; forgive the liberty. 

In general, it's best to avoid iterating through lists in Mathematica where possible. I do cobweb diagrams in Mathematica a lot; here's the code I use, in case you find it helpful. (I've omitted your debugging and your sophisticated error-trapping on the input data.)

 cobwebList[data_] := With[
  {duplicatedData = Flatten[Transpose[{data, data}]]}, 
  Transpose[{Drop[duplicatedData, -1], Drop[duplicatedData, 1]}]

Let me know how this fares, on your machine, when tested on your long list?

Link to the forum page for this post:
Posted through [[postId=5929]]

  • Prev by Date: Re: 'Good' or 'Proper' Mathematica coding habits question
  • Next by Date: Re: Write, Put,..
  • Previous by thread: Re: Tilting at Windmills?
  • Next by thread: Re: Tilting at Windmills?