Re: how can one use mathematica get the approximate derivative of {x,y} data points?
- To: mathgroup at smc.vnet.net
- Subject: [mg124272] Re: how can one use mathematica get the approximate derivative of {x,y} data points?
- From: Michael Stern <nycstern at gmail.com>
- Date: Sun, 15 Jan 2012 04:50:05 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201201140753.CAA01265@smc.vnet.net>
Mathematica will cheerfully take derivatives of InterpolationFunctions. In[1]:= data = {{0.03512, -0.5}, {0.0351181, -0.499}, {-.05, 1}, {0, 9}, {-0.113972, 0.699}, {-0.115072, 0.7}}; In[2]:= ifun = Interpolation[data] You may want to play with the InterpolationOrder in step 2, but something along these lines should work. You can sanity check the results with a graph of this sort: In[3]:= Plot[{ifun'[x], ifun[x]}, {x, -.115, .15}, PlotRange -> All] And if you want the answer as a table of points rather than a continuous function, you can produce such a table with In[4]:= Table[{x, ifun'[x]}, {x, -.115, .15, .005}] or the equivalent. Cheers, Michael Stern On Jan 14, 2012, at 2:53 AM, Michael B. Heaney wrote: > Hi, > > I have a set of {x,y} data points: > > {{0.03512, -0.5}, {0.0351181, -0.499}, ... {-0.113972, 0.699}, {-0.115072, > 0.7}} > > These data points look like a function y=f(x) when plotted on the x-y axes. > However, I do not know what the function f(x) is. But I need to get the > approximate derivative df/dx, as another set of data points. How can one > use Mathematica to do this? > > Thanks, > > Michael > > --
- References:
- how can one use mathematica get the approximate derivative of {x,y} data points?
- From: "Michael B. Heaney" <mheaney@alum.mit.edu>
- how can one use mathematica get the approximate derivative of {x,y} data points?