Python – math.asinh()函数
数学模块包含许多用于数学运算的函数。 math.asinh()函数返回数字的双曲反正弦值。
Syntax: math.asinh(x)
Parameter:This method accepts only single parameters.
- x :This parameter is the value to be passed to asinh()
Returns:This function returns the hyperbolic arc sine value of a number.
下面的例子说明了上述函数的使用:
示例 1:
# Python code to implement
# the asinh()function
# importing "math"
# for mathematical operations
import math
# Return the hyperbolic arc sine value of numbers
print (math.asinh(17))
print (math.asinh(5.6))
print (math.asinh(245))
print (math.asinh(-3445))
输出:
3.5272244561999657
2.4237920435875173
6.194409556009931
-8.837826385072708
示例 2:
# Python code to implement
# the aasinh()function
import math
import matplotlib.pyplot as plt
in_array = [-0.14159265, -0.57039399, -0.28559933,
0.28559933, 0.57039399, 0.94159265]
out_array = []
for i in range(len(in_array)):
out_array.append(math.asinh(in_array[i]))
i += 1
print("Input_Array : \n", in_array)
print("\nOutput_Array : \n", out_array)
plt.plot(in_array, out_array, "go:")
plt.title("math.asinh()")
plt.xlabel("X")
plt.ylabel("Y")
plt.show()
输出:
Input_Array :
[-0.14159265, -0.57039399, -0.28559933, 0.28559933, 0.57039399, 0.94159265]
Output_Array :
[-0.14112374861052449, -0.5432727660031201, -0.28185270483975433, 0.28185270483975433, 0.5432727660031201, 0.8394645626112472]