Modeling a derivative such as velocity or acceleration
Originally posted on 6/28/13
Eureqa can automatically estimate numerical derivatives in order to model the rates of change of variables in your data. Often derivatives are more natural and simpler for modeling certain types of phenomena, particularly in physics. This post discusses the basics of entering derivatives into the Eureqa search relationship.
The derivative operator
Eureqa provides the derivative operatorD(x, y, n) wherex andy are any arbitrary expressions and n is an integer representing the order of the derivative to take. This operator can be used in the Search Relation setting. For example, consider the search relationship:
D(x,t,1) = f(x,t)
This relation tells Eureqa to find a function ofxthat models the first derivative (e.g., a velocity or slope) ofx with respect tot. Shorthand for the first derivative isD(x,t). The derivative operator can also appear inside the formula as an input variable, for example:
D(x,t,2) = f( x, D(x,t) )
This relation tells Eureqa to find a model of the second derivative (e.g., an acceleration or curvature) ofx with respect tot, as a function ofx and the first derivative ofx. In Eureqa, this relation will appear as:
Eureqa displays the derivatives in mathematical format after the relationship text is entered.
Alternatively, you could estimate the numerical derivatives ahead of time using another program, and enter these values as a new variable in the dataset rather than using Eureqa’s derivative operator.
Starting the Search
Eureqa will calculate the numerical derivatives that appear in your search relation when you start the search. The following screen will appear after you click start:
Eureqa estimates the numerical derivative using a spline fit to the data. This allows more accurate derivative estimates than other methods in case the data contains noise.
Estimating numerical derivatives accurately is a challenging task when the data is sparse or contains noise. Eureqa’s derivative estimation is an improvement over the most basic methods like Newton’s difference quotient; however, it does not work well in all cases.
One particular problem with spline curves is their accuracy at the head and tail of the data—these points are “surrounded” by fewer data points and thus have higher estimation error. If you can, you might want to ignore these points entirely by using a weight variable. Simply add a new column to your data, and set the weight to 1 for all data points but near zero for the first and last five to ten data points.
It may also be worth the effort to estimate the numerical derivatives outside of Eureqa using more specialized tools. For example, you may want to compute the derivative values in R or using MATLAB's spline toolbox, and then paste these into Eureqa as a new column variable.