Univariate Data Functions

This page describes **AMA Spline Library** functions which compute spline approximations and interpolants of independent variable data and dependent variable data .

The data is given as , for , and the spline approximation is given as

where , for , are the coefficients of the univariate B-splines of degree defined by the knot vector . The knot vector is

where the number of B-spline coefficients and , for , depend on the method employed to approximate the data. The five methods available in the **AMA Spline Library** are **Least Squares Approximation**, **Approximation**, **Interpolation**, **Monotonic Approximation** and **Monotonic Interpolation**. For **Interpolation** and **Monotonic Interpolation** the independent variable data and the dependent variable data , for , is required. For a **Least Squares Approximation** the weights , for , and the knots , for , are required along with the independent and dependent variable data. And, for **Approximation** and **Monotonic Approximation** the approximation tolerances , for , are required in addition to the independent and dependent variable data. These five approximation and interpolation methods are provided by the following **AMA Spline Library** functions:

- AMA_UnvLstsqr() -
**Least Squares Approximation of Univariate Data** - AMA_UnvApprox() -
**Approximation of Univariate Data** - AMA_UnvInterp() -
**Interpolation of Univariate Data** - AMA_UnvMonoApprox() -
**Monotonic Approximation of Univariate Data** - AMA_UnvMonoInterp() -
**Monotonic Interpolation of Univariate Data**

Examples of the approximations produced by these functions are given in the following sections:

- AMA_UnvLstsqr() - Least Squares Approximation of Univariate Data
- AMA_UnvApprox() - Approximation of Univariate Data
- AMA_UnvInterp() - Interpolation of Univariate Data
- AMA_UnvMonoApprox() - Monotonic Approximation of Univariate Data
- AMA_UnvMonoInterp() - Monotonic Interpolation of Univariate Data

The examples illustrate approximations required to solve a minimum time to climb problem. The original minimum time to climb problem was presented by Byson et al. The basic problem is to choose the optimal control function (the angle of attack with respect to time, ) such that an airplane flies from a point on the runway to a specified final altitude as quickly as possible. Amongst other things, determining requires the representation of the aerodynamic forces on an airplane defined by the expressions

where is Mach; and and are the aerodynamic lift and drag coefficients, respectively. The definition of the lift and drag coefficients are given in terms of three "coefficients", namely , and , which are provided in **Table** Aerodynamic Data.

0.0 | 0.4 | 0.8 | 0.9 | 1.0 | 1.2 | 1.4 | 1.6 | 1.8 | |
---|---|---|---|---|---|---|---|---|---|

3.44 | 3.44 | 3.44 | 3.58 | 4.44 | 3.44 | 3.01 | 2.86 | 2.44 | |

0.013 | 0.013 | 0.013 | 0.014 | 0.031 | 0.041 | 0.039 | 0.036 | 0.035 | |

0.54 | 0.54 | 0.54 | 0.75 | 0.79 | 0.78 | 0.89 | 0.93 | 0.93 |

See A Collection of Optimal Control Test Problems for a complete description of the minimum time to climb problem.

In order to solve the minimum time to climb problem with a derivative based optimization technique a continuous representation of the "coefficients" data must be defined. In what follows the function AMA_UnvInterp() is employed to compute a linear spline interpolant of the coefficient data. A graphical illustration of the linear interpolant is presented in **Figure** Linear Interpolation of Coefficient Data. It consists of three panels each of which show the data, represented as red squares, and its spline interpolant, represented as a continuous blue curve. The left hand panel contains the data and interpolant for , the center panel contains the data and interpolant for , and the right hand panel contains the data and interpolant for .

The program exampleAMA_Unv.c was used to compute the spline approximations and interpolants discussed throughout this page and to generate the VisIt files used to produce the figures.

Examination of **Figure** Linear Interpolation of Coefficient Data shows the linear spline interpolant provides a continuous representation of the data. It also highlights the Mach intervals over which the data is increasing, derivative of the spline is positive; decreasing, derivative of the spline is negative; and constant, derivative of the spline is zero. The sign of the spline interpolant's derivative for the three coefficients is summarized in **Table** Sign of Linear Spline's First Derivative. It shows the Mach intervals in which the coefficient's data indicates a positive derivative (+), a negative derivative (-) and a derivative equal to zero (0). The value of is the left endpoint of the interval. For example, the coefficient has a positive derivative (+) for and a negative derivative (-) for .

