QUOTE:
a 7th order polynomial curve fitting equation to model a stock
Some numerical analysis comments:
1) For a 7th-order polynomial, you should be prepared to deal with complex conjugate roots. I think Math.Net's routines may let you restrict the fit to real roots, but I don't have any experience doing that.
2) Although we would prefer to forget (Ha, ha.), but we are fitting a fuzzy-system price model here. Having said that, trying to extract precision out of a fuzzy system (say with a 7th-degree fit) is going to be problematic. If all you want to do is fit the price behavior to a "streaming fit", you might consider a quadratic or cubic spline fit instead.
A spline is a running set of end-to-end equations. For example, Postscript fonts are defined by cubic splines. Basically, the fonts are defined as individual points in 2D-space that a connected together with cubic polynomials (splines) from end-to-end. Take a look a Math.Net's interpolation routines if you might be interested in quadratic or cubic spline fits.
https://numerics.mathdotnet.com/api/MathNet.Numerics.Interpolation/index.htmI don't think the spline fits will deliver fit statistics directly, but you can certainly subtract the spline fit from the raw price to get a residual DataSeries, then perform statistics on those residuals with the
https://numerics.mathdotnet.com/api/MathNet.Numerics.Statistics/RunningStatistics.htm library.
If your goal is to incorporate a "predictive stochastic model" (Is it?), then you should look at Wealth-Lab's Kalman indicator.
http://www2.wealth-lab.com/WL5Wiki/Kalman.ashx The generalize Kalman filter is designed to handle a
system of predictive equations. Unfortunately, the financial sector is only using one predictive equation right now in their Kalman solution, which is the Taylor series of the stock price (price [0th-order], price velocity [1st-order], and price acceleration [2nd-order] terms). But one can always code more predictive equations. :-)