naginterfaces.library.ode.bvp_coll_sys¶
- naginterfaces.library.ode.bvp_coll_sys(n, cf, bc, x0, x1, k1, kp, comm, data=None)[source]¶
bvp_coll_sys
solves a regular linear two-point boundary value problem for a system of ordinary differential equations by Chebyshev series using collocation and least squares.For full information please refer to the NAG Library document for d02jb
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/d02/d02jbf.html
- Parameters
- nint
, the order of the system of differential equations.
- cfcallable retval = cf(i, j, x, data=None)
defines the system of differential equations (see Notes).
It must return the value of a coefficient function , of , at a given point , or of a right-hand side function if .
- Parameters
- iint
Indicate the function to be evaluated, namely if , or if .
, .
- jint
Indicate the function to be evaluated, namely if , or if .
, .
- xfloat
The point at which the function is to be evaluated.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- retvalfloat
The value of a coefficient function , of , at a given point , or of a right-hand side function if .
- bccallable (j, rhs) = bc(i, data=None)
defines the boundary conditions, which have 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 th boundary condition is , or to if it is .
must not be set to the same value for two different values of .
- rhsfloat
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 components 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 of the th component of the solution, ; 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, .
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_sys
calculates the solution of a regular two-point boundary value problem for a regular linear th-order system of first-order ordinary differential equations as a Chebyshev series in the interval . The differential equationis 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, equations 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 for each component of the solution of the system of differential equations on an interval normalized to .
fit.dim1_cheb_eval2
can be used to evaluate the components of the solution at any point on the interval .fit.dim1_cheb_deriv
followed byfit.dim1_cheb_eval2
can be used to evaluate their 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