nustack
ReferenceStd

nu.std.cmath

Hybrid surface: complex is a builtin with no module of its own, cmath is its companion function set, so the two co-locate here.

from nu.std.cmath import complex, sqrt, phase, pi

Value type

NameSortSignatureEffectMeaning
complexFormcomplex.of(real, imag)purecomplex number; .real/.imag, conjugate(), arithmetic, eq/ne (not orderable)

Functions

NameSortSignatureEffectMeaning
sqrtScalarQuerysqrt(x)puresquare root
expScalarQueryexp(x)puree ** x
logScalarQuerylog(x, base=None)purenatural log, or log to base
log10ScalarQuerylog10(x)purebase-10 log
sinScalarQuerysin(x)puresine
cosScalarQuerycos(x)purecosine
tanScalarQuerytan(x)puretangent
asinScalarQueryasin(x)purearc sine
acosScalarQueryacos(x)purearc cosine
atanScalarQueryatan(x)purearc tangent
sinhScalarQuerysinh(x)purehyperbolic sine
coshScalarQuerycosh(x)purehyperbolic cosine
tanhScalarQuerytanh(x)purehyperbolic tangent
phaseScalarQueryphase(x)purephase angle in radians -> Float
polarScalarQuerypolar(x)pure(r, phi) pair -> Tuple
rectScalarQueryrect(r, phi)purecomplex from modulus + phase
isnanScalarQueryisnan(x)purehas a NaN component -> Bool
isinfScalarQueryisinf(x)purehas an infinite component -> Bool
isfiniteScalarQueryisfinite(x)pureboth components finite -> Bool
iscloseScalarQueryisclose(a, b)pureapproximately equal -> Bool

Constants

NameSortSignatureEffectMeaning
piLiteralpipurefloat pi
eLiteralepurefloat e
tauLiteraltaupurefloat tau (2*pi)
infLiteralinfpurefloat infinity
nanLiteralnanpurefloat NaN
infjLiteralinfjpurecomplex infinity
nanjLiteralnanjpurecomplex NaN

On this page