Skip to content

Arithmetic (arith.py)

The Arithmetic module in NumLex provides functions for performing basic arithmetic operations and more complex calculations like roots and factorials.

Functions

  • mod_add(a, b, mod): Performs modular addition.

    result = mod_add(a=7, b=5, mod=3)
  • mod_sub(a, b, mod): Performs modular subtraction.

    result = mod_sub(a=7, b=5, mod=3)
  • mod_mul(a, b, mod): Performs modular multiplication.

    result = mod_mul(a=7, b=5, mod=3)
  • sqrt(x): Calculates the square root of a number.

    root = sqrt(16)
  • curt(x): Calculates the cube root of a number.

    root = curt(27)
  • nthrt(x, n): Calculates the nth root of a number.

    root = nthrt(16, 4)
  • fact(n): Computes the factorial of a number.

    fact = fact(5)