I have a query on numerical differentiation that's beyond the language used. Suppose I have an array of n points x and f(x) and I want to take the first derivative of f(x). Every method will consume points making the derivative array shorter than the function, so how can a "lengthen" the array in a smart way. For example I want to take the derivate using the Five-point stencil, that is
f'(0) = 1/12 h (-f(-2) + 8 f(-1)- 8 f(1) + f(2))
where f(n)
is the function evaluated at the n-th point. So with this method the f'
array is shorter by 4 points. How can I lengthen this array in a smart way and if it's possible in a way that produces an error similar as this 5 point stencil method?