nustack
ReferenceNu STDcmath

functions

Module-level functions and constants for `nustd.cmath`.

Module nustd.cmath.functions.

Module-level functions and constants for nustd.cmath.

cmath is a function module - free functions over complex numbers plus a few constants - so this is the function half of the surface: typed wrappers that mirror cmath.sqrt / cmath.phase / cmath.polar 1-1, plus the module constants. Each wrapper builds its interaction atom (lazily imported, like nustd.math) and returns the Form that matches the host return type:

  • most functions -> complex (the Form for the builtin)
  • phase -> Float
  • polar -> Tuple (the (r, phi) pair)
  • isnan / isinf / isfinite / isclose -> Bool
  • rect(r, phi) -> complex

Constants are plain values, so they ride on Literal instead of an atom. pi / e / tau / inf / nan are floats; infj / nanj are complex, so they are wrapped in the complex Form.

NameCallMeaning
acoscmath.acos(x)The arc cosine of x: mirrors cmath.acos().
asincmath.asin(x)The arc sine of x: mirrors cmath.asin().
atancmath.atan(x)The arc tangent of x: mirrors cmath.atan().
coscmath.cos(x)The cosine of x: mirrors cmath.cos().
coshcmath.cosh(x)The hyperbolic cosine of x: mirrors cmath.cosh().
expcmath.exp(x)e raised to x: mirrors cmath.exp().
isclosecmath.isclose(a, b)Whether a and b are close: mirrors cmath.isclose().
isfinitecmath.isfinite(x)Whether both components of x are finite: mirrors cmath.isfinite().
isinfcmath.isinf(x)Whether x has an infinite component: mirrors cmath.isinf().
isnancmath.isnan(x)Whether x has a NaN component: mirrors cmath.isnan().
logcmath.log(x, base=None)The logarithm of x (natural, or to base): mirrors cmath.log().
log10cmath.log10(x)The base-10 logarithm of x: mirrors cmath.log10().
phasecmath.phase(x)The phase angle of x, in radians: mirrors cmath.phase().
polarcmath.polar(x)x as the polar pair (r, phi): mirrors cmath.polar().
rectcmath.rect(r, phi)The complex number with modulus r and phase phi: mirrors cmath.rect().
sincmath.sin(x)The sine of x: mirrors cmath.sin().
sinhcmath.sinh(x)The hyperbolic sine of x: mirrors cmath.sinh().
sqrtcmath.sqrt(x)The square root of x: mirrors cmath.sqrt().
tancmath.tan(x)The tangent of x: mirrors cmath.tan().
tanhcmath.tanh(x)The hyperbolic tangent of x: mirrors cmath.tanh().

acos

The arc cosine of x: mirrors cmath.acos().

cmath.acos(x)

Path nustd.cmath.acos. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

asin

The arc sine of x: mirrors cmath.asin().

cmath.asin(x)

Path nustd.cmath.asin. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

atan

The arc tangent of x: mirrors cmath.atan().

cmath.atan(x)

Path nustd.cmath.atan. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

cos

The cosine of x: mirrors cmath.cos().

cmath.cos(x)

Path nustd.cmath.cos. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

cosh

The hyperbolic cosine of x: mirrors cmath.cosh().

cmath.cosh(x)

Path nustd.cmath.cosh. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

exp

e raised to x: mirrors cmath.exp().

cmath.exp(x)

Path nustd.cmath.exp. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

isclose

Whether a and b are close: mirrors cmath.isclose().

cmath.isclose(a, b)

Path nustd.cmath.isclose. Defined on nustd.cmath.functions, bound as a function. Builds Bool.

Arguments

NameTypeDefaultMeaning
aComplexArg
bComplexArg

Undocumented: example.

isfinite

Whether both components of x are finite: mirrors cmath.isfinite().

cmath.isfinite(x)

Path nustd.cmath.isfinite. Defined on nustd.cmath.functions, bound as a function. Builds Bool.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

isinf

Whether x has an infinite component: mirrors cmath.isinf().

cmath.isinf(x)

Path nustd.cmath.isinf. Defined on nustd.cmath.functions, bound as a function. Builds Bool.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

isnan

Whether x has a NaN component: mirrors cmath.isnan().

cmath.isnan(x)

Path nustd.cmath.isnan. Defined on nustd.cmath.functions, bound as a function. Builds Bool.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

log

The logarithm of x (natural, or to base): mirrors cmath.log().

cmath.log(x, base=None)

Path nustd.cmath.log. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg
baseComplexArg | NoneNone

Undocumented: example.

log10

The base-10 logarithm of x: mirrors cmath.log10().

cmath.log10(x)

Path nustd.cmath.log10. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

phase

The phase angle of x, in radians: mirrors cmath.phase().

cmath.phase(x)

Path nustd.cmath.phase. Defined on nustd.cmath.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

polar

x as the polar pair (r, phi): mirrors cmath.polar().

cmath.polar(x)

Path nustd.cmath.polar. Defined on nustd.cmath.functions, bound as a function. Builds Tuple.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

rect

The complex number with modulus r and phase phi: mirrors cmath.rect().

cmath.rect(r, phi)

Path nustd.cmath.rect. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
rFloatArg
phiFloatArg

Undocumented: example.

sin

The sine of x: mirrors cmath.sin().

cmath.sin(x)

Path nustd.cmath.sin. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

sinh

The hyperbolic sine of x: mirrors cmath.sinh().

cmath.sinh(x)

Path nustd.cmath.sinh. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

sqrt

The square root of x: mirrors cmath.sqrt().

cmath.sqrt(x)

Path nustd.cmath.sqrt. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

tan

The tangent of x: mirrors cmath.tan().

cmath.tan(x)

Path nustd.cmath.tan. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

tanh

The hyperbolic tangent of x: mirrors cmath.tanh().

cmath.tanh(x)

Path nustd.cmath.tanh. Defined on nustd.cmath.functions, bound as a function. Builds complex.

Arguments

NameTypeDefaultMeaning
xComplexArg

Undocumented: example.

On this page