ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# package cmplx `import "math/cmplx"` cmplx包提供了复数的常用常数和常用函数。 ## Index * [func NaN() complex128](#NaN) * [func IsNaN(x complex128) bool](#IsNaN) * [func Inf() complex128](#Inf) * [func IsInf(x complex128) bool](#IsInf) * [func Abs(x complex128) float64](#Abs) * [func Phase(x complex128) float64](#Phase) * [func Polar(x complex128) (r, θ float64)](#Polar) * [func Rect(r, θ float64) complex128](#Rect) * [func Conj(x complex128) complex128](#Conj) * [func Sqrt(x complex128) complex128](#Sqrt) * [func Log(x complex128) complex128](#Log) * [func Log10(x complex128) complex128](#Log10) * [func Exp(x complex128) complex128](#Exp) * [func Pow(x, y complex128) complex128](#Pow) * [func Sin(x complex128) complex128](#Sin) * [func Cos(x complex128) complex128](#Cos) * [func Tan(x complex128) complex128](#Tan) * [func Cot(x complex128) complex128](#Cot) * [func Asin(x complex128) complex128](#Asin) * [func Acos(x complex128) complex128](#Acos) * [func Atan(x complex128) complex128](#Atan) * [func Sinh(x complex128) complex128](#Sinh) * [func Cosh(x complex128) complex128](#Cosh) * [func Tanh(x complex128) complex128](#Tanh) * [func Asinh(x complex128) complex128](#Asinh) * [func Acosh(x complex128) complex128](#Acosh) * [func Atanh(x complex128) complex128](#Atanh) ## func [NaN](https://github.com/golang/go/blob/master/src/math/cmplx/isnan.go#L22 "View Source") ``` func NaN() complex128 ``` 返回一个复数的“Not A Number”值。 ## func [IsNaN](https://github.com/golang/go/blob/master/src/math/cmplx/isnan.go#L11 "View Source") ``` func IsNaN(x complex128) bool ``` 如果x的实部或者虚部是“Not A Number”值,则返回真。 ## func [Inf](https://github.com/golang/go/blob/master/src/math/cmplx/isinf.go#L18 "View Source") ``` func Inf() complex128 ``` 返回一个复数的无穷大,complex(+Inf, +Inf)。 ## func [IsInf](https://github.com/golang/go/blob/master/src/math/cmplx/isinf.go#L10 "View Source") ``` func IsInf(x complex128) bool ``` 如果x的实部或者虚部是无穷(不管正负),则返回真。 ## func [Abs](https://github.com/golang/go/blob/master/src/math/cmplx/abs.go#L12 "View Source") ``` func Abs(x complex128) float64 ``` 返回x的绝对值(也被称为模)。 ## func [Phase](https://github.com/golang/go/blob/master/src/math/cmplx/phase.go#L11 "View Source") ``` func Phase(x complex128) float64 ``` 返回x的相位(也被称为幅角),返回值范围[-Pi, Pi]。 ## func [Polar](https://github.com/golang/go/blob/master/src/math/cmplx/polar.go#L10 "View Source") ``` func Polar(x complex128) (r, θ float64) ``` 将直角坐标的复数表示为极坐标(r, θ)。其中r是x的绝对值,θ是x的相位,范围[-Pi, Pi]。 ## func [Rect](https://github.com/golang/go/blob/master/src/math/cmplx/rect.go#L10 "View Source") ``` func Rect(r, θ float64) complex128 ``` 返回极坐标(r, θ)表示的复数。 ## func [Conj](https://github.com/golang/go/blob/master/src/math/cmplx/conj.go#L8 "View Source") ``` func Conj(x complex128) complex128 ``` 返回x的共轭复数(实部相等,虚部相反)。 ## func [Sqrt](https://github.com/golang/go/blob/master/src/math/cmplx/sqrt.go#L58 "View Source") ``` func Sqrt(x complex128) complex128 ``` 返回x的平方根。返回值的实部不小于0,而虚部的正负号和x的虚部相同。 ## func [Log](https://github.com/golang/go/blob/master/src/math/cmplx/log.go#L57 "View Source") ``` func Log(x complex128) complex128 ``` 返回x的自然对数。 ## func [Log10](https://github.com/golang/go/blob/master/src/math/cmplx/log.go#L62 "View Source") ``` func Log10(x complex128) complex128 ``` 返回x的常用对数。 ## func [Exp](https://github.com/golang/go/blob/master/src/math/cmplx/exp.go#L51 "View Source") ``` func Exp(x complex128) complex128 ``` 返回e\*\*x。 ## func [Pow](https://github.com/golang/go/blob/master/src/math/cmplx/pow.go#L49 "View Source") ``` func Pow(x, y complex128) complex128 ``` 返回x\*\*y;有如下特例: ``` Pow(0, ±0) returns 1+0i Pow(0, c) 如果image(c)==0,则当real(c)<0时返回Inf+0i;否则返回Inf+Inf i ``` ## func [Sin](https://github.com/golang/go/blob/master/src/math/cmplx/sin.go#L53 "View Source") ``` func Sin(x complex128) complex128 ``` 求正弦。 ## func [Cos](https://github.com/golang/go/blob/master/src/math/cmplx/sin.go#L98 "View Source") ``` func Cos(x complex128) complex128 ``` 求余弦。 ## func [Tan](https://github.com/golang/go/blob/master/src/math/cmplx/tan.go#L59 "View Source") ``` func Tan(x complex128) complex128 ``` 求正切。 ## func [Cot](https://github.com/golang/go/blob/master/src/math/cmplx/tan.go#L175 "View Source") ``` func Cot(x complex128) complex128 ``` 求余切。 ## func [Asin](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L51 "View Source") ``` func Asin(x complex128) complex128 ``` 求反正弦。 ## func [Acos](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L94 "View Source") ``` func Acos(x complex128) complex128 ``` 求反余弦。 ## func [Atan](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L142 "View Source") ``` func Atan(x complex128) complex128 ``` 求反正切。 ## func [Sinh](https://github.com/golang/go/blob/master/src/math/cmplx/sin.go#L73 "View Source") ``` func Sinh(x complex128) complex128 ``` 求双曲正弦。 ## func [Cosh](https://github.com/golang/go/blob/master/src/math/cmplx/sin.go#L117 "View Source") ``` func Cosh(x complex128) complex128 ``` 求双曲余弦。 ## func [Tanh](https://github.com/golang/go/blob/master/src/math/cmplx/tan.go#L83 "View Source") ``` func Tanh(x complex128) complex128 ``` 求双曲正切。 ## func [Asinh](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L67 "View Source") ``` func Asinh(x complex128) complex128 ``` 求反双曲正弦。 ## func [Acosh](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L100 "View Source") ``` func Acosh(x complex128) complex128 ``` 求反双曲余弦。 ## func [Atanh](https://github.com/golang/go/blob/master/src/math/cmplx/asin.go#L166 "View Source") ``` func Atanh(x complex128) complex128 ``` 求反双曲正切。