How to create a derivative function in R

Viewed 11

Let us say I have an output data that is composed of a vector with 10 elements. I interpolated these data via spline interpolation using R command splinefun, this helped me obtain a function interpolation (cubic spline) that can take any real number within the domain x that produces the output f(x) that lies on this spline curve.

My question, from f which is now a function how can we create a derivative function in R? It is like I want to interpolate over the derivatives.

The package numDeriv allowed me to write d_f <- genD(func = f, x = x)$D[1] but this is not helping. I hope someone can help me.

0 Answers
Related