Python双曲函数/方法 (Python Hyperbolic functions/methods)

In python programming language, there are some of the built-in functions which are defined in math module – they can be used for hyperbolic calculations (these functions are analogs of trigonometric functions those are based on hyperbolas instead of circles.), python has following Hyperbolic functions, which are used to various purposes.

在python编程语言中 , 数学模块中定义了一些内置函数-它们可用于双曲线计算(这些函数是基于双曲线而不是圆的三角函数的类似物。),python具有以下功能双曲函数 ,用于多种用途。

#myInput{width:100%;font-size:16px;padding:12px 20px 12px 40px;border:1px solid #ddd;margin-bottom:12px}#myTable{border-collapse:collapse;width:100%;border:1px solid #ddd;font-size:18px}#myTable td,#myTable th{text-align:left;padding:2px}#myTable tr{border-bottom:1px solid #ddd}#myTable tr.header,#myTable tr:hover{background-color:#f1f1f1}#myTable a,#myTable a:visited{color:#00f;text-decoration:none}#myTable a:hover{text-decoration:underline} #myInput{width:100%;font-size:16px;padding:12px 20px 12px 40px;border:1px solid #ddd;margin-bottom:12px}#myTable{border-collapse:collapse;width:100%;border:1px solid #ddd;font-size:18px}#myTable td,#myTable th{text-align:left;padding:2px}#myTable tr{border-bottom:1px solid #ddd}#myTable tr.header,#myTable tr:hover{background-color:#f1f1f1}#myTable a,#myTable a:visited{color:#00f;text-decoration:none}#myTable a:hover{text-decoration:underline}

Python中的双曲函数列表 (List of hyperbolic functions in Python)

Hyperbolic functions Description Example
math.acosh() It returns hyperbolic arc cosine of the given number. math.acosh(x)
math.asinh() It returns hyperbolic arc sine of the given number. math.asinh(x)
math.atanh() It returns hyperbolic arc tangent of the given number. math.atanh(x)
math.cosh() It returns hyperbolic cosine of the given number. math.cosh(x)
math.sinh() It returns hyperbolic sine of the given number. math.sinh(x)
math.tanh() It returns hyperbolic tangent of the given number. math.tanh(x)
双曲函数 描述
math.acosh() 它返回给定数字的双曲反余弦。 math.acosh(x)
math.asinh() 它返回给定数字的双曲反正弦。 math.asinh(x)
math.atanh() 它返回给定数字的双曲反正切。 math.atanh(x)
math.cosh() 它返回给定数字的双曲余弦值。 math.cosh(x)
math.sinh() 它返回给定数字的双曲正弦值。 math.sinh(x)
math.tanh() 它返回给定数字的双曲正切。 math.tanh(x)

Python代码演示所有双曲函数的示例 (Python code to demonstrate example of all hyperbolic functions)

# Python code to demonstrate example of
# all hyperbolic functions
# importing math module
import math
# number
x = 1.25
# math.acosh()
print("math.acosh(",x,"): ", math.acosh(x))
# math.asinh()
print("math.asinh(",x,"): ", math.asinh(x))
# math.atanh()
x = 0.56
print("math.atanh(",x,"): ", math.atanh(x))
# math.cosh()
print("math.cosh (",x,"): ", math.cosh(x))
x = 1.25
# math.sinh()
print("math.sinh (",x,"): ", math.sinh(x))
# math.tanh()
print("math.tanh (",x,"): ", math.tanh(x))

Output

输出量

math.acosh( 1.25 ):  0.6931471805599453
math.asinh( 1.25 ):  1.0475930126492587
math.atanh( 0.56 ):  0.632833186665638
math.cosh ( 0.56 ):  1.160940782072458
math.sinh ( 1.25 ):  1.6019190803008256
math.tanh ( 1.25 ):  0.8482836399575129

双曲函数的异常 (Exceptions with hyperbolic functions)

There are two types of exceptions occur,

有两种类型的异常发生,

  • ValueError

    ValueError

    When we provide an invalid value (number), this exception occurs.

    当我们提供无效的值(数字)时,将发生此异常。

  • TypeError

    TypeError

    When we provide a different type of values except a number, this exception occurs.

    当我们提供数字以外的其他类型的值时,会发生此异常。

ValueError example

ValueError示例

# Python code to demonstrate example of
# math.atanh() method with exception
# importing math module
import math
# number
x = -1
print("math.atanh(",x,"): ", math.atanh(x))

Output

输出量

Traceback (most recent call last):
File "/home/main.py", line 9, in <odule>
print("math.atanh(",x,"): ", math.atanh(x))
ValueError: math domain error

TypeError example

TypeError示例

# Python code to demonstrate example of
# math.atanh() method with exception
# importing math module
import math
# number
x = "2"
print("math.atanh(",x,"): ", math.atanh(x))

