MathGroup Archive 2011

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

Search the Archive

Re: Metastable expressions in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119730] Re: Metastable expressions in Mathematica
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Sun, 19 Jun 2011 07:25:10 -0400 (EDT)
  • References: <201106141014.GAA06248@smc.vnet.net> <ita4j9$mb1$1@smc.vnet.net> <itek4d$s7f$1@smc.vnet.net> <itjdsv$l15$1@smc.vnet.net>

On 6/18/2011 4:55 PM, David Bailey wrote:
> On 17/06/2011 05:10, Richard Fateman wrote:
>> On 6/15/2011 4:21 AM, Leonid Shifrin wrote:
>>> Hi David,
>>>
>>> This is a known effect. There is a special command Update, used in such
>>> cases to force Mathematica to propagate changes like the one you discuss.
>>>
>>
>> It is, in some views, an error, to define and implement a programming
>> language with a semantics that is not deterministic, but depends on (for
>> example) on the page in random access memory on which an expression is
>> stored, to tell how it will be evaluated.
>>
>> Or call Update.
>>
>> I suspect this "feature" is unique to Mathematica among programming
>> languages commercially supported.  The fact that this is "known" to some
>> people does not make it harmless. The fact that it almost never affects
>> people does not make it harmless either.
>>
> Your final comment is provably false - it is only necessary to look at
> the range of 'features' that are accessible in C, C++, or Fortran by
> accessing outside the bounds of an array! All these languages are, of
> course, commercially supported!

Using Mathematica within and according to its own defined semantics is 
non-deterministic in the sense that the same computation may follow a 
different course depending upon where in RAM an expression is stored.

  Using C within and according to its own defined semantics should be 
deterministic. Using C (or other languages) in an illegal and erroneous 
fashion, as exceeding array bounds, is an error.
The implementation is presumably not held to a standard in such a case,
since the standard does not specify the result. (Though some languages 
e.g. Java and perhaps even some implementations of C may do array-bounds 
checking when possible).

Is this also non-deterministic?  Not really -- an illegal program may 
produce results that are unspecified.

In Mathematica, a LEGAL program may produce results that are different 
when run, depending on apparently irrelevant unrelated usage of memory.

(Though DanL has clarified, in private mail, that the checking I 
referred to will not prod the activity I thought it would -- there would 
not be an extra evaluation, just more perhaps pointless checking of time 
stamps; hence the computation might merely take extra time, but should 
get the same result unless there is a time-limited wrapper around it.)

>
> In practice, I find that the exhaustive execution feature of
> Mathematica, is extremely useful, and if it is necessary to leave an
> obscure exception like this, for the sake of efficiency, well so be it.

I would guess that if the exhaustive execution model were replaced by 
"evaluate once", almost all user programs in Mathematica would run just 
the same.  Except the implementation would be simpler and probably faster.
In the few cases needing evaluation to a "fixed point", a framework for 
this could used.

Your mileage may vary.

RJF



  • Prev by Date: Re: Listbox type progress display?
  • Next by Date: Why doesn't TrueQ return True here?
  • Previous by thread: Re: Metastable expressions in Mathematica
  • Next by thread: Mathworld packages