naginterfaces.library.ode.bvp_​fd_​nonlin_​fixedbc

naginterfaces.library.ode.bvp_fd_nonlin_fixedbc(u, v, a, b, tol, fcn, x, np, itrace, comm, data=None, io_manager=None)[source]

bvp_fd_nonlin_fixedbc solves a two-point boundary value problem with assigned boundary values for a system of ordinary differential equations, using a deferred correction technique and a Newton iteration.

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

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/d02/d02gaf.html

Parameters
ufloat, array-like, shape

must be set to the known or estimated value of at and must be set to the known or estimated value of at , for .

vfloat, array-like, shape

must be set to if is a known value and to if is an estimated value, for , for .

afloat

, the left-hand boundary point.

bfloat

, the right-hand boundary point.

tolfloat

A positive absolute error tolerance. If

is the final mesh, is the th component of the approximate solution at , and is the th component of the true solution of equation (1) (see Notes) and the boundary conditions, then, except in extreme cases, it is expected that

fcncallable f = fcn(n, x, y, data=None)

must evaluate the functions (i.e., the derivatives ), for , at a general point .

Parameters
nint

, the number of equations.

xfloat

, the value of the argument.

yfloat, ndarray, shape

, for , the value of the argument.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
ffloat, array-like, shape

The values of , for .

xfloat, array-like, shape

If (see ), the first elements must define an initial mesh. Otherwise the elements of need not be set.

npint

Determines whether a default or user-supplied mesh is used.

A default value of for and a corresponding equispaced mesh are used.

You must define an initial mesh using the array as described.

itraceint

If warning messages be suppressed, otherwise warning messages will be printed (see Exceptions).

commdict, communication object, modified in place

Communication structure.

On initial entry: need not be set.

dataarbitrary, optional

User-communication data for callback functions.

io_managerFileObjManager, optional

Manager for I/O in this routine.

Returns
xfloat, ndarray, shape

define the final mesh (with the returned value of ) satisfying the relation (3).

yfloat, ndarray, shape

The approximate solution satisfying (2), on the final mesh, that is

where is the number of points in the final mesh.

The remaining columns of are not used.

npint

The number of points in the final (returned) mesh.

Raises
NagValueError
(errno )

The sequence is not strictly increasing. For , and .

(errno )

On entry: and .

Constraint: .

(errno )

On entry: and .

Constraint: .

(errno )

The sum of known left and right boundary values must equal the number of equations: the number of known left boundary values , the number of known right boundary values , the number of equations .

(errno )

The number of known right boundary values must be less than the number of equations: the number of known right boundary values , the number of equations .

(errno )

The number of known left boundary values must be less than the number of equations: the number of known left boundary values , the number of equations .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

The Newton iteration has failed to converge.

This could be due to there being too few points in the initial mesh or to the initial approximate solution being too inaccurate. If this latter reason is suspected or you cannot make changes to prevent this error, you should use the routine with a continuation facility instead.

(errno )

A serious error occurred in a call to the internal integrator.

The error code internally was . Please contact NAG.

Warns
NagAlgorithmicWarning
(errno )

Newton iteration has reached round-off level.

If desired accuracy has not been reached, is too small for this problem and this machine precision.

(errno )

A finer mesh is required for the accuracy requested; that is, is not large enough.

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

bvp_fd_nonlin_fixedbc solves a two-point boundary value problem for a system of differential equations in the interval []. The system is written in the form:

and the derivatives are evaluated by . Initially, boundary values of the variables must be specified, some at and some at . You must supply estimates of the remaining boundary values and all the boundary values are used in constructing an initial approximation to the solution. This approximate solution is corrected by a finite difference technique with deferred correction allied with a Newton iteration to solve the finite difference equations. The technique used is described fully in Pereyra (1979). The Newton iteration requires a Jacobian matrix and this is calculated by numerical differentiation using an algorithm described in Curtis et al. (1974).

You supply an absolute error tolerance and may also supply an initial mesh for the construction of the finite difference equations (alternatively a default mesh is used). The algorithm constructs a solution on a mesh defined by adding points to the initial mesh. This solution is chosen so that the error is everywhere less than your tolerance and so that the error is approximately equidistributed on the final mesh. The solution is returned on this final mesh.

If the solution is required at a few specific points then these should be included in the initial mesh. If on the other hand the solution is required at several specific points then you should use the interpolation functions provided in submodule interp if these points do not themselves form a convenient mesh.

References

Curtis, A R, Powell, M J D and Reid, J K, 1974, On the estimation of sparse Jacobian matrices, J. Inst. Maths. Applics. (13), 117–119

Pereyra, V, 1979, PASVA3: An adaptive finite-difference Fortran program for first order nonlinear, ordinary boundary problems, Codes for Boundary Value Problems in Ordinary Differential Equations. Lecture Notes in Computer Science, (eds B Childs, M Scott, J W Daniel, E Denman and P Nelson) (76), Springer–Verlag