Skip to main content

python零依赖数学库

Project description

nbmath

一个实用的数学工具包,支持方程求解、几何计算、统计分析等功能。

安装

pip install nbmath

快速开始

from nbmath.equation import solve
from nbmath.const import pi

#解方程
print(solve(1, -3, 2)) #[(2+0j), (1+0j)]

#调用常数
print(pi()) #3.141592653589793

模块介绍

常数模块nbmath.const

  • pi tau e - 数学常数
  • G g k NA - 物理常数

方程模块nbmath.solve

  • 一元一次/二次/三次/四次方程求解
  • 牛顿迭代法解高次方程
  • 统一接口solve

几何模块nbmath.geometry

  • Point
  • 线段Line
  • Circle
  • 多边形Polygon

统计模块nbmath.stats

  • mean平均数 percentile百分位数
  • mode众数 var方差 std标准差

工具模块nbmath.utils

  • gcd最大公约数 lcm最小公倍数
  • floor向下取整 trunc截断取整
  • fac阶乘 diff多项式求导
  • np.linspace纯python实现
  • polyval多项式代入求值
  • timer计时器

示例代码

from nbmath.equation import solve
from nbmath.stats import mode

#求解x^4-10x^2+9=0
roots = solve(1, 0, -10, 0, 9)
print(roots) #接近±1,±3,浮点误差可能存在,请以实际使用为准

data = [1, 1, 2, 3, 4]
print(mode(data)) #[1]

许可证

MIT

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

nbmath-0.1.6.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

nbmath-0.1.6-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file nbmath-0.1.6.tar.gz.

File metadata

  • Download URL: nbmath-0.1.6.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nbmath-0.1.6.tar.gz
Algorithm Hash digest
SHA256 dd0a8bb54630ccfbe14787adca988bb7a6605901f48f38b928a439286fd0dc25
MD5 298ac8ce92fb05a09f6438eb2d497421
BLAKE2b-256 5492867d2e24e3ea336ad49d7a6f7b0cb0534e243a5ebf5b3ad2d184d32c78e2

See more details on using hashes here.

File details

Details for the file nbmath-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: nbmath-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nbmath-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fefe9c6393ce70a27d440f820acbdb25b1d517c9f10a5da155ccbfd3067f9e5e
MD5 5a1ba3de93c50b55aa13dbec845ad035
BLAKE2b-256 a5aeeb9cd1937b20cc76462a1fe852510a5bed33ae7f081dce38cac7fe91a69b

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