python cmath模块_cmath模块-PYTHON

该博客详细介绍了Python的cmath模块,该模块提供了复数的数学运算,包括正弦、余弦、指数、对数等。文章通过示例展示了如何使用cmath.e常数以及各种复数函数,并提供了相关函数的说明,帮助读者理解复数计算。
摘要由CSDN通过智能技术生成

这是一个float型的常数

>>> cmath.e

2.718281828459045

>>> type(cmath.e)

文档

>>> import cmath

>>> help(cmath)

Help on module cmath:

NAME

cmath

FILE

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cmath.so

MODULE DOCS

http://docs.python.org/library/cmath Go

DESCRIPTION

This module is always available. It provides access to mathematical

functions for complex numbers.

FUNCTIONS

acos(...)

acos(x)

Return the arc cosine of x.

acosh(...)

acosh(x)

Return the inverse hyperbolic cosine of x.

asin(...)

asin(x)

Return the arc sine of x.

asinh(...)

asinh(x)

Return the inverse hyperbolic sine of x.

atan(...)

atan(x)

Return the arc tangent of x.

atanh(...)

atanh(x)

Return the inverse hyperbolic tangent of x.

cos(...)

cos(x)

Return the cosine of x.

cosh(...)

cosh(x)

Return the hyperbolic cosine of x.

exp(...)

exp(x)

Return the exponential value e**x.

isinf(...)

isinf(z) -> bool

Checks if the real or imaginary part of z is infinite.

isnan(...)

isnan(z) -> bool

Checks if the real or imaginary part of z not a number (NaN)

log(...)

log(x[, base]) -> the logarithm of x to the given base.

If the base not specified, returns the natural logarithm (base e) of x.

log10(...)

log10(x)

Return the base-10 logarithm of x.

phase(...)

phase(z) -> float

Return argument, also known as the phase angle, of a complex.

polar(...)

polar(z) -> r: float, phi: float

Convert a complex from rectangular coordinates to polar coordinates. r is

the distance from 0 and phi the phase angle.

rect(...)

rect(r, phi) -> z: complex

Convert from polar coordinates to rectangular coordinates.

sin(...)

sin(x)

Return the sine of x.

sinh(...)

sinh(x)

Return the hyperbolic sine of x.

sqrt(...)

sqrt(x)

Return the square root of x.

tan(...)

tan(x)

Return the tangent of x.

tanh(...)

tanh(x)

Return the hyperbolic tangent of x.

DATA

e = 2.718281828459045

pi = 3.141592653589793

>>>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值