naginterfaces.library.ode.bvp_​coll_​nth

naginterfaces.library.ode.bvp_coll_nth(n, cf, bc, x0, x1, k1, kp, comm, data=None)[source]

bvp_coll_nth solves a regular linear two-point boundary value problem for a single th-order ordinary differential equation by Chebyshev series using collocation and least squares.

For full information please refer to the NAG Library document for d02ja

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/d02/d02jaf.html

Parameters
nint

, the order of the differential equation.

cfcallable retval = cf(j, x, data=None)

defines the differential equation (see Notes).

It must return the value of a function at a given point , where, for , is the coefficient of in the equation, and is the right-hand side.

Parameters
jint

The index of the function to be evaluated.

xfloat

The point at which is to be evaluated.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
retvalfloat

The value of at the given point .

bccallable (j, rhs) = bc(i, data=None)

defines the boundary conditions, each of which has the form or .

The boundary conditions may be specified in any order.

Parameters
iint

The index of the boundary condition to be defined.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
jint

Must be set to if the boundary condition is , and to if it is .

must not be set to the same value for two different values of .

rhsfloat

Must be set to the value .

x0float

The left- and right-hand boundaries, and , respectively.

x1float

The left- and right-hand boundaries, and , respectively.

k1int

The number of coefficients to be returned in the Chebyshev series representation of the solution (hence the degree of the polynomial approximation is ).

kpint

The number of collocation points to be used.

commdict, communication object, modified in place

Communication structure.

On initial entry: need not be set.

dataarbitrary, optional

User-communication data for callback functions.

Returns
cfloat, ndarray, shape

The computed Chebyshev coefficients; that is, the computed solution is:

where is the th Chebyshev polynomial of the first kind, and denotes that the first coefficient, , is halved.

Raises
NagValueError
(errno )

On entry, , and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

Either the boundary conditions are not linearly independent, or the coefficient matrix is rank deficient. Increasing the number of collocation points may overcome this latter problem.

(errno )

Iterative refinement in the least squares solution has failed to converge. The coefficient matrix is too ill-conditioned.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

bvp_coll_nth calculates the solution of a regular two-point boundary value problem for a single th-order linear ordinary differential equation as a Chebyshev series in the interval . The differential equation

is defined by , and the boundary conditions at the points and are defined by .

You specify the degree of Chebyshev series required, , and the number of collocation points, . The function sets up a system of linear equations for the Chebyshev coefficients, one equation for each collocation point and one for each boundary condition. The boundary conditions are solved exactly, and the remaining equations are then solved by a least squares method. The result produced is a set of coefficients for a Chebyshev series solution of the differential equation on an interval normalized to .

fit.dim1_cheb_eval2 can be used to evaluate the solution at any point on the interval . fit.dim1_cheb_deriv followed by fit.dim1_cheb_eval2 can be used to evaluate its derivatives.

References

Picken, S M, 1970, Algorithms for the solution of differential equations in Chebyshev-series by the selected points method, Report Math. 94, National Physical Laboratory