Skip to main content

一个用于数学计算的Python库

Project description

由mly创建的与数学有关的工具库

附属模块:
  • mlymath.math 数学模块
    • gcd(*nums: int) -> int: 计算多个整数的最大公约数
    • lcm(*nums: int) -> int: 计算多个整数的最小公倍数
    • is_prime(n) -> bool: 判断一个整数是否为素数
    • comb(n: int, k: int) -> int: 计算组合数 C(n, k)
    • pow(x, y): 快速计算 x 的 y 次幂
    • sha256(input_string: str) -> str: 使用 SHA-256 算法加密字符串
    • sha3_256(input_string: str) -> str: 使用 SHA3-256 算法加密字符串
    • sha3_512(input_string: str) -> str: 使用 SHA3-512 算法加密字符串
    • fib_list(n) -> list: 生成包含前 N 项的斐波那契数列
    • fib(n) -> int: 返回第 N 项的斐波那契数
    • pell_list(n) -> list: 生成包含前 N 项的佩尔数列
    • pell(n) -> int: 返回第 N 项的佩尔数
    • factor(n: int) -> list: 分解整数 n 的质因数
    • manhattan_d(point1, point2): 计算两个点之间的曼哈顿距离
    • euclidean_d(point1, point2, precision=None): 计算两个点之间的欧几里得距离,可指定小数位数
    • matrix_add(matrix1, matrix2): 计算两个矩阵的加法
    • matrix_sub(matrix1, matrix2): 计算两个矩阵的减法
    • matrix_mu(matrix1, matrix2): 计算两个矩阵的乘法
    • matrix_transpose(matrix): 计算矩阵的转置
    • matrix_scalar_mul(matrix, scalar): 计算矩阵与标量的乘法
    • list_max(nums, n): 找到数组中第 N 大的数
    • max(*nums, n): 找到多个数中第 N 大的数, 输入n时请注意使用n = [num]
    • list_max_index(nums, n): 找到数组中第 N 大的数的索引
    • max_index(*nums, n): 找到多个数中第 N 大的数的索引, 输入n时请注意使用n = [num]
    • list_min(nums, n): 找到数组中第 N 小的数
    • min(*nums, n): 找到多个数中第 N 小的数, 输入n时请注意使用n = [num]
    • list_min_index(nums, n): 找到数组中第 N 小的数的索引
    • min_index(*nums, n): 找到多个数中第 N 小的数的索引, 输入n时请注意使用n = [num]
    • get_rsa_keys(p: int, q: int) -> Tuple[Tuple[int, int], Tuple[int, int]]: 生成 RSA 公钥和私钥
    • rsa_encrypt(public_key: Tuple[int, int], plaintext: int) -> int: 使用 RSA 公钥加密数据
    • rsa_decrypt(private_key: Tuple[int, int], ciphertext: int) -> int: 使用 RSA 私钥解密数据
  • mlymath.sort 排序模块
    • quick_sort: 使用快速排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • shell_sort: 使用希尔排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • heap_sort: 使用堆排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • bucket_sort: 使用桶排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • insertion_sort: 使用插入排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • bubble_sort: 使用冒泡排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • merge_sort: 使用归并排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • selection_sort: 使用选择排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • counting_sort: 使用计数排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
    • radix_sort: 使用基数排序算法对数组进行排序。可通过 reverse 参数控制排序顺序(默认正序)
  • mlymath.morse 摩斯电码模块
    • morse(input_string): 将字符串转换为摩尔斯电码
    • unmorse(morse_code): 将摩尔斯电码转换为字符串

mly万岁!!!🎉

mly万岁!!!🎉

mly万岁!!!🎉

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlymath-0.1.5.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlymath-0.1.5-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file mlymath-0.1.5.tar.gz.

File metadata

  • Download URL: mlymath-0.1.5.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for mlymath-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0f79e34b0eb694872336cb3d8c76bb058bfd6cb9800b194e6402bee1beeaad4c
MD5 f011ee1cd5014c89c4d086e0b5e0146a
BLAKE2b-256 0c5aca008d283ba7adead85941d474396cf0edd6879a27bee29d0ae2bf71055e

See more details on using hashes here.

File details

Details for the file mlymath-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: mlymath-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for mlymath-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 beb7e6b475908285c6923045386f070071ec29eda42985470ab95e350b88071c
MD5 96bbb1a21d36ee4c93fa922341899e23
BLAKE2b-256 4cb3f78fe20671f34c6116b1f685129c069b38a4ed281e4337f842c2af66cd2a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page