Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿

### IMSL_SPVALUE

IMSL_SPVALUE

The IMSL_SPVALUE function computes values of a spline or values of one of its derivatives.

The IMSL_SPVALUE function can be used to evaluate splines of the following type:

If Spline is a piecewise polynomial, the IMSL_SPVALUE function computes the values of a cubic spline or one of its derivatives. In this case, supply the arguments x and spline, but do not supply the argument y. If x is a scalar, then a scalar is returned. If x is a one-dimensional array, then a one-dimensional array of values is returned. The first and last pieces of the cubic spline are extrapolated so that the cubic spline structures returned by the cubic spline routines are defined and can be evaluated on the entire real line. This ability is based on the routine PPVALU by de Boor (1978, p. 89).

If Spline is a one-dimensional B-spline, the IMSL_SPVALUE function computes the values of a spline or one of its derivatives. In this case, the user is required to supply the arguments x and spline and must not supply the argument y. If x is a scalar, then a scalar is returned. If x is a one-dimensional array, then a one-dimensional array of values is returned. This ability is based on the routine BVALUE by de Boor (1978, p. 144).

If Spline is a two-dimensional, tensor-product B-spline, the IMSL_SPVALUE function computes the values of a tensor-product spline or one of its derivatives. In this case, the user is required to supply the arguments x, y, and spline. If x and y are both scalars, then a scalar is returned. If x and y are both one-dimensional arrays, then a two-dimensional array of values is returned, where the (i, j)-th element of the returned matrix is the desired value of spline (x (i), y (j)). This ability is based on the discussion in de Boor (1978, pp. 351–353).

## Examples

### Example 1

This example computes a cubic spline interpolant to function values. The spline is then evaluated, and the results are plotted as shown in the figure below. Since the default settings are used, the interpolant is determined by the not-a-knot condition (see de Boor 1978).

`x = FINDGEN(10)/9 f = SIN(15 * x)`
`pp = IMSL_CSINTERP(x, f)`
`x2 = FINDGEN(100)/99`
`ppeval = IMSL_SPVALUE(x2, pp) PLOT, x2, ppeval` ### Example 2

This example computes a two-dimensional, tensor-product B-spline using IMSL_BSINTERP, then uses IMSL_SPVALUE to evaluate the spline on a grid, and plots the results, as shown in the figure below.

`x = FINDGEN(5)/4 y = FINDGEN(5)/4 f = FLTARR(5, 5)`
`FOR i = 0, 4 DO f(i,*) = SIN(2 * !Pi * x(i)) * (-COS(!Pi*y/2))`
`; Generate the data.`
`bs = IMSL_BSINTERP(x, y, f)`
`; Compute the spline by calling IMSL_BSINTERP. bsval = FLTARR(20, 20)`
`FOR i = 0, 19 DO BSVAL(i, *) = IMSL_SPVALUE(i/19., FINDGEN(20)/19, bs)`
`; Evaluate the spline on a grid.`
`!P.Multi = [0, 1, 2]`
`WINDOW, XSize = 400, YSize = 800`
`; Plot the original data and the evaluations of the spline in the`
`; same plot window. ax = 50`
`; The angle of rotation about x-axis in plots is defined by ax.`
`!P.Charsize = 1.5`
`SURFACE, f, x, y, Ax = ax, XTitle = 'X', YTitle = 'Y' SURFACE, bsval, FINDGEN(20)/19, FINDGEN(20)/19, Ax = ax, \$`
`XTitle = 'X', YTitle = 'Y'` ## Errors

### Warning Errors

MATH_X_NOT_WITHIN_KNOTS: Value of x does not lie within the knot sequence.

MATH_Y_NOT_WITHIN_KNOTS: Value of y does not lie within the knot sequence.

### Fatal Errors

MATH_KNOT_MULTIPLICITY: Multiplicity of the knots cannot exceed the order of the spline.

MATH_KNOT_NOT_INCREASING: Knots must be nondecreasing.

## Syntax

Result = IMSL_SPVALUE(X, Spline [, XDERIV=value] [, YDERIV=value])

or

Result = IMSL_SPVALUE(X, Y, Spline [, XDERIV=value] [, YDERIV=value])

## Return Value

The values of a spline or one of its derivatives.

## Arguments

If evaluation of a one-dimensional spline is desired, then arguments x and spline are required. If evaluation of a two-dimensional spline is desired, then X, Y, and Spline are required.

### X

If x is an array, then x must be strictly increasing, i.e., x (i) < x (i + 1) for i = 0, (N_ELEMENTS (x) - 2).

### Y

Scalar value or an array of values at which the spline is to be evaluated in the y-direction. This argument should only be used if spline is a two-dimensional, tensor-product spline. If y is an array, then x must be strictly increasing, i.e., y (i) < y (i + 1) for i = 0, (N_ELEMENTS (y) - 2).

### Spline

Structure that represents the spline.

## Keywords

### XDERIV (optional)

Let XDERIV = p, and let s be the spline that is represented by spline. If s is a one-dimensional spline, this keyword produces the p-th derivative of s at x, s(p) (x). If s is a two-dimensional spline, this keyword specifies the order of the partial derivative in the x-direction. Let q = YDERIV, which has a default value of 0. Then, IMSL_SPVALUE produces the (p, q)-th derivative of s at (x, y), s(p, q)(x, y). Default: 0

### YDERIV (optional)

If s = spline is a two-dimensional spline, this keyword specifies the order of the partial derivative in the y-direction. Let p = XDERIV, which has a default value of zero, and q = YDERIV. Then, IMSL_SPVALUE produces the (p, q)-th derivative of s at (x, y), s(p, q)(x, y). If spline is a one-dimensional spline, this keyword has no effect on computations. Default: 0

## Version History

 6.4 Introduced