Re: derivative of cubic spline
- To: mathgroup at smc.vnet.net
- Subject: [mg66563] Re: derivative of cubic spline
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 20 May 2006 04:47:12 -0400 (EDT)
- References: <e4ju6v$d56$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
An other possibility - independent of the structure of a SplineFunction - is: idata=Transpose[spline/@(tvec=Table[t,{t,0,6,1/8}])]; f[x_]=Through[(Interpolation[Transpose[{tvec,#}]]&/@data)[x]]; builds an interpolating function, which can differentiate: ParametricPlot[{f[t],f'[t]},{t,0,6},PlotStyle->{Black,Red}] Peter Jaccard Florian schrieb: > Dear All, > > I would like to know how to derivate a spline function constructed by > Mathematica. > > The question has already been posted in : > First derivative of interpolated spline > > But I wasn't able to find an answer in mathgroup. > > Example : > > > data={{0, 1}, {1, 2.3}, {2, 2.5}, {3, 1.2}, {4, 0.47}, > {5, 0.38}, {6, 0.76}} > > << "Numericalmath`SplineFit`" > > s = SplineFit[data, Cubic]; > > You can see that the spline is good : > > ParametricPlot[s[x], {x, 0, 6}, PlotStyle -> Blue, > Epilog -> {{Blue, Text[HoldForm[y = s(x)], > {2.5, g1[2.5]}, Background -> White]}, > ({PointSize[0.03], Red, Point[#1]} & ) /@ data}, > PlotRange -> {-0.5, 3}, TextStyle -> > {FontFamily -> Times}]; > > But D[s[t],t] or s'[t] or so one doesn't help... > So I'm not able to see that the spline is better than Interpolation (in > the sense of a continuous derivative)! > > Please help! > It's the first time I found something that is easier in MathCad than in > Mathematica... > > Regards > > F.Jaccard > florian.jaccard at he-arc.ch > >