📄 ocn_s.h
字号:
/*------------------------------------------------------------------------------*
* File Name: OCN_s.h *
* Creation: TCZ 7/25/2001 *
* Purpose: Origin C Header for NAG functions *
* Copyright (c); OriginLab Corp. 2001 *
* All Rights Reserved *
* *
* Modification Log: *
*------------------------------------------------------------------------------*/
#ifndef _O_NAG_S_H
#define _O_NAG_S_H
#importdll "ONAG" // NAG DLL prepared by OriginLab
#include <NAG\nag_types.h>
/* begin proto */
/** s10aac
returns a value for the hyperbolic tangent, tanh 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_tanh()
{
double y;
double x[] = { -20.0, -5.0, 0.5, 5.0};
printf(" x y\n");
for(int i = 0; i < 4; i++)
{
y = nag_tanh(x[i]);
printf("%12.1f%12.5f\n", x[i], y);
}
}
The output if following:
x y
-20.0 -1.00000
-5.0 -0.99991
0.5 0.46212
5.0 0.99991
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_tanh function.
*/
double nag_tanh(
double x // the argument x of the function.
);
/** s10abc
returns the value of the hyperbolic sine, sinh 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_sinh()
{
double y;
double x[] = {-10.0, -0.5, 0.0, 0.5, 25.0};
printf(" x y\n");
for(int i = 0; i < 5; i++)
{
y = nag_sinh(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-1.000e+01 -1.101e+04
-5.000e-01 -5.211e-01
0.000e+00 0.000e+00
5.000e-01 5.211e-01
2.500e+01 3.600e+10
Parameters:
Return:
This function returns NAG error code, 0 if no error.
5: On entry, |x| must not be greater than _value_: x = _value_. The function has been called with an argument too large in absolute magnitude. There is a danger of setting over.ow. The result is the value of sinh at the closest argument for which a valid call could be made.
successfully call of the nag_sinh function.
*/
double nag_sinh(
double x, // the argument x of the function.
NagError* fail = NULL
);
/** s10acc
returns the value of the hyperbolic cosine, cosh 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_cosh()
{
double y;
double x[] = {-10.0, -0.5, 0.0, 0.5, 25.0};
printf(" x y\n");
for(int i = 0; i < 5; i++)
{
y = nag_cosh(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-1.000e+01 1.101e+04
-5.000e-01 1.128e+00
0.000e+00 1.000e+00
5.000e-01 1.128e+00
2.500e+01 3.600e+10
Parameters:
Return:
This function returns NAG error code, 0 if no error.
7: On entry, |x| must not be greater than _value_: x = _value_. The function has been called with an argument too large in absolute magnitude. There is a danger of over.ow. The result returned is the value of cosh x at the nearest valid argument.
successfully call of the nag_cosh function.
*/
double nag_cosh(
double x, // the argument x of the function.
NagError* fail = NULL
);
/** s11aac
returns the value of the inverse hyperbolic tangent, arctanh 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_arctanh()
{
double y;
double x[] = {-0.5, 0.0, 0.5, -0.9999};
printf(" x y\n");
for(int i = 0; i < 4; i++)
{
y = nag_arctanh(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-5.000e-01 -5.493e-01
0.000e+00 0.000e+00
5.000e-01 5.493e-01
-9.999e-01 -4.952e+00
Parameters:
Return:
This function returns NAG error code, 0 if no error.
8: On entry, |x| must not be greater than or equal to 1.0: x = _value_. The function has been called with an argument greater than or equal to 1.0in magnitude, for which arctanh is not de.ned. The result is returned as zero.
successfully call of the nag_arctanh function.
*/
double nag_arctanh(
double x, // the argument x of the function.
NagError* fail = NULL
);
/** s11abc
returns the value of the inverse hyperbolic sine, arcsinh 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_arcsinh()
{
double y;
double x[] = {-2.0, -0.5, 1.0, 6.0};
printf(" x y\n");
for(int i = 0; i < 4; i++)
{
y = nag_arcsinh(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
-2.000e+00 -1.444e+00
-5.000e-01 -4.812e-01
1.000e+00 8.814e-01
6.000e+00 2.492e+00
Parameters:
Return:
This function returns NAG error code, 0 if no error.
sucessfully call of the nag_arcsinh function.
*/
double nag_arcsinh(
double x // the argument x of the function.
);
/** s11acc
returns the value of the inverse hyperbolic cosine, arccoshx.
The result is in the principal positive branch.
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_arccosh()
{
double y;
double x[] = {1.00, 2.0, 5.0, 10.0};
printf(" x y\n");
for(int i = 0; i < 4; i++)
{
y = nag_arccosh(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e+00 0.000e+00
2.000e+00 1.317e+00
5.000e+00 2.292e+00
1.000e+01 2.993e+00
Parameters:
Return:
This function returns NAG error code, 0 if no error.
5: On entry, x must not be less than 1.0: x = _value_. arccosh x is not de.ned and the result returned is zero.
successfully call of the nag_arccosh function.
*/
double nag_arccosh(
double x, // the argument x of the function.
NagError* fail = NULL
);
/** s13aac
returns the value of the exponential integral E1(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_exp_integral()
{
double y;
double x[] = {2.0, 9.0};
printf(" x y\n");
for(int i = 0; i < 2; i++)
{
y = nag_exp_integral(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
2.000e+00 4.890e-02
9.000e+00 1.245e-05
Parameters:
Return:
This function returns NAG error code, 0 if no error.
6: On entry, x must not be less than or equal to 0.0: x = _value_. The function is not de.ned for this value and the result returned is zero.
successfully call of the nag_exp_integral function.
*/
double nag_exp_integral(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s13acc
returns the value of the cosine integral Ci(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_cos_integral()
{
double y;
double x[] = {0.2, 0.4, 0.6, 0.8, 1.0};
printf(" x y\n");
for(int i = 0; i < 5; i++)
{
y = nag_cos_integral(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
2.000e-01 -1.042e+00
4.000e-01 -3.788e-01
6.000e-01 -2.227e-02
8.000e-01 1.983e-01
1.000e+00 3.374e-01
Parameters:
Return:
This function returns NAG error code, 0 if no error.
6: On entry, x must not be less than or equal to 0.0: x = _value_. The function is not de.ned for this value and the result returned is zero.
successfully call of the nag_cos_integral function.
*/
double nag_cos_integral(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s13adc
returns the value of the sine integral Si(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_sin_integral()
{
double y;
double x[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
printf(" x y\n");
for(int i = 0; i < 6; i++)
{
y = nag_sin_integral(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
0.000e+00 0.000e+00
2.000e-01 1.996e-01
4.000e-01 3.965e-01
6.000e-01 5.881e-01
8.000e-01 7.721e-01
1.000e+00 9.461e-01
Parameters:
Return:
This function returns NAG error code, 0 if no error.
successfully call of the nag_sin_integral function.
*/
double nag_sin_integral(
double x // the argument x of the function.
);
/** s14aac
returns the value of the Gamma function G(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_gamma()
{
double y;
double x[] = {1.0, 1.25, 1.5, 1.75, 2.0, 5.0, 10.0, -1.5};
printf(" x y\n");
for(int i = 0; i < 8; i++)
{
y = nag_gamma(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e+00 1.000e+00
1.250e+00 9.064e-01
1.500e+00 8.862e-01
1.750e+00 9.191e-01
2.000e+00 1.000e+00
5.000e+00 2.400e+01
1.000e+01 3.629e+05
-1.500e+00 2.363e+00
Parameters:
Return:
This funtion returns NAG error code, 0 if no error.
7: On entry, x must not be greater than _value_: x = _value_. The argument is too large, the function returns the approximate value of G(x) at the nearest valid argument.
5: On entry, x must not be less than _value_: x = _value_. The argument is too large and negative, the function returns zero.
692: On entry, x must be greater than _value_: x = _value_. The argument is too close to zero, the function returns the approximate value of G(x) at the nearest valid argument.
693: On entry, x must not be e.ectively a negative integer: x = _value_. The argument is a negative integer, at which values G(x) is in.nite. The function returns a large positive value.
successfully call of the nag_gamma function.
*/
double nag_gamma(
double x, // the argument x of the function.
NagError *fail = NULL
);
/** s14abc
returns a value for the logarithm of the Gamma function, ln G(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_log_gamma()
{
double y;
double x[] = {1.0, 1.25, 1.5, 1.75, 2.0, 5.0, 10.0, 20.0, 1000.0};
printf(" x y\n");
for(int i = 0; i < 9; i++)
{
y = nag_log_gamma(x[i]);
printf("%12.3e%12.3e\n", x[i], y);
}
}
The output is following:
x y
1.000e+00 0.000e+00
1.250e+00 -9.827e-02
1.500e+00 -1.208e-01
1.750e+00 -8.440e-02
2.000e+00 0.000e+00
5.000e+00 3.178e+00
1.000e+01 1.280e+01
2.000e+01 3.934e+01
1.000e+03 5.905e+03
Parameters:
Return:
This function returns NAG error code, 0 if no error.
6: On entry, x must not be less than or equal to 0.0: x = _value_. For zero and negative values the function is undefined, the function returns zero.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -