用 Python 计算双曲正弦


要计算双曲正弦,请在 Python Numpy 中使用 numpy.sinh() 方法。该方法相当于 1/2 * (np.exp(x) - np.exp(-x)) 或 -1j * np.sin(1j*x)。返回相应的双曲正弦值。如果 x 是标量,则这是一个标量。第一个参数 x 是输入数组。第二个和第三个参数是可选的。

第二个参数是一个 ndarray,其中存储结果。如果提供,则它的形状必须是输入广播到的形状。如果未提供或为 None,则返回一个新分配的数组。

第三个参数是在输入上广播的条件。在条件为 True 的位置,out 数组将设置为 ufunc 结果。在其他地方,out 数组将保留其原始值。

步骤

首先,导入所需的库 −

import numpy as np

获取三角双曲正弦。查找 sinh −

print("\nResult...",np.sinh(np.pi*1j))

查找 sinh 90 度 −

print("\nResult...",np.sinh(np.pi/2.))

查找 sinh 60 度 −

print("\nResult...",np.sinh(np.pi/3.))

查找 sinh 45 度 −

print("\nResult...",np.sinh(np.pi/4.))

查找 sinh 30 度 −

print("\nResult...",np.sinh(np.pi/6.))

查找 sinh 0 度 −

print("\nResult...",np.sinh(0))

示例

Open Compiler
import numpy as np # To compute the Hyperbolic sine, use the numpy.sinh() method in Python Numpy # The method is equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x). print("Get the Trigonometric Hyperbolic sine...") # find sinh print("\nResult...",np.sinh(np.pi*1j)) # finding sinh 90 degrees print("\nResult...",np.sinh(np.pi/2.)) # finding sinh 60 degrees print("\nResult...",np.sinh(np.pi/3.)) # finding sinh 45 degrees print("\nResult...",np.sinh(np.pi/4.)) # finding sinh 30 degrees print("\nResult...",np.sinh(np.pi/6.)) # finding sinh 0 degrees print("\nResult...",np.sinh(0))

Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.

输出

Get the Trigonometric Hyperbolic sine...

Result... (-0+1.2246467991473532e-16j)

Result... 2.3012989023072947

Result... 1.2493670505239751

Result... 0.8686709614860095

Result... 0.5478534738880397

Result... 0.0

更新于:28-Feb-2022

449 次浏览

助力您的职业生涯

通过完成课程获得认证

开始学习
广告