python中acosh_acosh()函数以及C ++中的示例
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.54471C ++代碼演示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.54471Example 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 valuex = 1.0;cout<<"acosh("<<x<<"): "<<acosh(x)<<endl;//domain error with this input valuex = 0.25;cout<<"acosh("<<x<<"): "<<acosh(x)<<endl; return 0; }Output
輸出量
acosh(1): 0 acosh(0.25): -nanReference: C++ acosh() function
參考: C ++ acosh()函數
翻譯自: https://www.includehelp.com/cpp-tutorial/acosh-function-with-example.aspx
python中acosh
總結
以上是生活随笔為你收集整理的python中acosh_acosh()函数以及C ++中的示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 网页设置页数/总页数_图书分配问题(分配
- 下一篇: Python | 查找字符串中每个字符的