MathGroup Archive 2013

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

Search the Archive

Re: Mathematica and Lisp

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

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
http://www.dbaileyconsultancy.co.uk






  • 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