Re: Plotting f = Function[x,expr] and f[x_] := expr

*To*: mathgroup at smc.vnet.net*Subject*: [mg92425] Re: Plotting f = Function[x,expr] and f[x_] := expr*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Tue, 30 Sep 2008 21:50:32 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <gbt2oo$lbo$1@smc.vnet.net>

E. Martin-Serrano wrote: > Hi, > > Why this apparent estrange behavior while plotting functions under the > formats f[x_] := -20 x^3 + 3 x^5 and f = Function[x, -20 x^3 + 3 x^5]?, > > In particular the second derivative f ''[x] for -20 x^3 + 3 x^5 fails to > render the shame shape in following examples . Please, see below: FWIW, to me as well as for Mathematica 6.0.3 on 64-bit Intal Mac OS X 10.5.5, the plots are identical in each case. In[123]:= Clear[f, x] f[x_] := -20 x^3 + 3 x^5 pp1 = Plot[f[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Red] pp2 = Plot[f'[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Green] pp3 = Plot[f''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue] pp4 = Plot[{f[x], f'[x], f''[x]}, {x, -2 Pi, 2 Pi}, PlotStyle -> {Red, Green, Blue}, PlotRange -> {{-6.28318, 6.27681}, {-14129, 14084}}] Clear[f, x] f = Function[x, -20 x^3 + 3 x^5]; p1 = Plot[f[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Red] p2 = Plot[f'[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Green] p3 = Plot[f''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue] p4 = Plot[{f[x], f'[x], f''[x]}, {x, -2 Pi, 2 Pi}, PlotStyle -> {Red, Green, Blue}, PlotRange -> {{-6.28318, 6.27681}, {-14129, 14084}}] p1 === pp1 p2 === pp2 p3 === pp3 p4 === pp4 Out[135]= True Out[136]= True Out[137]= True Out[138]= True In[139]:= $Version Out[139]= "6.0 for Mac OS X x86 (64-bit) (May 21, 2008)" Regards, -- Jean-Marc