MathGroup Archive 2008

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92451] 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:55:23 -0400 (EDT)
  • References: <gbt2oo$lbo$1@smc.vnet.net> <48E22E69.7060700@gmail.com>

On Tue, Sep 30, 2008 at 4:45 PM, E. Martin-Serrano
<eMartinSerrano at telefonica.net> wrote:
> Hi,
>
> This corresponds to the run in my version 6.0.1. Perhaps the source of the
> problem is a bug in this version. This happens to occur with David Park's
> Presentations package too.
>
> In[1]:= f[x_] := -20 x^3 + 3 x^5
> In[2]:= g = Function[x, -20 x^3 + 3 x^5]
> Out[2]= Function[x, -20 x^3 + 3 x^5]
> In[3]:= Function[x, -20 x^3 + 3 x^5]
>
> Out[3]= Function[x, -20 x^3 + 3 x^5]
> In[4]:= Plot[g''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue] ===
>  Plot[f''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue]
>
> Out[4]= False
> In[5]:= $Version
> Out[5]= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

Yes, it seems to be platform dependent.

  In[1]:= f[x_] := -20 x^3 + 3 x^5
            g = Function[x, -20 x^3 + 3 x^5];
            Plot[g''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue] ===
             Plot[f''[x], {x, -2 Pi, 2 Pi}, PlotStyle -> Blue]
           $Version

  Out[3]= True

  Out[4]= "6.0 for Mac OS X x86 (64-bit) (May 21, 2008)"

Regards,
-- Jean-Marc

P.S. I have sent by private email a PDF file showing the evaluation of
the code below.

> -----Original Message-----
> From: Jean-Marc Gulliet [mailto:jeanmarc.gulliet at gmail.com]
> Sent: martes, 30 de septiembre de 2008 14:49
> To: E. Martin-Serrano; mathgroup at smc.vnet.net
> Subject: Re: Plotting f = Function[x,expr] and f[x_] := expr
>
> 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
>
>



-- 
Jean-Marc


  • Prev by Date: Re: Plotting f = Function[x,expr] and f[x_] := expr
  • Next by Date: Re: Nested DynamicModule and EventHandler
  • Previous by thread: Re: Plotting f = Function[x,expr] and f[x_] := expr
  • Next by thread: command line options: -initfile vs -run