Curl
- 756
- 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?
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?