Python 的 asinh 函数用于计算指定表达式或数字的三角双曲反正弦。asinh 函数也称为双曲正弦的倒数。
Python 语言中 math asinh 函数的语法如下所示。
math.asinh(number);
Number:用于查找双曲反正弦值的有效数值表达式。
- 如果 number 参数是正数或负数,则函数返回双曲反正弦值。
- 如果不是数字,asinh 函数将返回 TypeError。
Python asinh 函数示例
asinh 函数允许您查找数值的三角双曲反正弦。在此示例中,我们将查找不同数据类型的双曲反正弦值。
import math
Tup = (10, 20, 30, -40 , 50)
Lis = [-15, 25, -32.5, -45.95 , 15.64]
print('Hyperbolic Arc Sine of Positive Number = %.2f' %math.asinh(10))
print('Hyperbolic Arc Sine of Negative Number = %.2f' %math.asinh(-20))
print('Hyperbolic Arc Sine of Tuple Item = %.2f' %math.asinh(Tup[3]))
print('Hyperbolic Arc Sine of List Item = %.2f' %math.asinh(Lis[2]))
print('Hyperbolic Arc Sine of Multiple Numbers = %.2f' %math.asinh(22 + 49 - 27))
print('Hyperbolic Arc Sine of String Value = ', math.asinh('Hello'))

首先,我们直接对正整数和负整数使用了 asinh 函数。以下语句查找相应值的双曲反正弦。
print('Hyperbolic Arc Sine of Positive Number = %.2f' %math.asinh(10))
print('Hyperbolic Arc Sine of Negative Number = %.2f' %math.asinh(-20))
接下来,我们将 asinh 函数用于 元组 和 列表 的项。如您所见,数学函数 在它们上运行良好。
print('Hyperbolic Arc Sine of Tuple Item = %.2f' %math.asinh(Tup[3]))
print('Hyperbolic Arc Sine of List Item = %.2f' %math.asinh(Lis[2]))
接下来,我们将 asinh 函数用于多个值。
print('Hyperbolic Arc Sine of Multiple Numbers = %.2f' %math.asinh(22 + 49 - 27))
在最后一个语句中,我们尝试将 asinh 函数用于字符串值,它返回 TypeError 作为输出。
print('Hyperbolic Arc Sine of String Value = ', math.asinh('Hello'))
请参考 Python sin 函数以了解 Python 正弦函数。