NAG Library Function Document
nag_quad_1d_inf_exp_wt (d01ubc)
1
Purpose
nag_quad_1d_inf_exp_wt (d01ubc) returns the Gaussian quadrature approximation for the specific problem . The degrees of precision catered for are: , , , , , , , and , corresponding to values of , , , , , , , and , where is the number of weights.
2
Specification
#include <nag.h> |
#include <nagd01.h> |
void |
nag_quad_1d_inf_exp_wt (
void |
(*fun)(const double x[],
double f[],
Integer n,
Nag_Comm *comm, Integer *istop),
|
|
Integer n,
double *ans,
Nag_Comm *comm,
NagError *fail) |
|
3
Description
nag_quad_1d_inf_exp_wt (d01ubc) uses the weights and the abscissae such that is approximated by to maximum precision i.e., it is exact when is a polynomial of degree .
4
References
Golub G H and Welsch J H (1969) Calculation of Gauss quadrature rules Math. Comput. 23 221–230
5
Arguments
- 1:
– function, supplied by the userExternal Function
-
fun must return the integrands
in
for each
in
, for
at a given point.
The specification of
fun is:
void |
fun (const double x[],
double f[],
Integer n,
Nag_Comm *comm, Integer *istop)
|
|
- 1:
– const doubleInput
-
On entry: the points at which the integrand function must be evaluated.
- 2:
– doubleOutput
-
On exit: must contain the value of the integrand evaluated at the point , for .
- 3:
– IntegerInput
-
On entry:
n specifies the number of weights and abscissae to be used.
- 4:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
fun.
- user – double *
- iuser – Integer *
- p – Pointer
The type Pointer will be
void *. Before calling
nag_quad_1d_inf_exp_wt (d01ubc) you may allocate memory and initialize these pointers with various quantities for use by
fun when called from
nag_quad_1d_inf_exp_wt (d01ubc) (see
Section 3.3.1.1 in How to Use the NAG Library and its Documentation).
- 5:
– Integer *Input/Output
-
On entry: .
On exit: you may set
istop to a negative number if at any time it is impossible to evaluate the function
. In this case
nag_quad_1d_inf_exp_wt (d01ubc) halts with
fail set to the value of
istop and the value returned in
ans will be that of a non-signalling NaN.
- 2:
– IntegerInput
-
On entry:
n specifies the number of weights and abscissae to be used.
Constraint:
, , , , , , , or .
- 3:
– double *Output
-
On exit: if
,
ans contains an approximation to the integral. Otherwise,
ans will be a non-signalling NaN.
- 4:
– Nag_Comm *
-
The NAG communication argument (see
Section 3.3.1.1 in How to Use the NAG Library and its Documentation).
- 5:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry,
.
n is not one of the allowed values.
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_USER_STOP
-
The user has halted the calculation.
7
Accuracy
The weights and abscissae have been calculated using quadruple precision arithmetic.
8
Parallelism and Performance
nag_quad_1d_inf_exp_wt (d01ubc) is not threaded in any implementation.
None.
10
Example
This example computes an approximation to .
10.1
Program Text
Program Text (d01ubce.c)
10.2
Program Data
None.
10.3
Program Results
Program Results (d01ubce.r)