sinh_带有Python示例的math.sinh()方法

sinh

Python math.sinh()方法 (Python math.sinh() method)

math.sinh() method is a library method of math module, it is used to get the hyperbolic sine of given number in radians, it accepts a number and returns hyperbolic sine.

math.sinh()方法数学模块的库方法,用于获取以弧度为单位的给定数字的双曲正弦值,它接受一个数字并返回双曲正弦值。

Note: math.sinh() method accepts only numbers, if we provide anything else except the number, it returns error TypeError"TypeError: a float is required".

注意: math.sinh()方法仅接受数字,如果我们提供除数字以外的任何其他内容,它将返回错误TypeError“ TypeError:需要浮点数”

Syntax of math.sinh() method:

math.sinh()方法的语法:

    math.sinh(x)

Parameter(s): x – is the number whose hyperbolic sine to be calculated.

参数: x –是要计算其双曲正弦值的数字。

Return value: float – it returns a float value that is the hyperbolic sine value of the number x.

返回值: float-它返回一个浮点值,它是数字x的双曲正弦值。

Example:

例:

    Input:
    x = 1.5

    # function call
    print(math.sinh(x))

    Output:
    2.1292794550948173

Python代码演示math.sinh()方法的示例 (Python code to demonstrate example of math.sinh() method)

# Python code to demonstrate example of 
# math.sinh() method

# importing math module
import math 

# number 
x = -10
print("math.sinh(",x,"): ", math.sinh(x))

x = 0
print("math.sinh(",x,"): ", math.sinh(x))

x = 1.5
print("math.sinh(",x,"): ", math.sinh(x))

x = 5
print("math.sinh(",x,"): ", math.sinh(x))

x = 15.45
print("math.sinh(",x,"): ", math.sinh(x))

Output

输出量

math.sinh( -10 ):  -11013.232874703393
math.sinh( 0 ):  0.0
math.sinh( 1.5 ):  2.1292794550948173
math.sinh( 5 ):  74.20321057778875
math.sinh( 15.45 ):  2563419.889913433

TypeError example

TypeError示例

# Python code to demonstrate example of 
# math.sinh() method with exception

# importing math module
import math 

# number 
x = "2.5"
print("math.sinh(",x,"): ", math.sinh(x))

Output

输出量

Traceback (most recent call last):
  File "/home/main.py", line 9, in <module>
    print("math.sinh(",x,"): ", math.sinh(x))
TypeError: a float is required


翻译自: https://www.includehelp.com/python/math-sinh-method-with-example.aspx

sinh

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值