RE: Derivative of a List
- To: mathgroup at smc.vnet.net
- Subject: [mg42281] RE: [mg42277] Derivative of a List
- From: "Florian Jaccard" <jaccardf at eicn.ch>
- Date: Fri, 27 Jun 2003 06:31:13 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello ! You can use the numerical differentiation formulas : v'(t)=(v(t+h)-v(t))/h + 0(h) This is a good approximation if differnces of t's are small and irregular. 1) If the list of t is not regular : liste = {{0., 2.}, {1., 2.5}, {2., 3.2}, {2.8, 3.6}}; numder[i_] := (liste[[i + 1,2]] - liste[[i,2]])/ (liste[[i + 1,1]] - liste[[i,1]]) vprime = Join[Table[numder[i], {i, 1, Length[liste] - 1}], {numder[Length[liste] - 1]}]; TableForm[Transpose[Join[Transpose[liste], {vprime}]], TableHeadings -> {{}, {"t", "v(t)", "v'(t)"}}] If the intervals of t are regular, it is better tu use : v'(t)=(v(t+h)-v(t-h))/(2h)+ 0(h^2) 2) If the list of t is regular : In[7]:= liste = {{0., 2.}, {1., 2.5}, {2., 3.2}, {3., 3.6}}; In[8]:= betterNumder[i_] := (liste[[i + 1,2]] - liste[[i - 1,2]])/(liste[[i + 1,1]] - liste[[i - 1,1]]) In[9]:= vprime = Join[{numder[1]}, Table[betterNumder[i], {i, 2, Length[liste] - 1}], {numder[Length[liste] - 1]}]; In[10]:= TableForm[Transpose[Join[Transpose[liste], {vprime}]], TableHeadings -> {{}, {"t", "v(t)", "v'(t)"}}] 3) If you have a lot of regular values, you can use the very good Richardson formula : v'(t)=(8*(v(t+h/2)-v(t-h/2))-v(t+h)+v(t-h))/(6h) + 0(h^4) Greetings F.Jaccard -----Message d'origine----- De : ch akpovo [mailto:akpovo at cennas.nhmfl.gov] Envoyé : jeu., 26. juin 2003 11:36 À : mathgroup at smc.vnet.net Objet : [mg42277] Derivative of a List Hello, I created a two columns table from experimental data say v (t) and would like to compute the derivatives. How do I proceed. Thanks