📄 ocn_s.h
字号:
7: On entry, x must not be greater than _value_: x = _value_. x is too large, the function would over.ow, the function returns the value of the function at the largest permissible argument.
successfully call of the nag_log_gamma function.
*/
double nag_log_gamma(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s14aec
returns the value of the kth derivative of the psi function psi(x) for real x and k = 0, 1, ..., 6.
Example:
The example program evaluates \psi(2)(x) at x = 2.5, and prints the results
void test_nag_real_polygamma()
{
double y;
double x[] ={1.0, 0.5, -3.6, 8.0, 2.9, -4.7, -5.4};
int k[] = {0, 1, 2, 3, 4, 5, 6};
printf(" x k (D^K/DX^K)psi(X)\n");
for( int i = 0; i < 6; i++)
{
y = nag_real_polygamma(x[i], k[i]);
printf("%5.1f %5ld %12.4e\n", x[i], k[i], y);
}
}
The output is following:
X K (D^K/DX^K)psi(X)
1.0 0 -5.772 e-01
0.5 1 4.9348e+00
-3.6 2 -2.2335e+01
8.0 3 4.6992e-03
2.9 4 -1.5897e-01
-4.7 5 1.6566e+05
-5.4 6 4.1378e+05
Parameters:
Return:
This function returns NAG error code, 0 if no error.
90: On entry, k = <value>. Constraint: 0 <= k <= 6.
96: On entry, x = <value>. Constraint: x must not be 'too close' to a non-positive integer. That is, |x - nint(x)| >= machine precision x nint(x).
694: The evaluation has been abandoned due to the likelihood of underflow. The result is returned as zero.
695: The evaluation has been abandoned due to the likelihood of overflow. The result is returned as zero.
74: An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct the please consult NAG for assistance.
successfully call of the nag_real_polygamma.
*/
double nag_real_polygamma(
double x, // the argument x of the function.
int k, // the function psi-k(z) to be evaluated.
NagError *fail = NULL
);
/** s14afc
returns the value of the kth derivative of the psi function psi(z), for complex z and k = 0, 1, ..., 4.
Example:
The example program evaluates the psi(trigamma) function at z = -1.5 +2.5i,
and prints the results.
void test_nag_complex_polygamma()
{
complex z, z_l;
double re[5] = {1.2, 0.5, -1.5, 8.0, 2.9};
double im[5] = {5.0, -0.2, 2.5, 3.3, 7.5};
int k[5] = {0, 1, 1, 3, 4};
printf(" z k (d^K/DZ^k)psi(z)\n\n");
for(int i = 0; i < 5; i++)
{
z.m_re = re[i];
z.m_im = im[i];
z_l = nag_complex_polygamma(z, k[i]);
printf("(%5.1f, %5.1f) %6ld (%12.4e, %12.4e) \n",z.m_re, z.m_im, k[i], z_l.m_re, z_l.m_im);
}
}
The output is following:
z k (D^K/DZ^K)psi(z)
( 1.2, 5.0) 0 ( 1.6176e+00, 1.4312e+00)
( 0.5, -0.2) 1 ( 3.4044e+00, 2.5394e+00)
(-1.5, 2.5) 2 (-1.9737e-01, -2.4271e-01)
( 8.0, 3.3) 3 ( 1.1814e-03, -3.4188e-03)
( 2.9, 7.5) 4 (-5.0227e-04, -1.4955e-03)
Parameters:
Return:
This function returns NAG error code, 0 if no error.
90: On entry, k = <value>. Constraint: 0 <= k <= 4.
102: On entry, z = (<value>, <value>). Constraint: z.re must not be ' too close' to a non-positive integer when z.im = 0.0. That is, |z.re - nint(z.re)| >= machine precision x |nint(z.re)|
695: The evaluation has been abandoned due to the likelihood of overflow. The result is returned as zero.
74: An internal error has occurred in the function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
successfully call of the nag_complex_polygamma function.
*/
complex nag_complex_polygamma(
complex z, // the argument z of the function.
int k, // the function psi-k(z) to be evaluated.
NagError *fail = NULL
);
/** s14bac
computes values for the incomplete gamma functions P(a, x) and Q(a, x).
Example:
The following program reads values of the argument a and x from a file,
evaluates the function and prints the results.
void test_nag_incomplete_gamma()
{
double q, tol, p;
double a[] = {2.0,7.0, 0.5, 20.0, 21.0};
double x[] = {3.0, 1.0, 99.0, 21.0, 20.0}
tol = 1e-5;
printf(" a x p q\n");
for(int i = 0; i < 5; i++)
{
nag_incomplete_gamma(a[i], x[i], tol, &p, &q);
printf("%12.4f%12.4f%12.4f%12.4f\n", a[i], x[i], p, q);
}
}
The output is following:
a x p q
2.0000 3.0000 0.8009 0.1991
7.0000 1.0000 0.0001 0.9999
0.5000 99.0000 1.0000 0.0000
20.0000 21.0000 0.6157 0.3843
21.0000 20.0000 0.4409 0.5591
Parameters:
Return:
This function returns NAG error code, 0 if no error.
On error nag incomplete gamma returns with a value of 0.0 for p and q.
6: On entry, a must not be less than or equal to 0.0: a = _value_.
11: On entry, x must not be less than 0.0: x = _value_.
405: The algorithm has failed to converge in _value_ iterations. Convergence of the Taylor series or Legendre continued fraction has failed within the speci.ed number of iterations. This error is extremely unlikely to occur; if it does, contact NAG.
successfully call of the nag_incomplete_gamma function.
*/
int nag_incomplete_gamma(
double a, // the argument a of the functions.
double x, // the argument x of the functions.
double tol, // the relative accuracy required by the user in the results. If nag incomplete gamma is entered with tol greater than 1.0 or less than machine precision, then the value of machine precision is used instead.
double *p, // the values of the functions P(a, x) and Q(a, x) respectively.
double *q // the values of the functions P(a, x) and Q(a, x) respectively.
);
/** s15abc
returns the value of the cumulative Normal distribution function P(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_cumul_normal()
{
double y;
double x[] = { -20.0, -1.0, 0.0, 1.0, 2.0, 20.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y= nag_cumul_normal(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-2.000e+01 2.754e-89
-1.000e+00 1.587e-01
0.000e+00 5.000e-01
1.000e+00 8.413e-01
2.000e+00 9.772e-01
2.000e+01 1.000e+00
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_cumul_normal function.
*/
double nag_cumul_normal(
double x // the argument x of the function.
);
/** s15acc
returns the value of the complement of the cumulative normal distribution function Q(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_cumul_normal_complem()
{
double y;
double x[] = { -20.0, -1.0, 0.0, 1.0, 2.0, 20.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y= nag_cumul_normal_complem(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-2.000e+01 1.000e+00
-1.000e+00 8.413e-01
0.000e+00 5.000e-01
1.000e+00 1.587e-01
2.000e+00 2.275e-02
2.000e+01 2.754e-89
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_cumul_normal_complem function.
*/
double nag_cumul_normal_complem(
double x // the argument x of the function.
);
/** s15adc
returns the value of the complementary error function, erfc x.
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_erfc()
{
double y;
double x[] = { -10.0, -1.0, 0.0, 1.0, 10.0}
printf(" x y\n");
for(int i = 0; i < 5; i++)
{
y= nag_erfc(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-1.000e+01 2.000e+00
-1.000e+00 1.843e+00
0.000e+00 1.000e+00
1.000e+00 1.573e-01
1.000e+01 2.088e-45
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_erfc function.
*/
double nag_erfc(
double x // the argument x of the function.
);
/** s15aec
returns the value of the error function, erf x.
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_erf()
{
double y;
double x[] = {-6.0, -4.5, -1.0, 1.0, 4.5, 6.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y= nag_erf(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-6.000e+00 -1.000e+00
-4.500e+00 -1.000e+00
-1.000e+00 -8.427e-01
1.000e+00 8.427e-01
4.500e+00 1.000e+00
6.000e+00 1.000e+00
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_erf function.
*/
double nag_erf(
double x // the argument x of the function.
);
/** s17acc
returns the value of the Bessel function Y0(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_bessel_y0()
{
double y;
double x[] = {0.5, 1.0, 3.0, 6.0, 8.0, 10.0, 1000.0};
printf(" x y\n");
for(int i = 0; i < 7; i++)
{
y= nag_bessel_y0(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
5.000e-01 -4.445e-01
1.000e+00 8.826e-02
3.000e+00 3.769e-01
6.000e+00 -2.882e-01
8.000e+00 2.235e-01
1.000e+01 5.567e-02
1.000e+03 4.716e-03
Parameters:
Return:
This function returns NAG error code, 0 if no error.
7: On entry, x must not be greater than _value_: x = _value_. x is too large, the function returns the amplitude of the Y0 oscillation, _2/px.
6: On entry, x must not be less than or equal to 0.0: x = _value_. Y0 is undefined, the function returns zero.
successfully call of the nag_bessel_y0 function.
*/
double nag_bessel_y0(
double x, //the argument x of the function.
NagError *fail = NULL
);
/** s17adc
returns the value of the Bessel function Y1(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_bessel_y1()
{
double y;
double x[] = {0.5, 1.0, 3.0, 6.0, 8.0, 10.0, 1000.0};
printf(" x y\n");
for(int i = 0; i < 7; i++)
{
y= nag_bessel_y1(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
5.000e-01 -1.471e+00
1.000e+00 -7.812e-01
3.000e+00 3.247e-01
6.000e+00 -1.750e-01
8.000e+00 -1.581e-01
1.000e+01 2.490e-01
1.000e+03 -2.478e-02
Parameters:
Return:
This function returns NAG error code, 0 if no error.
7: On entry, x must not be greater than _value_: x = _value_. x is too large, the function returns the amplitude of the Y1 oscillation, _2/px.
6: On entry, x must not be less than or equal to 0.0: x = _value_. Y1 is undefined, the function returns zero.
692: On entry, x must be greater than _value_: x = _value_. x is too close to zero, there is a danger of over.ow, the function returns the value of Y1(x) at the smallest valid argument.
successfully call of the nag_bessel_y1 function.
*/
double nag_bessel_y1(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s17aec
returns the value of the Bessel function J0(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results
void test_nag_bessel_j0()
{
double y;
double x[] ={0.0, 0.5, 1.0, 3.0, 6.0, 8.0, 10.0, -1.0, 1000.0}
printf(" x y\n");
for(int i = 0; i < 9; i++)
{
y= nag_bessel_j0(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
0.000e+00 1.000e+00
5.000e-01 9.385e-01
1.000e+00 7.652e-01
3.000e+00 -2.601e-01
6.000e+00 1.506e-01
8.000e+00 1.717e-01
1.000e+01 -2.459e-01
-1.000e+00 7.652e-01
1.000e+03 2.479e-02
Parameters:
Return:
This function return NAG error code, 0 if no error.
7: On entry, x must not be greater than _value_: x = _value_. x is too large, the function returns the amplitude of the J0 oscillation, _2/p|x|.
successfully call of the nag_bessel_j0 function.
*/
double nag_bessel_j0(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s17afc
returns the value of the Bessel function J1(x).
Example:
The following program reads values of the argument x from a file,
evaluates the function at each value of x and prints the results.
void test_nag_bessel_j1()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -