The routine may be called by the names d02jbf or nagf_ode_bvp_coll_sys.
d02jbf 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 equation
is defined by cf, and the boundary conditions at the points and are defined by bc.
You specify the degree of Chebyshev series required, , and the number of collocation points, kp. The routine 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 .
e02akf can be used to evaluate the components of the solution at any point on the interval . e02ahf followed by e02akf can be used to evaluate their derivatives.
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
1: – IntegerInput
On entry: , the order of the system of differential equations.
2: – real (Kind=nag_wp) Function, supplied by the user.External Procedure
cf defines the system of differential equations (see Section 3). It must return the value of a coefficient function , of , at a given point , or of a right-hand side function if .
On entry: indicate the function to be evaluated, namely if , or if . , .
3: – Real (Kind=nag_wp)Input
On entry: the point at which the function is to be evaluated.
cf must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d02jbf is called. Arguments denoted as Input must not be changed by this procedure.
Note:cf should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d02jbf. If your code inadvertently does return any NaNs or infinities, d02jbf is likely to produce unexpected results.
3: – Subroutine, supplied by the user.External Procedure
bc defines the boundary conditions, which have the form or . The boundary conditions may be specified in any order.
On entry: the index of the boundary condition to be defined.
2: – IntegerOutput
On exit: must be set to if the th boundary condition is , or to if it is .
j must not be set to the same value for two different values of i.
3: – Real (Kind=nag_wp)Output
On exit: the value .
bc must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d02jbf is called. Arguments denoted as Input must not be changed by this procedure.
Note:bc should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d02jbf. If your code inadvertently does return any NaNs or infinities, d02jbf is likely to produce unexpected results.
4: – Real (Kind=nag_wp)Input
5: – Real (Kind=nag_wp)Input
On entry: the left- and right-hand boundaries, and , respectively.
6: – IntegerInput
On entry: 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 ).
7: – IntegerInput
On entry: the number of collocation points to be used.
8: – Real (Kind=nag_wp) arrayOutput
On exit: 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.
9: – IntegerInput
On entry: the first dimension of the array c as declared in the (sub)program from which d02jbf is called.
10: – Real (Kind=nag_wp) arrayWorkspace
11: – IntegerInput
On entry: the dimension of the array w as declared in the (sub)program from which d02jbf is called.
12: – Integer arrayWorkspace
13: – IntegerInput
On entry: the dimension of the array iw as declared in the (sub)program from which d02jbf is called.
14: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, and .
On entry, .
On entry, and .
On entry, .
Constraint: ; that is, .
On entry, .
Constraint: ; that is, .
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.
Iterative refinement in the least squares solution has failed to converge. The coefficient matrix is too ill-conditioned.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The Chebyshev coefficients are determined by a stable numerical method. The accuracy of the approximate solution may be checked by varying the degree of the polynomials and the number of collocation points (see Section 9).
8Parallelism and Performance
d02jbf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading for more information on thread safety.
d02jbf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The time taken by d02jbf depends on the size and complexity of the differential system, the degree of the polynomial solution, and the number of matching points.
The collocation points in the interval are chosen to be the extrema of the appropriate shifted Chebyshev polynomial. If , then the least squares solution reduces to the solution of a system of linear equations, and true collocation results.
The accuracy of the solution may be checked by repeating the calculation with different values of k1 and with kp fixed but . If the Chebyshev coefficients decrease rapidly for each component (and consistently for various k1 and kp), the size of the last two or three gives an indication of the error. If the Chebyshev coefficients do not decay rapidly, it is likely that the solution cannot be well-represented by Chebyshev series. Note that the Chebyshev coefficients are calculated for the interval .
Linear systems of high-order equations in their original form, singular problems, and, indirectly, nonlinear problems can be solved using d02tgf.
This example solves the equation
with boundary conditions
The equation is written as the first-order system
for solution by d02jbf and the boundary conditions are written
We use , and , and and , so that the different Chebyshev series may be compared. The solution for and is evaluated by e02akf at nine equally spaced points over the interval .