Differentiation and evaluation of function

*To*: mathgroup at smc.vnet.net*Subject*: [mg75041] Differentiation and evaluation of function*From*: "Apostolos E. A. S. Evangelopoulos" <a.e.a.evangelopoulos at sms.ed.ac.uk>*Date*: Sun, 15 Apr 2007 05:08:03 -0400 (EDT)

In spite of this problem's apparent simplicity, I cannot find an answer to what goes wrong: I begin by declaring a function f[x_] and defining its derivative function y[x_], then ask for an evaluation of 'y' for two simple arguments, one being the variable 'x,' the other a number. Evaluation of y['number'] is impossible and implies that there is something inherently different about the functions 'f' and 'y,' since f['number'] is not a problem, while y['number'] is! My inputs/outputs, in particular, are the following: In[1]:= f[x_]:=3 x^2 In[2]:= ?f Global`f f[x_]:=3 x^2 In[3]:= y[x_]:= D[f[x], x] In[4]:= ?y Global`y y[x_]:='partial d sub[x]' f[x] In[5]:= f[3] Out[5]:= 27 In[6]:= y[x] Out[6]:= 6 x In[7]:= y[3] General::ivar : 3 is not a valid variable Everything above seems reasonable with the exception of the last input. This feels even more confusing if one thinks that the general method has worked for me, yet with much more complicated functions, for which Mathematica has no problem perfoming both symbolic and numerical evaluations! I hope someone can enlighten this mystery! Many thanks, Apostolos