0.0 | 0.4 | 0.8 | 0.9 | 1.0 | 1.2 | 1.4 | 1.6 | |
---|---|---|---|---|---|---|---|---|

0 | 0 | + | + | - | - | - | - | |

0 | 0 | + | + | + | - | - | - | |

0 | 0 | + | + | - | + | + | 0 |

This table also summarizes the "local monotonicity" constraints for the three coefficients. For example, it shows the "local monotonicity" constraints for are for , for and for . By their nature piecewise linear spline interpolants satisfy the local monotonicity constraints inherent in discrete data. However, their derivatives are piecewise constant and discontinuous at the data and, since most derivative based optimization methods require the objective function to be twice continuously differentiable, piecewise linear spline interpolants are not ideal representations of the aerodynamic coefficients for solving the minimum time to climb problem with a derivative based optimization technique. A much better choice for representing the aerodynamic coefficients is piecewise cubic spline approximation or interpolation.

In the next four sections the **AMA Spline Library** Univariate Data Functions are used to compute cubic spline approximations and interpolants of the coefficient data. Each section contains a figure which presents a graphical illustration of the spline produced by its corresponding function. As in **Figure** Linear Interpolation of Coefficient Data the figures consist of three panels each of which show the data, represented as red squares, and its cubic spline approximation, represented as a continuous blue curve. The left hand panel contains the data and approximation for , the center panel contains the data and approximation for , and the right hand panel contains the data and approximation for .

The least squares approximation function AMA_UnvLstsqr() requires the independent variable data , the dependent variable data , the weights , ; along with either the knot vector or , see AMA_UnvLstsqr(). For this example the weights are , for , and the knot vector is used. This knot vector defines sufficient spline coefficients for the least squares approximation to interpolate the data, that is, . The resulting least squares approximations for the three coefficients are illustrated in **Figure** Least Squares Approximation of Coefficient Data.

Examination of the above plots shows for all three coefficients the curves interpolate the data but behave in a manner inconsistent with the data. For example, for all three coefficients the data indicates the coefficient is constant in the interval , but the approximations oscillate through the data points. Over the interval the curves for and attain a local minimum which is smaller than the data value at the endpoints. Also, the approximations for and exceed the local maximum at . Similar behavior occurs at for . In summary, the least squares approximations do not satisfy the local monotonicity constraints and attain local minimum and maximum inconsistent with the data.

The approximation function AMA_UnvApprox() requires the independent variable data , the dependent variable data and the approximation tolerances , . The approximation tolerances used for this example are given in **Table** Approximation Tolerances. The tolerances are contrived and are based on the number of significant digits for the data. It would be better to define tolerances based on a statistical analysis of the process which produced the data, but the values defined below serve to illustrate the approximations produced by AMA_UnvApprox().

0.0 | 0.4 | 0.8 | 0.9 | 1.0 | 1.2 | 1.4 | 1.6 | 1.8 | |
---|---|---|---|---|---|---|---|---|---|

0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | |

0.0005 | 0.0005 | 0.0005 | 0.0005 | 0.0005 | 0.0005 | 0.0005 | 0.0005 | 0.0005 | |

0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 | 0.005 |

Based on the data AMA_UnvApprox() defines a knot vector which provides sufficient spline coefficients to satisfy the approximation constraints , for ,see AMA_UnvApprox(). Since the approximation tolerances can be equal to zero, the knot vector used by AMA_UnvApprox() does provides sufficient spline coefficients to interpolate the data. The resulting approximations for the three coefficients are illustrated in **Figure** Approximation of Coefficient Data.

Because AMA_UnvApprox() minimizes the variation of the second derivative and the approximation tolerances are nonzero, these approximations do not interpolate the data even though the function defines a knot vector which provides sufficient spline coefficients to interpolate. The nonzero approximation tolerances do mitigate the magnitude of the oscillations in the interval , but these approximations behave in much the same manner as the least squares approximations, that is; they do not satisfy the local monotonicity constraints and they attain local minimum and maximum inconsistent with the data.

