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.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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值