D and InterpolatingFunction again
- To: mathgroup at yoda.physics.unc.edu
- Subject: D and InterpolatingFunction again
- From: Pekka.Janhunen at fmi.fi
- Date: Wed, 23 Jun 1993 08:50:53 -0800
I asked, > How does D handle interpolating functions? This would be > extremely useful, but I haven't been able to find out how. and Jerry Keiper replied: >In[2]:= f = Interpolation[Table[{x, Sin[x]}, {x, 0., 5., .1}]] > >Out[2]= InterpolatingFunction[{0., 5.}, <>] > >In[3]:= D[f[x], x] > >Out[3]= InterpolatingFunction[{0., 5.}, <>][x] That's nice, but actually I need that feature for 2D datasets... how about that. At least the same recipe doesn't seem to work: In[1]:= data = Flatten[Table[{x,y,Sin[x]Cos[y]},{x,0.,5.,1.},{y,0.,5.,1.}],1]; In[2]:= ff=Interpolation[data] Out[2]= InterpolatingFunction[{{0., 5.}, {0., 5.}}, <>] In[3]:= ff[2,3] Out[3]= -0.900198 In[4]:= D[ff[x,y],x] Out[4]= D[InterpolatingFunction[{{0., 5.}, {0., 5.}}, <>][x, y], x] In[5]:= Derivative[1,0][ff][2,3] (1,0) Out[5]= (InterpolatingFunction[{{0., 5.}, {0., 5.}}, <>]) [2, 3] Pekka