Re: Algorithm Analysis Course: Should I use Mathematica for projects?

*To*: mathgroup at smc.vnet.net*Subject*: [mg127300] Re: Algorithm Analysis Course: Should I use Mathematica for projects?*From*: Richard Fateman <fateman at eecs.berkeley.edu>*Date*: Sun, 15 Jul 2012 04:25:46 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net

On 7/14/2012 12:52 PM, Andrzej Kozlowski wrote: > I don't intend to get involved in more pompous and futile rhetorics so beloved by Richard, but so I will restrict myself to matters of substance. > The stuff about "how it all works" is mere hypothesis - quite interesting in some ways but no more (and actually perhaps less) than similar hypothesis I have heard from my students. It's all rather unimportant. Actually, if you are timing procedures, it is essential. > >>> Another thing, all your examples of length dependent retrieval involve changing the list in w way that could alter it's length. >> This is false. I set the several arrays in fixed size and then changed the contents, not the length. >> Your statement is also ungrammatical. ... " it's" is a contraction for "it is" ... not a possessive. :) > I will address only the first part of the above (the second is just too childish, even with the smiley, to bother with). > > You used the construction: > > > B = Table[i, {i, 0, 1000}]; > B[[5]] = j; Timing[Do[B[[50]]++, {i, 0, 100000}]] > > This sort of thing can certainly change the length of a list. A simple example: > > Clear[B] > > j /: {a___, j, b__} := {a, 1, 1, b} > > B = Table[i, {i, 0, 5}]; > Length[B] > 6 > > B[[5]] = j; > Length[B] > 7 > > It would seem to me that this alone should force re-evaluation of the list. The activity which is being timed is B[[50]] or B[[50]]++ neither of which changes the length of the list/ size of the array. > >>> Finally, I would like to mention that I have taken no position at all on the question in the subject of this thread. Clearly using a tool which was designed for a purpose other than the one you have in mind is rarely the optimal approach unless there are some benefits that compensate for the almost inevitable deficiencies. Mathematica was not designed primarily as an all purpose programming language so it is not the best tool for the study of the workings of such languages. >> That was not the issue. Studying algorithms is not the same as studying the workings of programming languages. >> Mathematica would not be my first choice for either. > Studying algorithms is not the same as studying the working of programming languages and I never said it was. But algorithms have various aspects some of which can be studied without any mention of any programming language at all (as happens for example with algorithms in commutative algebra) and others (such as time and space complexity) require the introduction of a specific model of a computer and a suitable language - (as was done, for example, in volume 1 of Knuth's "The Art of Computer Programming"). Choosing such a model and a language is always to some extent arbitrary. One could probably create a computer especially designed to run Mathematica (as was once done with LISP at MIT) and if this computer became the "accepted standard" "the study of algorithms" for such a computer would not be exactly the same as the study of algorithms for th standard computers in use today. I would not hold my breath for the advent of the Mathematica-machine-standard model of computing. First of all, it can all be done with existing models, obviously. Secondly, you seem to think that "how it works" is subject to mere hypotheses. And there are more reasons.