MathGroup Archive 2013

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

Search the Archive

Re: Warsaw Univ. course, was Re: Work on Basic Mathematica Stephen!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130984] Re: Warsaw Univ. course, was Re: Work on Basic Mathematica Stephen!
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Fri, 31 May 2013 03:40:19 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <kmngb2$3rv$1@smc.vnet.net> <20130519095011.606CD6A14@smc.vnet.net> <knv52t$j93$1@smc.vnet.net> <ko1nhc$r3t$1@smc.vnet.net>

On 28/05/2013 08:49, Richard Fateman wrote:
>
> I do not see any connection here.  It is possible to write a linked list
> in Mathematica and still use its evaluation.  e.g.
> consider using  node[element,RestOfList].   Instead of [A,B,C] use
> node[A,node[B,node[C,Nil]]].  A node here is like a lisp "cons" cell.
> In fact there are other computer algebra systems written in lisp that
> use lisp lists and have similar evaluation strategies to Mathematica.
>

Yes you could, and you might find it instructive to do this, because you 
would then see exactly why Stephen Wolfram chose to implement lists in a 
different way!

Try using your implementation to implement some 1000 x 1000 matrix algebra!

OK - perhaps you wouldn't want to use your new list implementation for 
linear algebra, but in that case, where would you want to use it? Lisp 
lists are expensive to use unless the algorithm is tailored to generate 
lists in reverse order, and consume them in forward order (OK you can 
reverse a Lisp list, but that consumes space for a copy, but random 
access is still inefficient).

Since the Lisp language was designed very early on, I would imagine its 
list structure reflects the tiny memory spaces available at that time. 
Garbage collection of varying sized objects is more complex and tends to 
need some slack memory.

The decision to implement lists the Mathematica way, has been amply 
vindicated in recent years. Because the mechanisms supplied to access 
lists are not skewed towards sequential access, it has been possible to 
produce packed arrays (and indeed sparse arrays) that work as drop in 
replacements for the equivalent list structures - with enormous 
performance gains.

Mathematica also gains from the decision to make lists mutable - again 
this simplifies the design of algorithms and increases performance.

Clearly Mathematica lists also score in they must help internally to 
avoid repeated evaluation. Clearly Mathematica must store some 
information in the head of every object to keep track of objects that 
need reevaluation, and you wouldn't want each list node to be bloated 
out in that way.

Yes you could implement Lisp-style lists in Mathematica, and with a bit 
more effort, you could also supply them with a nice syntax for 
input/output, so try it and see how many people find them useful!

David Bailey
http://www.dbaileyconsultancy.co.uk





  • Prev by Date: Re: Work on Basic Mathematica Stephen!
  • Previous by thread: Re: Applying Mathematica to practical problems
  • Next by thread: Re: Work on Basic Mathematica Stephen!