Trying to determine the relative position and velocity for a NEO can be difficult if there is curvature present in the object's 3D track. The fit may need to be extended to higher degree polynomials. The polynomial is a function of time and since we are working in 3D the coefficients will be vectors. The computed position for the object has to be the same as the observer's position in three dimensions plus a distance λk along the observer's line of sight. Using the Method of Least Squares from the Calculus of Variations one can set the deviation for the observation equal to the difference between the two expressions for the position. It is a vector and the variance which is the sum of the magnitude of each deviation is minimized. For the best fit the change in the variance is zero for a change in any of the coefficients. This assumption allows us to derive a set of normal equations whose solutions will give us the coefficients. An expression for the unknown distance along the line of sight can be found by solving the equalent expressions for the position for each observation separately.
The normal equations are similar to those for polynomial fits used for simple linear regression with an additional projection operator in the sums that is a result of only using sighting directions and not distances. Since the coefficients are vectors the normal equations that result involve the sum of the sum of the product of a set of matrices and the coefficients. In the sum p ranges from 0 to the highest degree of the polynomial. For a quadratic fit C0 would be the initial position of the object, C1 would be the velocity and C2 would be half the acceleration. The normal equations can be solved by merging the separate matrices into a single matrix and the vectors into a single vector and the resulting equation can be solved in the usual way. The coefficients can be separated afterwards. More accurate observations and a greater number of observations will give a better fit.
Supplemental (Jan 29): Virtual displacements are used in Lagrangian mechanics and the Calculus of Variations but minima problems are much older. Hero of Alexandria proved that light reflecting from a mirror takes a minimum path.