MathGroup Archive 2007

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

Search the Archive

Re: V6 evaluation inside Table and plot


On May 24, 6:17 am, Gerry Flanagan <flana... at materials-sciences.com>
wrote:
> Define a simple function
>
> In[7]:= f = Function[{x}, x^3]
>
> Out[7]= Function[{x}, x^3]
>
> Taking two derivatives works as it should
>
> In[2]:= f''[x]
>
> I was converting some packages to work with V6, and immediately ran into
> some evaluation issues I don't understand. It looks like forms like
> f''[x] (derivative) are evaluated differently inside of Table and Plot
> than outside.
>
> Out[2]= 6 x
>
> But this does not?
>
> In[20]:= Table[f''[x], {x, 0, 1, .2}]
>
> Out[20]= {0, 0, 0, 0, 0, 0}
>
> Strangely, this works
>
> In[4]:= Table[f'[x], {x, 0, 1, .2}]
>
> Out[4]= {0., 0.12, 0.48, 1.08, 1.92, 3.}
>
> Determining the derivative outside the Table makes it work again.
>
> In[12]:= g = f'';
>
> In[21]:= tmp = Table[g[x], {x, 0, 1, .2}]
>
> Out[21]= {0., 1.2, 2.4, 3.6, 4.8, 6.}
>
> Gerry Flanagan

Some more food for thought about the evaluator.

I had two identical names in two different contexts; one used the
other, safely, I thought. I never noticed erroneous behavior with that
call sequence in version 5.2. Not so in version 6. I had to eliminate
one of the names to successfully run essentially the same code. (Sorry
that I can't report more detail on this.)

This makes me wonder if there has been an important invisible change
in Mathematica's evaluator, that is catching "non-compliant" code.

Perhipherally related to this peripheral is my frequent use of
relative names, that begin with a context mark. I find they interfere
with the Workbench editor parser (mouseovers on relatively-defined
names don't give usage messages), and likely the new package editor
(can't jump to any function names---relative names are present---still
need to disambiguate). The name resolution I allude to above depended
on relative names.

Vince Virgilio



  • Prev by Date: Re: Re: Mathematica 6.0 easier for me ... (small review)
  • Next by Date: Re: prolog like search
  • Previous by thread: Re: V6 evaluation inside Table and plot
  • Next by thread: Re: V6 evaluation inside Table and plot