What is the most efficient way to approximate the derivative of discrete data?

  • Thread starter Thread starter Curl
  • Start date Start date
AI Thread Summary
To approximate the derivative of discrete data, a method involving fitting a parabola through three points and differentiating it is discussed. The approach leads to a realization that the constant term in the parabola's equation is unnecessary for calculating the derivative, prompting a search for a more efficient method. Lagrange interpolation is suggested as a way to construct a polynomial that passes through the points, but it may not yield better results than simpler methods. Using a midpoint approximation or difference methods is recommended for better performance, especially as the number of points increases. Overall, while polynomial fitting can be insightful, it may not always be the most effective approach for derivative approximation.
Curl
Messages
756
Reaction score
0
So I was trying to do this:

I want to approximate derivative of some discrete data, so I pick a point, then pick 2 other points, one on the right, and one on the left. I fit a parabola, and then differentiate the equation of the parabola with respect to X and evaluate it at the middle point.

So, I have (x1,y1), (x2,y2), (x3,y3)

The parabola equation, ax2+bx+c=y gives a 3x3 matrix to solve:

|x12 x1 1| |a|
|x22 x2 1| |b| = [y1, y2, y3]T
|x32 x3 1| |c|

Then I find the equation that goes through the three points: ax2+bx+c=y. I take derivative and evaluate dy/dx at x2. This gives dy/dx = 2ax2+b
What? The constant C is not needed at all. So is there any way to reduce the matrix so that it won't have to solve for c, which will get thrown out anyways? It is computationally cheaper, and it seems like a waste to perform useless calculations.

I suck at math so I couldn't figure out what to do here, I'm sure there's a better method but this little paradox strikes me. Anyone know what's going on?
 
Mathematics news on Phys.org
I haven't looked at the question in detail, but I suspect that you could set the problem up in terms of the differences between the points.
 
Probably the fastest way to get the unique polynomial of degree at most n passing through n+1 points with different x values is the Lagrange interpolation formula:
http://en.wikipedia.org/wiki/Lagrange_interpolation
the idea is to come up with a polynomial for each point where pi(xi)=yi for point i, and pi(xj)=0 for j not equal to i. Then you add all of these polynomials together in the end to get the answer you want. So in this case you would get
p(x)=y_1\frac{(x-x_2)(x-x_3)}{(x_1-x_2)(x_1-x_3)}+y_2\frac{(x-x_1)(x-x_3)}{(x_2-x_1)(x_2-x_3)}+y_3\frac{(x-x_1)(x-x_2)}{(x_3-x_1)(x_3-x_2)}
And you can find the derivative of this pretty easily. But this is generally not an especially good way to calculate a derivative if you don't know that you have a parabola. The behavior of the parabola passing through a set of points is specific to that type of curve, so implementing the somewhat complicated expression you get at the end won't give you a systematic improvement over a simple midpoint approximation:
f'(x)\approx \frac{f(x_3)-f(x_1)}{x_3-x_1}
If you go to a higher number of points and use a higher order polynomial, the performance will become very strange because the high order polynomials that solve these equations can be very complicated and have critical points in unexpected places. Using difference methods is generally preferred.
 
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...

Similar threads

Back
Top