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

  • Context: Undergrad 
  • Thread starter Thread starter Curl
  • Start date Start date
Click For Summary
SUMMARY

The most efficient way to approximate the derivative of discrete data involves fitting a parabola through three points and differentiating the resulting equation. The equation ax² + bx + c = y leads to a 3x3 matrix that can be solved for coefficients a, b, and c. However, since the constant c is not needed for the derivative, it is computationally advantageous to explore methods that eliminate its calculation. The Lagrange interpolation formula provides a polynomial that can be used for derivative approximation, but simpler methods like midpoint approximation are often more effective, especially when higher-order polynomials introduce complexity.

PREREQUISITES
  • Understanding of polynomial equations and derivatives
  • Familiarity with matrix operations and solving systems of equations
  • Knowledge of interpolation methods, specifically Lagrange interpolation
  • Basic calculus concepts, particularly finite difference methods
NEXT STEPS
  • Study Lagrange interpolation formula in detail
  • Learn about finite difference methods for derivative approximation
  • Explore polynomial fitting techniques and their computational implications
  • Investigate the behavior of high-order polynomials in numerical analysis
USEFUL FOR

Mathematicians, data scientists, and engineers involved in numerical analysis, particularly those working with discrete data and derivative approximations.

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?
 
Physics 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
[tex]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)}[/tex]
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:
[tex]f'(x)\approx \frac{f(x_3)-f(x_1)}{x_3-x_1}[/tex]
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 40 ·
2
Replies
40
Views
7K
  • · Replies 7 ·
Replies
7
Views
2K