Skip to main contentModule prelude
Source pub use crate::catalan;
- factorization
- Prime factorization helpers.
- geode
- sieve
- Prime sieves and sieve-backed prime generation.
- Aabb2
- An axis-aligned bounding box represented by inclusive minimum and maximum corners.
- Angle
- Explicit angle value stored in radians.
- Bernoulli
- A Bernoulli distribution with a single success probability.
- Circle
- A circle in 2D Euclidean space.
- Complex
- A complex number stored in rectangular form.
- Differentiator
- Finite-difference differentiation configuration.
- Imaginary
- A standalone imaginary value.
- IntegrationInterval
- A finite interval for definite integration.
- Integrator
- Numerical integration configuration.
- Interval
- A mathematical interval described by a lower and upper bound.
- LimitApproximator
- Symmetric two-sided limit approximation settings.
- Line2
- An infinite 2D line represented by two sample points.
- LinearEquation
- A linear equation of the form
ax + b = 0. - LinearSystem2
- A
2x2 linear system of the form: - Matrix2
- A 2x2 matrix stored in row-major order.
- Matrix3
- A 3x3 matrix stored in row-major order.
- Matrix4
- A 4x4 matrix stored in row-major order.
- Modular
- A normalized modular residue paired with its positive modulus.
- Point2
- A 2D point represented with
f64 coordinates. - Polynomial
- A polynomial whose coefficients are stored in ascending power order.
- Probability
- A validated probability value in the closed interval
[0, 1]. - QuadraticEquation
- A quadratic equation of the form
ax^2 + bx + c = 0. - Rational
- A normalized exact rational number.
- Real
- A validated finite
f64 value. - RealInterval
- A checked closed interval
[min, max] over finite real values. - Segment2
- A finite line segment between two 2D points.
- Triangle
- A constructed 2D triangle represented by three vertices.
- TypeVector
- Finite hyper-Catalan type vectors of the form
[m2, m3, m4, ...]. - Vector2
- A 2D vector represented with
f64 components.
- Bound
- A lower or upper bound for an interval endpoint.
- CalculusError
- Errors returned by numerical-calculus helpers.
- CatalanError
- Errors returned by checked Catalan-family helpers.
- CombinatoricsError
- Errors returned by checked combinatorics helpers.
- GeodeError
- Errors returned by checked Geode helpers.
- GeometryError
- Errors returned by validated geometry constructors.
- IntegerError
- Errors produced by integer helper operations.
- IntegerSign
- Sign classification for a signed integer value.
- LinearError
- Errors returned by linear helpers when a system cannot be solved.
- NumberCategory
- Broad categories for raw
f64 values. - NumberSign
- Sign classes for raw numeric values that are not
NaN. - Orientation2
- The winding order of three 2D points.
- ProbabilityError
- Errors returned by validated probability helpers.
- RationalError
- Errors returned by validated rational-number helpers.
- RealError
- Errors returned by validated real-number helpers.
- Roots
- Real-root outcomes for the small equation helpers in this crate.
- SeriesError
- Errors returned by checked progression helpers.
- StatisticsError
- Errors returned by statistics helpers when the input cannot support the requested summary.
- GOLDEN_RATIO
- The golden ratio as an
f64. - GOLDEN_RATIO_F32
- The golden ratio as an
f32. - SQRT_3
- The square root of three as an
f64. - SQRT_3_F32
- The square root of three as an
f32.
- RootSolver
- Shared trait for equation types that can solve themselves.
- aabb_from_points
- Creates a bounding box from any two corners.
- approx_eq
- Compares two real values with an explicit non-negative tolerance.
- are_coprime
- Returns whether two integers share no positive common divisor other than one.
- are_disjoint
- Returns whether
left and right share no common members. - arithmetic_nth_term
- Returns the zero-based
indexth term of an arithmetic progression. - arithmetic_sum
- Returns the sum of the first
terms values of an arithmetic progression. - catalan
- Returns the
nth Catalan number using checked u128 arithmetic. - central_difference
- Approximates the first derivative with a central difference.
- checked_add
- Commonly used facade items.
Returns
left + right, or None on overflow. - checked_div_ceil
- Commonly used facade items.
Returns the mathematical ceiling of
dividend / divisor. - checked_div_floor
- Commonly used facade items.
Returns the mathematical floor of
dividend / divisor. - checked_is_divisible_by
- Commonly used facade items.
Returns whether
value is evenly divisible by divisor. - checked_lcm
- Commonly used facade items.
Computes the least common multiple of two unsigned integers.
- checked_mod_floor
- Commonly used facade items.
Returns the mathematical floor-style remainder of
dividend / divisor. - checked_mul
- Commonly used facade items.
Returns
left * right, or None on overflow. - checked_sub
- Commonly used facade items.
Returns
left - right, or None on overflow. - classify_number
- Classifies a raw
f64 by floating-point category. - classify_number_sign
- Classifies the sign of a raw
f64 while keeping NaN explicit. - classify_sign
- Classifies a signed integer as negative, zero, or positive.
- combinations
- Returns the number of unordered selections of size
k from n items. - contains_member
- Returns whether
value is a member of set. - cos_deg
- Evaluates
cos for a degrees input. - degrees_to_radians
- Converts a degrees value into radians.
- distance_2d
- Returns the Euclidean distance between two 2D points.
- distance_squared_2d
- Returns the squared Euclidean distance between two 2D points.
- div_ceil
- Commonly used facade items.
Returns the mathematical ceiling of
dividend / divisor. - div_floor
- Commonly used facade items.
Returns the mathematical floor of
dividend / divisor. - equivalence
- Returns whether two boolean values are logically equivalent.
- exclusive_or
- Returns the exclusive-or of two boolean values.
- face_count
- Returns the total face count
F = m2 + m3 + m4 + .... - factorial
- Returns
n! using checked u128 arithmetic. - factorization
- Returns the prime factorization of
n as (prime, exponent) pairs. - fuss_catalan
- Returns the
nth Fuss-Catalan number for a positive order. - gcd
- Computes the non-negative greatest common divisor of two signed integers.
- geode
- Returns the Geode coefficient
G[m] for small exact inputs. - geode_memoized
- Returns the Geode coefficient
G[m] using internal memoization. - geometric_nth_term
- Returns the zero-based
indexth term of a geometric progression. - geometric_sum
- Returns the sum of the first
terms values of a geometric progression. - has_inverses
- Returns whether every value in
elements has a two-sided inverse with
respect to identity and operation. - hyper_catalan
- Returns the finite-type hyper-Catalan coefficient for
m. - identity_element
- Returns a two-sided identity element for
operation, if one exists in
elements. - implication
- Returns the material implication
left -> right. - independent_intersection
- Returns the probability of two independent events both happening.
- independent_union
- Returns the probability of at least one of two independent events
happening.
- is_abelian_group
- Returns whether
elements with operation form an abelian group. - is_associative
- Returns whether
operation is associative over elements. - is_closed_under
- Returns whether applying
operation to any pair of values in elements
yields another member of elements. - is_commutative
- Returns whether
operation is commutative over elements. - is_composite
- Returns
true when n is composite. - is_congruent
- Returns
true when a and b are congruent modulo modulus. - is_distributive_over
- Returns whether
multiply distributes over add from both sides on
elements. - is_divisible_by
- Returns whether
value is evenly divisible by divisor. - is_even
- Returns whether an integer is evenly divisible by two.
- is_finite_number
- Returns whether a raw
f64 is finite. - is_group
- Returns whether
elements with operation form a group. - is_monoid
- Returns whether
elements with operation form a monoid. - is_odd
- Returns whether an integer leaves a remainder of one when divided by two.
- is_prime
- Returns
true when n is prime. - is_ring
- Returns whether
elements with add and multiply form a ring. - is_subset
- Returns whether every unique value in
left appears in right. - lcm
- Computes the non-negative least common multiple of two signed integers.
- linear_root
- Returns the real root of
ax + b = 0. - majority
- Returns whether at least two of three inputs are
true. - mean
- Returns the arithmetic mean of
values. - median
- Returns the median of
values. - midpoint_2d
- Returns the midpoint between two 2D points.
- mod_add
- Computes
(a + b) mod modulus and returns the normalized residue. - mod_floor
- Commonly used facade items.
Returns the mathematical floor-style remainder of
dividend / divisor. - mod_inverse
- Computes the multiplicative inverse of
value modulo modulus. - mod_mul
- Computes
(a * b) mod modulus and returns the normalized residue. - mod_normalize
- Normalizes
value into the residue class 0..modulus. - mod_pow
- Computes
base.pow(exponent) mod modulus using exponentiation by squaring. - mod_sub
- Computes
(a - b) mod modulus and returns the normalized residue. - nand
- Returns the NAND of two boolean values.
- next_prime
- Returns the smallest prime strictly greater than
n. - nor
- Returns the NOR of two boolean values.
- normalize_degrees
- Normalizes a degrees value into the interval
[0, 360). - normalize_radians
- Normalizes a radians value into the interval
[0, 2π). - orientation_2d
- Returns the winding order of three 2D points.
- orientation_2d_with_tolerance
- Returns the winding order of three 2D points using an explicit area tolerance.
- permutations
- Returns the number of ordered selections of size
k from n items. - polygon_edge_count
- Returns
E = 1 + 2m2 + 3m3 + 4m4 + ... using checked u128 arithmetic. - polygon_vertex_count
- Returns
V = 2 + m2 + 2m3 + 3m4 + ... using checked u128 arithmetic. - population_std_dev
- Returns the population standard deviation of
values. - population_variance
- Returns the population variance of
values. - previous_prime
- Returns the largest prime strictly less than
n. - prime_factors
- Returns the prime factors of
n, including repeated multiplicities. - primes_up_to
- Returns every prime less than or equal to
limit. - quadratic_roots
- Returns the real roots of
ax^2 + bx + c = 0. - radians_to_degrees
- Converts a radians value into degrees.
- sample_std_dev
- Returns the sample standard deviation of
values using Bessel’s correction. - sample_variance
- Returns the sample variance of
values using Bessel’s correction. - saturating_add
- Commonly used facade items.
Returns the saturating sum of
left and right. - saturating_mul
- Commonly used facade items.
Returns the saturating product of
left and right. - saturating_sub
- Commonly used facade items.
Returns the saturating difference of
left and right. - second_central_difference
- Approximates the second derivative with a central difference.
- set_difference
- Returns the unique members of
left \ right in the order they first appear in left. - set_intersection
- Returns the unique members of
left ∩ right in the order they first appear in left. - set_symmetric_difference
- Returns the unique members that appear in exactly one of
left or right. - set_union
- Returns the unique members of
left ∪ right in first-seen order. - sieve
- Returns a boolean sieve up to and including
limit. - simpson_integral
- Approximates a definite integral with Simpson’s rule.
- sin_deg
- Evaluates
sin for a degrees input. - solve_2x2
- Solves
matrix * x = rhs for x. - solve_linear
- Solves the linear equation
ax + b = 0. - solve_polynomial_degree_1_or_2
- Solves a polynomial when its degree is 0, 1, or 2.
- solve_quadratic
- Solves the quadratic equation
ax^2 + bx + c = 0 over the real numbers. - symmetric_limit
- Approximates a two-sided limit with one symmetric sample scale.
- tan_deg
- Evaluates
tan for a degrees input. - trapezoidal_integral
- Approximates a definite integral with the trapezoidal rule.
- triangle_area
- Returns the 2D triangle area.
- triangle_twice_area
- Returns twice the unsigned 2D triangle area.
- triangle_twice_signed_area
- Returns twice the signed 2D triangle area using the shoelace formula.
- try_orientation_2d
- Returns the winding order of three 2D points with finite coordinates.
- try_orientation_2d_with_tolerance
- Returns the winding order of three finite 2D points using an explicit area tolerance.
- unique_prime_factors
- Returns the unique prime factors of
n in ascending order. - wrapping_add
- Commonly used facade items.
Returns the wrapping sum of
left and right. - wrapping_mul
- Commonly used facade items.
Returns the wrapping product of
left and right. - wrapping_sub
- Commonly used facade items.
Returns the wrapping difference of
left and right.