红宝石 |数学 asinh()函数
asinh()是 Ruby 中的一个内置函数,它返回以弧度给出的角度的反双曲正弦值。它接受范围(-INFINITY, INFINITY)之间的所有值。
Syntax: Math.asinh(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 an angle given in radians. The range is between (-INFINITY, INFINITY)
示例 1 :
Ruby
#Ruby program for asinh() function
#Assigning values
val1 = 2 val2 = 877 val3 = 432 val4 = 43
#Prints the asinh() value
puts Math.asinh(val1)
puts Math.asinh(val2)
puts Math.asinh(val3)
puts Math.asinh(val4)
Ruby
#Ruby program for asinh() function
#Assigning values
val1 = -24 val2 = -765 val3 = -98 val4 = -23
#Prints the asinh() value
puts Math.asinh(val1)
puts Math.asinh(val2)
puts Math.asinh(val3)
puts Math.asinh(val4)
输出:
1.4436354751788103
7.4696544979749735
6.761574108393271
4.45448247706051
示例 2 :
红宝石
#Ruby program for asinh() function
#Assigning values
val1 = -24 val2 = -765 val3 = -98 val4 = -23
#Prints the asinh() value
puts Math.asinh(val1)
puts Math.asinh(val2)
puts Math.asinh(val3)
puts Math.asinh(val4)
输出:
-3.8716347563877314
-7.333023441572332
-5.278140689034662
-3.8291136516208812
参考:https://devdocs.io/ruby~2.5/math#method-i-asinh