红宝石 |数学 acosh()函数
acosh()是 Ruby 中的内置函数,返回以弧度给出的角度的反双曲余弦值。
Syntax: Math.acosh(value)
Parameters: The function accepts one mandatory parameter value which specifies the inverse hyperbolic angle in radian which should be greater or equal to 1. If the argument is less than 1, domain error is returned.
Return Value: The function returns the inverse hyperbolic sine of the argument in radians which is in the range [0, inf].
示例 1 :
#Ruby program for acosh() function
#Assigning values
val1 = 2 val2 = 877 val3 = 432 val4 = 43
#Prints the acosh() value
puts Math.acosh(val1)
puts Math.acosh(val2)
puts Math.acosh(val3)
puts Math.acosh(val4)
输出:
1.3169578969248166
7.469653847888966
6.761571429209457
4.454212060602711
示例 2 :
#Ruby program for acosh() function
#Assigning values
val1 = 20 val2 = 83 val3 = 332 val4 = 3
#Prints the acosh() value
puts Math.acosh(val1)
puts Math.acosh(val2)
puts Math.acosh(val3)
puts Math.acosh(val4)
输出:
3.6882538673612966
5.111951496643704
6.498279881360139
1.762747174039086
参考:https://devdocs.io/ruby~2.5/cmath#method-i-acosh