D and InterpolatingFunction
- To: mathgroup at yoda.physics.unc.edu
- Subject: D and InterpolatingFunction
- From: TDR at vaxc.cc.monash.edu.au
- Date: 25 Jun 1993 13:57:34 +1100
Pekka Janhunen asks: >How does D handle interpolating functions? This would be extremely useful, >but I haven't been able to find out how.. is it a new feature in 2.2? InterpolatingFunction's are returned by several commands including NDSolve[], and being able to differentiate them is indeed very useful. The feature was there even in 2.0 I think. In[1]:= ans=NDSolve[{y''[t]==Sin[y[t]], y[0]==Pi/4, y'[0]==0}, y, {t,0,10}][[1]] Out[1]= {y -> InterpolatingFunction[{0., 10.}, <>]} In[2]:= Plot[ Evaluate[y[t] /. ans], {t,0,10} ] Out[2]= -Graphics- In[3]:= Plot[ Evaluate[y'[t] /. ans], {t,0,10} ] Out[3]= -Graphics- In[4]:= Plot[ Evaluate[y''[t] - Sin[y[t]] /. ans], {t,0,10} ] Out[4]= -Graphics- Also D[y[t] /. ans, t] etc works too. Terry Robb