Knot selection


Csagrid uses cubic splines to calculate its approximations. These cubics are joined together at specified points and, at these join points, satisfy various continuity conditions. The points where the cubics join are called knots.

All entries in the Csagrid package have a parameter that designates the number of knots to use in each of the coordinate directions. The package automatically spaces the knots evenly from the minimum value to the maximum value in each coordinate direction. In each coordinate direction, the number of knots must be at least 4 and at most equal to the number of input data values. The more knots that are specified, the closer the approximation will fit the original data, at the expense of compute time. See the plot for Example 1 for an illustration of how the number of knots affects an approximated curve. See the timing table for how the number of knots affects compute time.

Weighting the input values

For the expanded entries of the Csagrid package, you can assign a weight to each input datum based on the degree of confidence you have in its value. The weights assigned are relative and may be set to any non-negative value. When the desired approximation function is called, the weights are summed and the individual weights are normalized so that the weight sum is unity. By default all weights are unity. For an example of the effect of weighting the input data, see the plot for Example 2.

Extrapolation in data sparse regions


It can happen that, in certain regions, the input data will be unequally spaced to the point where insufficient data can create an approximating curve or surface with an unexpected oscillation in it. The top curve in the plot for Example 3 illustrates this. If the data insufficiency is too great, the algorithm will actually issue an error and terminate.

The entries in the expanded interface of Csagrid contain a parameter to control extrapolation to data sparse regions. If this parameter is set to a positive value, certain derivative constraints are used to extrapolate into data sparse regions before the approximation function values are calculated. This tends to smooth out the unexpected oscillations (larger values for the extrapolation parameter yield greater smoothing, but frequently the differences are subtle). The bottom curve in the plot for Example 3 illustrates setting the extrapolation parameter to "1." and offers a comparison with a curve produced using the same input data, but without the extrapolation parameter set (the top curve in the plot for Example 3).

The practical implication of this is that if you see an unexpected oscillation in your output curve or surface, analyze whether that is occurring in a data sparse region and, if so, set the extrapolation parameter to a positive value (experience has indicated that choosing "1." is a good start) and see if the result is more reasonable.

Note: Extrapolating into data sparse regions greatly alters the computation of first and second derivatives to the point where they are effectively meaningless.

Derivatives


The expanded Csagrid entries allow for the computation of partial derivatives in any of the dimensions. Only first and second order derivatives in any dimension will have meaning, since the approximating function is a cubic spline and all derivatives of third degree or higher will be zero. Assumed boundary conditions may degrade the accuracy of first and second derivative calculations near the boundaries.
home | contents | defs | procedures | examples | errors