MathGroup Archive 2013

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

Search the Archive

Re: Mathematica and Lisp

  • To: mathgroup at
  • Subject: [mg129909] Re: Mathematica and Lisp
  • From: David Bailey <dave at>
  • Date: Mon, 25 Feb 2013 02:20:58 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <kcqkv4$lq5$> <kct7fj$sgo$> <kfkm72$j97$> <24729974.35095.1361092362942.JavaMail.root@m06> <kft1l8$cqr$> <kg71s0$4mo$> <kgab38$c7s$> <kgc52j$gae$>

On 24/02/2013 04:31, Richard Fateman wrote:

> It means that for many people the misconceptions that they have about
> precedences are never revealed to them because they don't use FullForm,
> and their programs are buggy.  There are hosts of arbitrary precedences
> among // /. /; _ _? ....  that ordinary mathematics does not have, so
> the ordinary math-familiar occasional programmer has no solid clue.
> For example, do you know offhand if  Pi x // Sin is  Sin[Pi*x] or
> Pi*Sin[x] ?  Do you realize that if you type Sin Pi x you see as a
> result,  Pi Sin x.  so it seems that Mathematica believes sin(pi*x) =
> pi*sin(x).

I think anyone with some Mathematica experience uses a selection of 
operators, such as /. etc. and spells out other things longhand. For 
example, I always write Map rather than use the /@ operator. On the 
other hand, I use the // operator a lot, so I was able to answer your test.

> How do you know this? Do you have a survey? Just curious how you can say
> this.
Well, I have seen a fair bit of beginner Mathematica code, both from my 
consultancy and from answering questions on this forum. Practically 
nobody presents their code in full FullForm! For example, hardly anyone 
would spell out CompoundExpression rather than use a semicolon.

Suppose that FullForm were the only acceptable input to Mathematica - 
which you would appear to advocate. Would you want FullForm output also? 
That would result in some pretty ugly maths, so perhaps you would relent 
at this point, but part of the convenience of Mathematica is that you 
can paste bits of output back into other input!

Program bugs are often to be found in obscure bits of code that are hard 
to read. Formulae are obviously far easier to read if they are not 
written in FullForm (or Lisp!).

I would concede that it might be a good idea if certain built in symbols 
such as Sin had a new attribute such as NonAlgebraic that forbade their 
use in expressions like Sin Pi x.

The real truth is that conventional written maths is hopelessly 
ambiguous without context. That is why you can come up with expressions 
like Sin x - or indeed f(x). Likewise hardly any maths/physics paper 
would spell out those multiplications that were non-commutative (e.g. by 
using a special operator) - the reader is just meant to figure it out. 
Thus every CAS has to resolve those ambiguities one way or another.  I'd 
say Stephen Wolfram's design is about as good as you can get - and 
certainly better than Lisp!

David Bailey

  • Prev by Date: Re: A nonconventional ListContourPlot
  • Next by Date: Re: Hold & Evaluate
  • Previous by thread: Re: Mathematica and Lisp
  • Next by thread: Re: Mathematica and Lisp