Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Tilting at Windmills?

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

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:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=5929#p5929
Posted through http://www.mathematica-users.org [[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?