       Re: V6 evaluation inside Table and plot

• To: mathgroup at smc.vnet.net
• Subject: [mg76673] Re: V6 evaluation inside Table and plot
• From: dh <dh at metrohm.ch>
• Date: Fri, 25 May 2007 06:46:00 -0400 (EDT)
• References: <f33onq\$l4v\$1@smc.vnet.net>

```
Hi Gerry,

this is an ugly trap you encoutered. Consider: Attributes[Table] and you

will see that Table has the Attribute HoldAll. That means f'' is not

evaluated before beeing fed to Table. Now Table seems to have a small

brain damage, because it does the derivative wrong. You can see this from:

Table[f''[y], {y, 3, 3, 1}] // Trace

why this happens I can not tell, but I assume there is some confusion

between variables local to Function and Table. Please inform Wolfram

hope this helps,Daniel

Gerry Flanagan wrote:

> Define a simple function

>

> In:= f = Function[{x}, x^3]

>

> Out= Function[{x}, x^3]

>

> Taking two derivatives works as it should

>

> In:= 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= 6 x

>

> But this does not?

>

> In:= Table[f''[x], {x, 0, 1, .2}]

>

> Out= {0, 0, 0, 0, 0, 0}

>

> Strangely, this works

>

> In:= Table[f'[x], {x, 0, 1, .2}]

>

> Out= {0., 0.12, 0.48, 1.08, 1.92, 3.}

>

> Determining the derivative outside the Table makes it work again.

>

> In:= g = f'';

>

> In:= tmp = Table[g[x], {x, 0, 1, .2}]

>

> Out= {0., 1.2, 2.4, 3.6, 4.8, 6.}

>

> Gerry Flanagan

>

```

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