monty.fractions module — monty 2021.8.17 documentation

# monty.fractions module

Math functions.

gcd(*numbers)

  Returns the greatest common divisor for a sequence of numbers.

  Parameters

    *numbers – Sequence of numbers.

  Returns

    (int) Greatest common divisor of numbers.

gcd_float(numbers, tol=1e-08)

  Returns the greatest common divisor for a sequence of numbers. Uses a numerical tolerance, so can be used on floats

  Parameters

    - numbers – Sequence of numbers.

    - tol – Numerical tolerance

  Returns

    (int) Greatest common divisor of numbers.

lcm(*numbers)

  Return lowest common multiple of a sequence of numbers.

  Parameters

    *numbers – Sequence of numbers.

  Returns

    (int) Lowest common multiple of numbers.