Re: question

*To*: mathgroup at smc.vnet.net*Subject*: [mg4098] Re: question*From*: rhall2 at umbc.edu (hall robert)*Date*: Tue, 4 Jun 1996 02:17:59 -0400*Organization*: University of Maryland, Baltimore County*Sender*: owner-wri-mathgroup at wolfram.com

In article <4obem1$na9 at dragonfly.wolfram.com>, Zvi Wiener <mswiener at pluto.mscc.huji.ac.il> wrote: >I think there is something strange in the following lines: > >In[]:= >yy[x_]:=Max[ x-1, 0]; >D[ yy[x], x]/.x->2 > >Out[]:= > (0,1) >Max [0, 1] > > >However > >In[]:= >D[Sin[x], x]/.x->2 > >Out[]:= >Cos[2] > >Of course the function Max is not everywhere differentiable, but I would >expect to get something like step function and at least value 1 at the point >where the function is smooth. > >How I can avoid the trouble of defining the derivative of Max? Is the >problem only with evaluating the expressoin before differentiating or it is >general property of dealing with not every where differentiable functions? According to The Book, Mathematica tries to find an explicit value for a derivative. The derivative of the sine is the cosine, and Cos[2] is an explicit value. The derivative of Max[] has no corresponding function, so Mathematica treats it as it would g[x - 1, 0]. Try the following: In[17]:= Max[D[x - 1, x], 0] /. x -> 2 Out[17]= 1 This allows Mathematica to take a derivative it can find a value for. -- Bob Hall | "Know thyself? Absurd direction! rhall2 at gl.umbc.edu | Bubbles bear no introspection." -Khushhal Khan Khatak ==== [MESSAGE SEPARATOR] ====