# astar-mathtool **Repository Path**: hoops/astar-mathtool ## Basic Information - **Project Name**: astar-mathtool - **Description**: 基于scipy的数学库 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-03-05 - **Last Updated**: 2026-09-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: math ## README # astar-mathtool [![version](https://img.shields.io/pypi/v/astar-math.svg)](https://pypi.python.org/pypi/astar-math) [![gitee](https://gitee.com/hoops/astar-mathtool/badge/star.svg)](https://gitee.com/hoops/astar-mathtool/stargazers) [![download](https://img.shields.io/pypi/dm/astar-math.svg)](https://pypi.org/project/astar-math) [![wheel](https://img.shields.io/pypi/wheel/astar-math.svg)](https://pypi.python.org/pypi/astar-math) ![licence](https://img.shields.io/pypi/l/astar-math.svg) ![status](https://img.shields.io/pypi/status/astar-math.svg) [![wakatime](https://wakatime.com/badge/user/153c2113-19ae-40fb-ad48-298f9e152099/project/cf5331ea-9042-441c-89d9-68a8aa4f1440.svg)](https://wakatime.com/badge/user/153c2113-19ae-40fb-ad48-298f9e152099/project/cf5331ea-9042-441c-89d9-68a8aa4f1440) 基于 scipy 的科学计算库,提供曲线(平滑/抽稀)、函数体系、线性代数、李群/李代数、模糊数学、最优化等工具。 > 当前版本:**0.2.1** ## 模块一览 - **curve** 曲线计算(`catmullrom_spline` 样条平滑、`bezier` 贝塞尔曲线、`douglas_peucker` 抽稀、辅助几何函数) - **functions** 函数与微积分体系(求导、积分、泰勒展开、复合、区间系统) - **fuzzy** 模糊数学工具(模糊数、模糊矩阵、模糊区间、模糊方程组) - **lie** 李群/李代数相关工具(`SO`/`SE`/`SP`/`RN`/`SIM`、指数映射、`bch`) - **linear_algebra** 线性代数(方程组求解、旋转矩阵) - **numbers** 扩展数字(复数 / 四元数 `Complex`) - **optimize** 最优化模型(非线性方程组求解) - **plot** 绘图函数扩展 - **random** 随机数(约束随机矩阵) - **special** 特殊数学函数(组合数 / 贾宪三角 `combs`) ## 0.2.1 更新要点 ### 新增 - **curve**:新增 Douglas-Peucker 抽稀函数 `douglas_peucker`(支持多维点集,保证被删除点到简化折线的距离不超过阈值);`catmullrom_spline` 全面向量化(吞吐约 9.4M 点/秒);补上 `astar_math.curve` 包级导出,可直接 `from astar_math.curve import ...`。 - **linear_algebra**:新增超定方程组最小二乘求解 `solve_overdetermined_linear_equation`(QR 分解)。 ### 修复 - **curve**:消除 `catmullrom_spline` 段边界重复点(去重后不再产生零长度差分);修复 `catmullrom_use4pt` 标量 `t` 维度退化(返回 `(1, d)` 而非 `(d,)`);辅助函数 `get_vec_v`/`get_p_symm_l`/`get_lineabc_use2pt` 支持 `list` 输入;消除 `np.cross` 在 NumPy 2.0 的弃用告警。 - **linear_algebra**:`solve_mat` 齐次无穷解分支补 LU 分解,修复主元列误判(残差 1.676e-08 → 1.33e-15)。 - **functions**:高阶求导能力收敛进基类 `derivative`(避免链式一阶微分的 `1/h^n` 误差累计);22 个子类 `derivative` 统一支持 `n` 参数(任意阶导数);修复闭包延迟绑定、缓存越界 `IndexError`、高阶导数值爆炸等缺陷。 ### 优化 - **special**:`combs` 改为混合策略(`n<=100` 用 `math.comb` 精确整数,否则向量化累积积),去掉 scipy 依赖,较旧实现提速 1.1~10.4x,并修复大系数失真。 - **测试**:新增抽稀、平滑、高阶求导、齐次/超定方程组等测试用例;保留 `scripts/bench_curve.py` 基准测试作为实测依据。 ## 安装 ```bash pip install astar-math ``` ### 参考资料 [1] https://github.com/ASTARCHEN/astartool [2] https://github.com/astar-club/astar-devopstool-python ### 详细文档 完整 API 文档见 [doc/v_0_2_1.md](doc/v_0_2_1.md),发布说明见 [doc/release/report_v0.2.1.md](doc/release/report_v0.2.1.md)。