📄 ocn_s.h
字号:
}
The output is following:
x ia ja nl
0.5 0 1 3
Requested values of K_alpha(x)
alpha exp(x)K_alpha(x)
0.0000e+00 1.5241e-01
1.0000e+00 2.7310e+00
2.0000e+00 1.2448e+00
3.0000e+00 1.0232e+01
Parameters:
Return:
This function returns NAG error code, 0 if no error.
96: On entry, nu = <value>. Constraint: 1 <= abs(nu) <= 3.
90: On entry, nl = <value>. Constraint: 0<= abs(nl) <= 100.
91: On entry, ia = <value>, ja = <value>. Constraint: ia and ja must constitue a valid pair (ia, ja).
695: The evaluation has been abandoned due to the likelihood of overflow.
696: The evaluation has been completed but some precision has been lost.
697: The evaluation has been abandoned due to total loss of precision. .
698: The evaluation has been abandoned due to failure to satisfy the termination condition.
74: An internal error has occured in this 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_bessel_kalpha_scaled function.
*/
int nag_bessel_kalpha_scaled(
double x, // the argument x of the function.
int ia,
int ja, // the numerator i and denominator j, respectively, of the order alpha = i/j of the first member in the rquered sequence of function values. Only the following combinations of pairs of values of i and j are allowed: (ia,ja) = (0,1), (1,2), (1,3), (1,4), (2,3) or (3,4).
int nl, // the value of N. Note that the order of the last member in the required sequence of function values is given by alpha + N.
double b[] // with fail.code = NE_NOERROR or fail.code = NW_SOME_PRECISION_LOSS, the required sequence of function values: b(n) contains K_alpha+n(x) n = 0, 1, ..., N.
);
/** s18ejc
returns a sequence of values for the modified Bessel functions I_alpha+n-1(x) or I_alpha-n+1(x) for real x, non-negative alpha < 1 and n = 1, 2, ..., |N| + 1.
Example:
The example program evalutes j0(x), j1(x), j2(x) and j3(x) at x = 0.5, and prints the results.
**note this function requires the support of the complex array
*/
int nag_bessel_i_alpha(
double x, // the argument x of the functions.
double a, // the order alpha of the first member in the required sequence of function values.
int nl, // the value of N.
complex *b // with fail.code = NE_NOERROR or fail.code = NW_SOME_PRECISION_LOSS, the required sequence of function values: b(n) contains I_alpha+n-1(x) if nl >= 1 and I_alpha-n+1(x) otherwise, for n = 0, 1, ..., abs(nl) + 1.
);
/** s18ekc
returns a sequence of values for the Bessel functions J_alpha+n-1(x) or
J_alpha-n+1(x) for real x, non-negative alpha < 1 and n = 1, 2, .. , abs(N) +1.
Example:
The example program evalutes j0(x), j1(x), j2(x) and j3(x) at x = 0.5, and prints the results.
void test_nag_bessel_j_alpha()
{
double c_1 = 1.0;
matrix <complex> b;
b.SetSize(1,101);
double a;
double alpha;
double d_1;
double x;
int i, nl;
a = 0.0;
x = 0.5;
nl = 3;
printf("%4.1f %4.1f %6ld\n\n",x, a, nl);
if(nag_bessel_j_alpha(x, a, nl, b) == 0)
{
printf("\n Requested values of I_alpha(x)\n\n");
alpha = a;
printf(" alpha I_alpha(x)\n");
for(i = 1; i <= fabs(nl) + 1; i++)
{
complex cmTemp = b[0][i-1];
printf("%12.4e (%12.4e, %12.4e)\n", alpha, cmTemp.m_re, cmTemp.m_im);
d_1 = 1.0 * nl;
if(d_1 > 0)
alpha = fabs(c_1) + alpha;
else
alpha = -fabs(c_1) + alpha;
}
}
else
printf("there is some problem with the fuction");
}
The output is following:
x a nl
0.5 0.0 3
Requested values of J_alpha(x)
alpha J_alpha(x)
0.0000e+00 (9.3847e-01, 0.0000e+00)
1.0000e+00 (2.4227e-01, 0.0000e+00)
2.0000e+00 (3.0604e-02, 0.0000e+00)
3.0000e+00 (2.5637e-03, 0.0000e+00)
Parameters:
Return:
This function returns NAG error code, 0 if no error.
118: On entry, x = <value>, nl = <value>. Constraint x not equal 0 when nl < 0.
96: On entry, a = <value>. Constraint 0 <= a < 1.
90: On entry, nl = <value>. Constraint: abs(nl) <= 101.
695: The evaluation has been abandoned due to the likelihood of overflow.
696: The evaluation has been completed but some precision has been lost.
697: The evaluation has been abandoned due to total loss of precision.
698: The evaluation has been abandoned due to failure to satisfy the termination condition.
74: An internal error has occured in this 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_bessel_j_alpha function.
*/
int nag_bessel_j_alpha(
double x, // the argument x of the function.
double a, // the order alpha of the first member in the required sequence of function values.
int nl, // the value of N
complex b[], // the dimension, dim1, of the array b must be at least abs(nl) + 1.
NagError *fail = NULL
);
/** s19aac
returns a value for the Kelvin function berx.
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_kelvin_ber()
{
double y;
double x[] ={0.1, 1.0, 2.5, 5.0, 10.0, 15.0, -1.0};
printf(" x y\n");
for(int i = 0; i < 7; i++)
{
y = nag_kelvin_ber(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e-01 1.000e+00
1.000e+00 9.844e-01
2.500e+00 4.000e-01
5.000e+00 -6.230e+00
1.000e+01 1.388e+02
1.500e+01 -2.967e+03
-1.000e+00 9.844e-01
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 for an accurate result to be returned and the function returns zero.
successfully call of the nag_kelvin_ber function.
*/
double nag_kelvin_ber(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s19abc
returns a value for the Kelvin function bei 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_kelvin_bei()
{
double y;
double x[] ={0.1, 1.0, 2.5, 5.0, 10.0, 15.0, -1.0};
printf(" x y\n");
for(int i = 0; i < 7; i++)
{
y = nag_kelvin_bei(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e-01 2.500e-03
1.000e+00 2.496e-01
2.500e+00 1.457e+00
5.000e+00 1.160e-01
1.000e+01 5.637e+01
1.500e+01 -2.953e+03
-1.000e+00 2.496e-01
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 for an accurate result to be returned and the function returns zero.
successfully call of the nag_kelvin_bei function.
*/
double nag_kelvin_bei(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s19acc
returns a value for the Kelvin function ker 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_kelvin_ker()
{
double y;
double x[] ={0.1, 1.0, 2.5, 5.0, 10.0, 15.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y = nag_kelvin_ker(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e-01 2.420e+00
1.000e+00 2.867e-01
2.500e+00 -6.969e-02
5.000e+00 -1.151e-02
1.000e+01 1.295e-04
1.500e+01 -1.514e-08
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 result under.ows and the function returns zero.
12: On entry, x must not be less than or equal to 0.0: x = _value_. The function is undefined and returns zero.
successfully call of the nag_kelvin_ker function.
*/
double nag_kelvin_ker(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s19adc
returns a value for the Kelvin function kei 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_kelvin_kei()
{
double y;
double x[] ={0.1, 1.0, 2.5, 5.0, 10.0, 15.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y = nag_kelvin_kei(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
0.000e+00 -7.854e-01
1.000e-01 -7.769e-01
1.000e+00 -4.950e-01
2.500e+00 -1.107e-01
5.000e+00 1.119e-02
1.000e+01 -3.075e-04
1.500e+01 7.963e-06
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, and the result under.ows and the function returns zero.
11: On entry, x must not be less than 0.0: x = _value_. The function is undefined and returns zero.
successfully call of the nag_kelvin_kei function.
*/
double nag_kelvin_kei(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s20acc
returns a value for the Fresnel Integral S(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_fresnel_s()
{
double y;
double x[] ={0.1, 1.0, 2.5, 5.0, 10.0, 15.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y = nag_fresnel_s(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e-001 5.236e-004
1.000e+000 4.383e-001
2.500e+000 6.192e-001
5.000e+000 4.992e-001
1.000e+001 4.682e-001
1.500e+001 5.000e-001
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_fresnel_s function.
*/
double nag_fresnel_s(
double x // the argument x of the function.
);
/** s20adc
returns a value for the Fresnel Integral C(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_fresnel_c()
{
double y;
double x[] ={0.0, 0.5, 1.0, 2.0, 4.0, 5.0, 6.0, 8.0, 10.0, -1.0, 1000.0};
printf(" x y\n");
for(int i = 0; i < 11; i++)
{
y = nag_fresnel_c(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
0.000e+00 0.000e+00
5.000e-01 4.923e-01
1.000e+00 7.799e-01
2.000e+00 4.883e-01
4.000e+00 4.984e-01
5.000e+00 5.636e-01
6.000e+00 4.995e-01
8.000e+00 4.998e-01
1.000e+01 4.999e-01
-1.000e+00 -7.799e-01
1.000e+03 5.000e-01
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_fresnel_c function.
*/
double nag_fresnel_c(
double x // the argument x of the function.
);
/** s21bac
returns a value of an elementary integral, which occurs as a
degenerate case of an elliptic integral of the first kind.
Example:
This example program simply generates a small set of non-extreme arguments
which are used with the function to produce the table of low accuracy results.
void test_nag_elliptic_integral_rc()
{
double rc, x, y;
int ix;
printf(" x y s21bac \n");
for (ix=1; ix<=3; ix++)
{
x = ix*0.5;
y = 1.0;
rc = nag_elliptic_integral_rc(x, y);
printf("%7.2f%7.2f%12.4f\n", x, y, rc);
}
}
The output is following:
x y s21bac
0.50 1.00 1.1107
1.00 1.00 1.0000
1.50 1.00 0.9312
Parameters:
Return:
This function returns NAG error code, 0 if no error.
5: On entry, x must not be less than 0.0: x = _value_. The function is undefined.
10: On entry, y must not be equal to 0.0: y = _value_. The function is undefined and returns zero.
successfully call of the nag_elliptic_integral_rc function.
*/
double nag_elliptic_integral_rc(
double x, // the argument x of the function.
double y, // the argument y of the function.
NagError *fail = NULL
);
/** s21bbc
returns a value of the symmetrised elliptic integral of the first kind.
Example:
This example program simply generates a small set of non-extreme arguments
which are used with the function to produce the table of low accuracy results
void test_nag_elliptic_integral_rf()
{
double rf, x, y, z;
int ix;
printf(" x y z s21bbc\n");
for (ix=1; ix<=3; ix++)
{
x = ix*0.5;
y = (ix+1)*0.5;
z = (ix+2)*0.5;
rf = nag_elliptic_integral_rf(x, y, z);
printf("%7.2f%7.2f%7.2f%12.4f\n", x, y, z, rf);
}
}
The output is following:
x y z s21bbc
0.50 1.00 1.50 1.0281
1.00 1.50 2.00 0.8260
1.50 2.00 2.50 0.7116
Parameters:
Return:
This function returns NAG error code, 0 if no error.
5: On entry, x must not be less than 0.0: x = _value_. On entry, y must not be less than 0.0: y = _value_. On entry, z must not be less than 0.0: z = _value_. The function is undefined.
10: On entry, _parameters_ mu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -