Re: Thinking Mathematica: Any suggestions?

*To*: mathgroup at smc.vnet.net*Subject*: [mg91761] Re: Thinking Mathematica: Any suggestions?*From*: bertmayo <bertmayo at earthlink.net>*Date*: Sun, 7 Sep 2008 05:37:49 -0400 (EDT)*References*: <g9qiqa$4in$1@smc.vnet.net>

Hello, When you think about it, arrays actually mean two quite different things to computer scientists and to physicists and mathematicians. To a computer scientist an array means a method for putting and getting data in an arbitrary position in a large block of data. To a physicist an array is a place to use the collection of index-twiddling tools that we learn for vectors, tensors, and matrices when we are thinking about the geometry of linear spaces. It's certainly valid to use index methods if you want to continue to use your mathematical skills. You might even go further and skip using For and Do in favor of operators like Sum and Product which translate more directly from mathematical usage. On the other hand functional programming is recommended by many people as being faster and more efficient in Mathematica. I'm going to make the radical suggestion that you learn functional programming from the very pleasant book: Doets and vanEijck, "The Haskell Road to Logic, Maths, and Programming." Even the first few chapters will boot you into functional thinking. Yes, that's haskell, a different programming language, but it goes down easy and transfers directly back to Mathematica in many cases. Haskell is so functional that it doesn't have any looping constructs. People have already mentioned functional tools such as Map and Apply. >From haskell you will learn that an important tool also is "filter", which in Mathematica corresponds to Select. Another important functonal tool is Fold. A bonus is that haskell makes a lot of use of pattern matching, another skill that is useful also in Mathematica. Haskell is worth- while learning for its own sake as it frequently ranks in the "great computer shootout" as being very fast, sometimes second only to C. --Bert Mayo On Sep 5, 2:15 am, Tyler <hayes.ty... at gmail.com> wrote: > Hello All: > > I have a very basic question, but one that I am struggling to come to > terms with myself. Let me give a bit of background to put the question > in context.... > > I am coming from a FORTRAN programming background, where I used things > like DISLIN or plplot to generate figures. Sometimes I would import > them into a visualization tool like IDL, but for the most part, I'm a > procedural programmer. Even worse, some say, a FORTRAN one at that! > > Anyways, I've left academics after twelve years and decided to take > the plunge and purchase Mathematica 6. So far I am liking it; however, > there is still something of a learning curve here for me. I constantly > find myself looking at the For and Do constructs when attempting to > implement my algorithms. Obviously, I would like to start thinking in > "Mathematica" so as to take advantage of what the team at Wolfram has > done so I don't have to. > > My problem is, most of the examples I find in the documentation are of > the simplest kind and I am having difficulty applying them to > something more than Newton's method. Perhaps something like Finite- > Difference/Finite Element "like" algorithms, where index manipulations > are key to proper results? Again, this could be because I have a > wealth of procedural algorithms that assume a particular approach. > > Does anyone have any tips or insight into how they made the transfer > from a procedural paradigm to a more natural Mathematica one? > > Cheers, > > t.