nustack
ReferenceNu STD

math

Nu surface for Python's `math` module.

Module nustd.math.

Nu surface for Python's math module.

math is a function module - module-level functions and constants, no central class - so the Nu surface mirrors that: free functions (sqrt, sin, gcd, ...) and constants (pi, e, tau, inf, nan). Two layers behind it: functions (the wrappers and constants) and interactions (the atoms each wrapper builds). Import it the way you would the stdlib:

from nustd.math import sqrt, pi
import nustd.math as math     # then math.sqrt(2), math.floor(3.7)

Call

NameCallMeaning
acosmath.acos(x)The arc cosine of x, in radians: mirrors math.acos().
asinmath.asin(x)The arc sine of x, in radians: mirrors math.asin().
atanmath.atan(x)The arc tangent of x, in radians: mirrors math.atan().
atan2math.atan2(y, x)The arc tangent of y/x, respecting quadrant: mirrors math.atan2().
ceilmath.ceil(x)The ceiling of x as an int: mirrors math.ceil().
copysignmath.copysign(x, y)x with the sign of y: mirrors math.copysign().
cosmath.cos(x)The cosine of x radians: mirrors math.cos().
degreesmath.degrees(x)Radians x converted to degrees: mirrors math.degrees().
expmath.exp(x)e raised to x: mirrors math.exp().
fabsmath.fabs(x)The absolute value of x as a float: mirrors math.fabs().
factorialmath.factorial(x)x factorial: mirrors math.factorial().
floormath.floor(x)The floor of x as an int: mirrors math.floor().
fmodmath.fmod(x, y)The C-library fmod of x and y: mirrors math.fmod().
gcdmath.gcd(a, b)The greatest common divisor of a and b: mirrors math.gcd().
hypotmath.hypot(x, y)The Euclidean norm sqrt(x*x + y*y): mirrors math.hypot().
isclosemath.isclose(a, b)Whether a and b are close: mirrors math.isclose().
isfinitemath.isfinite(x)Whether x is finite: mirrors math.isfinite().
isinfmath.isinf(x)Whether x is positive or negative infinity: mirrors math.isinf().
isnanmath.isnan(x)Whether x is NaN: mirrors math.isnan().
isqrtmath.isqrt(x)The integer square root of x: mirrors math.isqrt().
logmath.log(x, base=None)The logarithm of x (natural, or to base): mirrors math.log().
log2math.log2(x)The base-2 logarithm of x: mirrors math.log2().
log10math.log10(x)The base-10 logarithm of x: mirrors math.log10().
powmath.pow(base, exp)base raised to exp: mirrors math.pow().
radiansmath.radians(x)Degrees x converted to radians: mirrors math.radians().
sinmath.sin(x)The sine of x radians: mirrors math.sin().
sqrtmath.sqrt(x)The square root of x: mirrors math.sqrt().
tanmath.tan(x)The tangent of x radians: mirrors math.tan().
truncmath.trunc(x)x truncated toward zero as an int: mirrors math.trunc().

acos

The arc cosine of x, in radians: mirrors math.acos().

math.acos(x)

Path nustd.math.acos. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

asin

The arc sine of x, in radians: mirrors math.asin().

math.asin(x)

Path nustd.math.asin. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

atan

The arc tangent of x, in radians: mirrors math.atan().

math.atan(x)

Path nustd.math.atan. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

atan2

The arc tangent of y/x, respecting quadrant: mirrors math.atan2().

math.atan2(y, x)

Path nustd.math.atan2. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
yFloatArg
xFloatArg

Undocumented: example.

ceil

The ceiling of x as an int: mirrors math.ceil().

math.ceil(x)

Path nustd.math.ceil. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

copysign

x with the sign of y: mirrors math.copysign().

math.copysign(x, y)

Path nustd.math.copysign. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg
yFloatArg

Undocumented: example.

cos

The cosine of x radians: mirrors math.cos().

math.cos(x)

Path nustd.math.cos. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

degrees

Radians x converted to degrees: mirrors math.degrees().

math.degrees(x)

Path nustd.math.degrees. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

exp

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

math.exp(x)

Path nustd.math.exp. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

fabs

The absolute value of x as a float: mirrors math.fabs().

math.fabs(x)

Path nustd.math.fabs. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

factorial

x factorial: mirrors math.factorial().

math.factorial(x)

Path nustd.math.factorial. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
xIntArg

Undocumented: example.

floor

The floor of x as an int: mirrors math.floor().

math.floor(x)

Path nustd.math.floor. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

fmod

The C-library fmod of x and y: mirrors math.fmod().

math.fmod(x, y)

Path nustd.math.fmod. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg
yFloatArg

Undocumented: example.

gcd

The greatest common divisor of a and b: mirrors math.gcd().

math.gcd(a, b)

Path nustd.math.gcd. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
aIntArg
bIntArg

Undocumented: example.

hypot

The Euclidean norm sqrt(x*x + y*y): mirrors math.hypot().

math.hypot(x, y)

Path nustd.math.hypot. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg
yFloatArg

Undocumented: example.

isclose

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

math.isclose(a, b)

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

Arguments

NameTypeDefaultMeaning
aFloatArg
bFloatArg

Undocumented: example.

isfinite

Whether x is finite: mirrors math.isfinite().

math.isfinite(x)

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

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

isinf

Whether x is positive or negative infinity: mirrors math.isinf().

math.isinf(x)

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

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

isnan

Whether x is NaN: mirrors math.isnan().

math.isnan(x)

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

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

isqrt

The integer square root of x: mirrors math.isqrt().

math.isqrt(x)

Path nustd.math.isqrt. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
xIntArg

Undocumented: example.

log

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

math.log(x, base=None)

Path nustd.math.log. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg
baseFloatArg | NoneNone

Undocumented: example.

log2

The base-2 logarithm of x: mirrors math.log2().

math.log2(x)

Path nustd.math.log2. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

log10

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

math.log10(x)

Path nustd.math.log10. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

pow

base raised to exp: mirrors math.pow().

math.pow(base, exp)

Path nustd.math.pow. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
baseFloatArg
expFloatArg

Undocumented: example.

radians

Degrees x converted to radians: mirrors math.radians().

math.radians(x)

Path nustd.math.radians. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

sin

The sine of x radians: mirrors math.sin().

math.sin(x)

Path nustd.math.sin. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

sqrt

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

math.sqrt(x)

Path nustd.math.sqrt. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

tan

The tangent of x radians: mirrors math.tan().

math.tan(x)

Path nustd.math.tan. Defined on nustd.math.functions, bound as a function. Builds Float.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

trunc

x truncated toward zero as an int: mirrors math.trunc().

math.trunc(x)

Path nustd.math.trunc. Defined on nustd.math.functions, bound as a function. Builds Int.

Arguments

NameTypeDefaultMeaning
xFloatArg

Undocumented: example.

On this page