I want to take the second derivative of a set of data points (at the point $x = 0$). Let's assume that this set looks like that
{{0, 1}, {5/999, 0.999925}, {5/333, 0.9997}, {25/999, 0.999325}, {35/
999, 0.998801}, {5/111, 0.998127}, {55/999, 0.997305}, {65/999,
0.996335}, {25/333, 0.995217}, {85/999, 0.993952}, {95/999,
0.992542}, {35/333, 0.990986}, {115/999, 0.989287}, {125/999,
0.987444}, {5/37, 0.98546}, {145/999, 0.983336}, {155/999,
0.981073}, {55/333, 0.978672}, {175/999, 0.976136}, {5/27,
0.973465}, {65/333, 0.970662}, {205/999, 0.967728}, {215/999,
0.964665}, {25/111, 0.961475}, {235/999, 0.95816}, {245/999,
0.954722}, {85/333, 0.951163}, {265/999, 0.947486}, {275/999,
0.943692}, {95/333, 0.939783}, {295/999, 0.935763}, {305/999,
0.931632}, {35/111, 0.927395}, {325/999, 0.923052}, {335/999,
0.918607}, {115/333, 0.914062}, {355/999, 0.909419}, {365/999,
0.904682}, {125/333, 0.899851}, {385/999, 0.894931}, {395/999,
0.889923}}
One possibility would to take a function and fitting it to the data set. After that I could take the second derivative at $x=0$. But there the question arises, which function one should take.
Is there any Mathematica routine which can do this "Derivation of numerical data" by its own?
Edit: Thanks for your answers. My problem is probably a bit more advanced, because I'm going to add Gaussian noise to the data. This results in the new data set:
lst = {{0, 1}, {5/999, 0.9997470723678498`}, {5/333,
0.9998479841238097`}, {25/999, 0.9953393855010988`}, {35/999,
0.9981898503272589`}, {5/111, 0.9974638849540485`}, {55/999,
0.9971895950455869`}, {65/999, 0.9951395169325857`}, {25/333,
0.988116112128079`}, {85/999, 0.9925548979371955`}, {95/999,
0.9852737364775073`}, {35/333, 1.000135408043998`}, {115/999,
0.9945341860655752`}, {125/999, 0.9886336384450369`}, {5/37,
0.9931098663739206`}, {145/999, 0.9824257991680876`}, {155/999,
0.9859582499945159`}, {55/333, 0.9850262632503664`}, {175/999,
0.9670026311764188`}, {5/27, 0.9516452584645868`}, {65/333,
0.9492761241829594`}}
By using this set, "Interpolation" and a fit with a polynomial fit of degree 4 fails. Do you have any idea how to handle this?
Interpolation
? Possible duplicate of mathematica.stackexchange.com/q/14023/131 and/or mathematica.stackexchange.com/q/10986/131 (amongst others). $\endgroup$NDSolve`FiniteDifferenceDerivative
. See for example mathematica.stackexchange.com/q/31832 or The Numerical Method of Lines for more. $\endgroup$(y2-y1)/(x2-x1)
and you add toy2
andy1
some different random numbers. The derivative takes the form:(y2+dy2-y1-dy1)/(x2-x1)
. Then everything depends upon the ratiosdy2/y2
anddy1/y1
. It is still worse with the second derivative. $\endgroup$