naginterfaces.library.ode.bvp_coll_nth_comp¶
- naginterfaces.library.ode.bvp_coll_nth_comp(m, l, x0, x1, k1, kp, coeff, bdyc, data=None, spiked_sorder='C')[source]¶
bvp_coll_nth_comp
solves a system of linear ordinary differential equations by least squares fitting of a series of Chebyshev polynomials using collocation.For full information please refer to the NAG Library document for d02tg
https://www.nag.com/numeric/nl/nagdoc_29/flhtml/d02/d02tgf.html
- Parameters
- mint, array-like, shape
must be set to the highest order derivative occurring in the th equation, for .
- lint, array-like, shape
must be set to the number of boundary conditions associated with the th equation, for .
- x0float
The left-hand boundary, .
- x1float
The right-hand boundary, .
- 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, .
- coeffcallable (a, rhs) = coeff(x, i, a, rhs, data=None)
defines the system of differential equations (see Notes).
It must evaluate the coefficient functions and the right-hand side function of the th equation at a given point.
Only nonzero entries of the array and need be specifically assigned, since all elements are set to zero by
bvp_coll_nth_comp
before calling .- Parameters
- xfloat
, the point at which the functions must be evaluated.
- iint
The equation for which the coefficients and right-hand side are to be evaluated.
- afloat, ndarray, shape
All elements of are set to zero.
- rhsfloat
Is set to zero.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- afloat, array-like, shape
must contain the value , for , .
- rhsfloat
It must contain the value .
- bdyccallable (x, a, rhs) = bdyc(i, j, a, rhs, data=None)
defines the boundary conditions (see Notes).
It must evaluate the coefficient functions and right-hand side function in the th boundary condition associated with the th equation, at the point at which the boundary condition is applied.
Only nonzero entries of the array and need be specifically assigned, since all elements are set to zero by
bvp_coll_nth_comp
before calling .- Parameters
- iint
The differential equation with which the condition is associated.
- jint
The boundary condition for which the coefficients and right-hand side are to be evaluated.
- afloat, ndarray, shape
All elements of are set to zero.
- rhsfloat
Is set to zero.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- xfloat
, the value at which the boundary condition is applied.
- afloat, array-like, shape
The value , for , .
- rhsfloat
The value .
- dataarbitrary, optional
User-communication data for callback functions.
- spiked_sorderstr, optional
If in or in are spiked (i.e., have unit extent in all but one dimension, or have size ), selects the storage order to associate with them in the NAG Engine:
- spiked_sorder =
row-major storage will be used;
- spiked_sorder =
column-major storage will be used.
- Returns
- cfloat, ndarray, shape
The th column of contains the computed Chebyshev coefficients of the th component of the solution, ; that is, the computed solution is:
where is the 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, one of the equations is of order less than .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, a negative number of boundary conditions was set for one of the system equations.
- (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_comp
calculates an approximate solution of a linear or linearized system of ordinary differential equations as a Chebyshev series. Suppose there are differential equations for variables , over the range . Let the th equation bewhere . evaluates the coefficients and the right-hand side for each , , at any point . The boundary conditions may be applied either at the end points or at intermediate points; they are written in the same form as the differential equations, and specified by . For example the th boundary condition out of those associated with the th differential equation takes the form
where lies between and . It is assumed in this function that certain of the boundary conditions are associated with each differential equation. This is for your convenience; the grouping does not affect the results.
The degree of the polynomial solution must be the same for all variables. You specify the degree required, , and the number of collocation points, , in the range. The function sets up a system of linear equations for the Chebyshev coefficients, with equations for each collocation point and one for each boundary condition. The collocation points are chosen at the extrema of a shifted Chebyshev polynomial of degree . The boundary conditions are satisfied exactly, and the remaining equations are solved by a least squares method. The result produced is a set of Chebyshev coefficients for the functions , with the range normalized to .
fit.dim1_cheb_eval2
can be used to evaluate the components of the solution at any point on the range .fit.dim1_cheb_deriv
andfit.dim1_cheb_integ
may be used to obtain Chebyshev series representations of derivatives and integrals (respectively) of the components of the solution.
- 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