当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python math.asinh()用法及代码示例


数学模块包含许多用于数学运算的函数。 math.asinh()函数返回数字的双曲反正弦值。

用法: math.asinh(x)

参数:此方法仅接受单个参数。

  • x:此参数是要传递给asinh()的值

返回值:此函数返回数字的双曲反正弦值。

以下示例说明了上述函数的用法:



范例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]




相关用法


注:本文由纯净天空筛选整理自SHUBHAMSINGH10大神的英文原创作品 Python – math.asinh() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。