Output

输出量

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

翻译自: https://www.includehelp.com/python/hyperbolic-functions.aspx

Python中的双曲函数相关推荐

  1. python中复数用法_Python中的复数?

    从实数创建复数.可以使用直接赋值语句或使用complex()函数来创建Python复数. 复数通常在我们使用两个实数的地方使用.例如,由电压(V)和电流(C)定义的电路被用于几何学,科学计算和微积分中 ...

  2. Python中数字类型相关函数介绍

    Python中有三种数字类型:int.float.complex 一.数字类型变量定义 变量定义: x = 10 # int类型 y = 2.2 # float类型 z = 1 + 2j # comp ...

  3. 如何优雅的在python中暂停死循环?

    死循环 有时候在工作中可能会遇到要一直执行某个功能的程序,这时候死循环就派上用途了,python中死循环的具体形式大致如下 while True:run_your_code() 结束死循环 通常我们结 ...

  4. 关于python中的dict和defaultdict

    dict 在Python中如果访问字典中不存在的键,会引发KeyError异常,所以一般当我们比如统计一句话的词频时候,我们总是使用这样的处理方式: strings = ('puppy', 'kitt ...

  5. python中的新式类与旧式类的一些基于descriptor的概念(上)

    python中基于descriptor的一些概念(上) 1. 前言 2. 新式类与经典类 2.1 内置的object对象 2.2 类的方法 2.2.1 静态方法 2.2.2 类方法 2.3 新式类(n ...

  6. Python中yield和yield from的用法

    yield 后面接的是 future 对象 调用方 委托生成器 yield from 直接给出循环后的结果 yield from 委托者和子生成器直接通信 yield from 直接处理stopIte ...

  7. Python中正则表达式用法 重点格式以这个为准_首看_各种问题

    20210811 https://www.jb51.net/article/101258.htm 一.惰性模式的概念: 此模式和贪婪模式恰好相反,它尽可能少的匹配字符以满足正则表达式即可,例如: va ...

  8. 逗号分隔的字符串转换为Python中的列表 split

    将逗号分隔的字符串转换为Python中的列表 给定一个字符串: 它是由逗号分隔的几个值的序列: mStr = '192.168.1.1,192.168.1.2,192.168.1.3' 如何将字符串转 ...

  9. [翻译]Python中yield的解释

    问题: Python中yield关键字的作用是什么?它做了什么? 例如,我想理解以下代码 def node._get_child_candidates(self, distance, min_dist ...

最新文章

  1. 如何让人大致理解RxJava思想:第一节 初步理解RxJava
  2. cmake / cmake --build 如何理解
  3. Springboot/Cloud集成Sentinel 和 入门实战
  4. 【TOJ1132】Square Root,二次同余方程
  5. linux 查看tdagent进程,Zabbix监控记录linux服务器近期的登录情况
  6. 预充电电路工作原理_变频冰箱开关电源电路工作原理及检修。
  7. 分布式数据库进入实时时代,TiDB 5.0 带来了什么?
  8. 8.3实例程序:平面阴影
  9. 程序员vim的最终解决方案
  10. 单向链表存储方式下插入、删除、搜索
  11. win7下让不支持代理的程序使用代理
  12. Ubuntu18.04 安装 Matlab2020a
  13. 计算机视觉资料大合集
  14. windows xp sp3 下载地址
  15. Application Virtualization 4.5 部署【3】
  16. python 相关系数_Python计算皮尔逊 pearson相关系数
  17. 建模实训报告总结_实验报告总结(15篇)
  18. 计算机上平方米的单位,word怎么写平方米 word中平方米的单位怎么打
  19. 阿里巴巴、腾讯投资Barefoot,助力C轮融资8000万美元
  20. Edman降解蛋白测序法的基本步骤解析:耦合和裂解过程

热门文章

  1. Audience新降噪技术或整合进iPad3的A6处理器
  2. Java数组存取名字,题目:用java定义一个student数组,其中保存学生的姓名、学号、性别,还分别保存3门课程的成绩及对应学分,并且按照学分积的降幂进行排序,输出排序结果。...
  3. python中的切片能否修改元祖_Python列表的增删改查和元祖
  4. 小程序点击事件插入激励视频广告实例(小白应该也能懂)
  5. 由浅入深完全理解Java动态代理
  6. 佛说前世的五百次回眸才换来今生的擦肩而过!
  7. 成功解决<pandas.core.groupby.generic.DataFrameGroupBy object at 0x0000024489925F60>
  8. C8051串口调试 C8051
  9. GitHub上收集的最全的前端资源汇总(包括前端学习、求职、开发资源)
  10. python量化交易:Joinquant_量化交易基础【一】:初识量化交易