python中acosh
C ++ acosh()函数 (C++ acosh() function)
acosh() function is a library function of cmath header, it is used to find nonnegative area hyperbolic cosine of the given value, it accepts a number (x) and returns the nonnegative area hyperbolic cosine of x.
ACOSH()函数是CMATH报头的库函数,它被用于查找给定值的非负区域双曲余弦,它接受一个数字(x)和返回x的非负区域双曲余弦。
Note: Value of the x should not be less than the 1, if arguments are less than 0, it returns a domain error (-nan).
注意: x的值不应小于1,如果参数小于0,则它将返回域错误( -nan )。
Syntax of acosh() function:
acosh()函数的语法:
acosh(x);
Parameter(s): x – is the number/value whose nonnegative area hyperbolic cosine is calculated.
参数: x –是计算其非负面积双曲余弦的数字/值。
Return value: double – it returns double type value that is the nonnegative area hyperbolic cosine of the given number/value x.
返回值: double-返回double类型的值,它是给定数字/值x的非负面积双曲余弦值。
Example:
例:
Input:
float x = 2.45;
Function call:
acosh(x);
Output:
1.54471
C ++代码演示acosh()函数的示例 (C++ code to demonstrate the example of acosh() function)
// C++ code to demonstrate the example of
// acosh() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
float x;
x = 1.0;
cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;
x = 10.23;
cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;
x = 2.45;
cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;
return 0;
}
Output
输出量
acosh(1): 0
acosh(10.23): 3.01607
acosh(2.45): 1.54471
Example with domain error
域错误示例
If we provide the value less than 1, it returns -nan.
如果提供的值小于1,则返回-nan 。
// C++ code to demonstrate the example of
// acosh() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
float x;
//no error with this input value
x = 1.0;
cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;
//domain error with this input value
x = 0.25;
cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;
return 0;
}
Output
输出量
acosh(1): 0
acosh(0.25): -nan
Reference: C++ acosh() function
参考: C ++ acosh()函数
翻译自: https://www.includehelp.com/cpp-tutorial/acosh-function-with-example.aspx
python中acosh