The interpolation function AMA_UnvInterp() requires the independent variable data and the dependent variable data , for . The knot vector is defined by AMA_UnvInterp() and it provides sufficient spline coefficients to interpolate the data and to satisfy the boundary conditions and , see AMA_UnvInterp(). The resulting interpolants for the three coefficients are illustrated in **Figure** Interpolation of Coefficient Data.

Although the second derivative boundary constraints mitigate the magnitude of the oscillations in the interval they do not significantly improve the curve over the interval of constant data. The interpolants also do not satisfy the local monotonicity constraints and they attain local minimum and maximum inconsistent with the data. Such behavior can only be removed if explicit constraints are imposed on the approximations. Two functions which allow for the imposition of such constraints are presented in the following sections.

The monotonic approximation function AMA_UnvMonoApprox() requires the independent variable data , the dependent variable data and the approximation tolerances , . The approximation tolerances given in the table in **Section** AMA_UnvApprox() - Approximation of Univariate Data were also used for this example. Based on the data AMA_UnvMonoApprox() defines a knot vector which provides sufficient spline coefficients to satisfy the approximation constraints , for , and the local monotonicity constraints, see AMA_UnvMonoApprox() for a definition of the local monotonicity constraints it imposes. The resulting monotonic approximations for the three coefficients are illustrated in **Figure** Monotonic Approximation of Coefficient Data.

As expected the monotonic approximations satisfy the local monotonicity constraints and do not attain local minimum and maximum inconsistent with the data when the nonzero approximation tolerances are considered. Also, due to the nonzero approximation tolerances, they do not interpolate the data. Other notable features are apparent in over the interval and in over the interval , where both approximations are constant, even through the data implies the curves should have a negative derivative. This suggests the contrived values for the approximation tolerances are too lenient, but they do serve to illustrate the effect of the tolerances on the approximation. Clearly, more realistic tolerances are required in order to produce approximations useful for solving the minimum time to climb problem. In the absence of more realistic tolerances a better representation of the aerodynamic coefficients can be obtained with the monotonic interpolation function discussed below.

The monotonic interpolation function AMA_UnvMonoInterp() requires the independent variable data and the dependent variable data , for . The knot vector is defined by AMA_UnvMonoInterp() and it provides sufficient spline coefficients to satisfy the interpolation constraints , for , and local monotonicity constraints, see AMA_UnvMonoInterp() for a definition of the local monotonicity constraints it imposes. The resulting monotonic interpolants for the three coefficients are illustrated in **Figure** Monotonic Interpolation of Coefficient Data.

The plots above show that monotonic interpolants satisfy the local monotonicity constraints, never attain local minimum or maximum within an interval which exceed the data values at the interval's endpoints, and interpolate the data. However, there are features in the above interpolants which may be considered undesirable. For example, consider the curve about at which the curve obtains it's global maximum. It appears the curve remains relatively flat over too large of an interval about . Similar behavior can be seen in the curve about the local maximum at . That curve remains perfectly flat for most of the interval before rapidly decreasing to obtain the local minimum at . This behavior is a consequence of the default knot placement used for the monotonic interpolants and may nor may not be acceptable. If it is deemed unacceptable, then one solution is to use a quartic spline interpolant instead of a cubic. Also, since quartic splines have three continuous derivatives and representations of the coefficients with two continuous derivatives are sufficient for solving the minimum time to climb problem, the continuity of the quartic spline at the data points can be reduced by invoking AMA_OptionsSetContinuity() with **kindex** = 1 and **continuity** equal to AMA_Continuity_Reduced. The resulting monotonic quartic interpolants for the three coefficients are illustrated in **Figure** Monotonic Interpolation of Coefficient Data with Quartic Spline.

Maintaining local monotonicity and local minimum and maximum are useful characteristics for determining if monotonic approximation or interpolation methods produce better data approximations than least squares or interpolation methods; but, they can not differentiate the quality of a monotonic quartic versus a monotonic cubic. However, the above plots indicate the quartic interpolant is arguably better than the cubic interpolant as they suggest the solution of the minimum time to climb problem based on the quartic interpolant is probably more realistic then the solution based on the cubic interpolant.

AMA Spline Library Document - Version:1.0.0-a Date:02/24/16 - Generated by 1.8.5