# How to calculate the derivative of a non-linear function having its points

I''m not a mathematical guy at all. I have the points of a non-linear function and I would love to know if it's possible to find a way (an algorithm or whatever) to calculate the derivative of the function at each point.

EDIT: The function could be something like the black line (it's the sensor data averaged and filtered)

-
Which nonlinear function? – J. M. Oct 9 '11 at 15:42
It's the data coming from a temperature sensor – Ignacio Soler Garcia Oct 9 '11 at 15:45
It might be helpful if you can include a scatter plot of your data... – J. M. Oct 9 '11 at 15:47
Yikes. I presume the samples are at equally-spaced intervals? – J. M. Oct 9 '11 at 16:09
@SoMoS,"The listtoratpoly(l, x, [typelist]) command computes a rational function in x for the generating function of the expressions in l.",so input is list of points and output is function which best describes graph line.I think that there is no such function that can predict the next random value of the point..because random value is undefined by definition – pedja Oct 9 '11 at 17:45

there is a so called "The Chain Rule" which helps to generate a very special function. this function will magically give you derivative of any point on your curve. but first, you must understand that your big function is a combination of many other child functions so you may have to learn how to decompose your wave into smaller ones.

i know it sounds strange but any nonlinear (distorted ) waveform contains many thousands of linear waveforms.these little guys live within your chaotic waveform. its because of them, your chaotic waveform exists. they feed it.they are called harmonics. thanks god harmonic is always linear. if you could extract all the harmonics from your waveform, they will give you their own functions. but before you dive into slope analysis you must recreate one big function which will combine all the harmonics and that gives you function of your chaotic waveform. im learning that right now sorry if i give non correct information i simply don't know myself; there is a special section in math for this. it's called fourier series. fourier series allows you to do exactly what i told you.

-

One way is to create the function that could generate your points in the form of F(X)=some expression depending on X.

There are different ways to generate such functions, for example the least square methods (already built in Excel for example).

One you know the function, you could calculate the derivative at any point assuming that the function is continuous at that point.

Given the points (1,1) , (1,8) , (1, 27) you can see that F(X)=X*X*X and its derivative is 3*X*X so the derivative at x=1 is 3*1*1.

The problem here is that since there are many methods to obtain the original function, there will be a derivative for each generated function that may or may not all yield the same result.

Edit There is another approach to calculate first derivative numerically without knowing the exact function - Please see: http://www.math.montana.edu/frankw/ccp/modeling/continuous/heatflow2/firstder.htm

-
Thanks. The function is the data coming from a temperature sensor so its continuous everywhere – Ignacio Soler Garcia Oct 9 '11 at 15:47
That bit you linked to is good if the points are error-free. For data from real-world measurements that are error-contaminated, difference estimates of the derivative can be quite off. One usually applies some smoothing process first (e.g. least-squares) and then differentiates afterwards. – J. M. Oct 9 '11 at 16:01
@J.M. thanks for the hint. Very valid. – NoChance Oct 9 '11 at 16:43