# Compute numerical derivative for first and last points

Considering a centered finite difference approximation for the derivative, what is a reasonable approximation for the first and last points?

• I have rewritten your question. Please check that I didn't change what you meant. Jun 23 at 19:12
• I think it means the same, thanks for the edit. Jun 23 at 19:14
• What is reasonable depends on what you want. So what is your application? Jun 23 at 21:38
• I am analyzing the first and second derivatives to find knee point in a 2D curve. Jun 23 at 21:48

## 1 Answer

Given that you are using center difference formula to to get second order derivatives in your domain. The common practice at the ends is to use forward and backward difference formula ( start and end ) . Again this strictly depends on the nature of your problem and what you consider as reasonable approximation

• That is indeed a possibility, and I have already tried that but the estimation of these values was poor. I also tough on simply copying the second and second to last values to the first and last position respectively Jun 24 at 14:55
• is that a time-dependent problem or a stationary problem ? that you are trying to solve Jun 28 at 13:34
• I am not sure how to answer that, so I am going to try to describe the problem. Consider a 2D curve defined by a set of points (x,y), usually, these points define one performance metric (for example cluster aggregation metric) the idea is to analyse the derivatives to find the knee/elbow points. There is no constraints regarding the spacing between the x points. Jun 28 at 15:00
• But your suggestion worked, when I used the LaGrange 3 point derivative to compute the derivative on uneven time series. After that change, the first and last points were computed correctly. Jun 28 at 15:02
• Glad you found it helpfull Jun 28 at 15:55