math-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Table of Contents

目录

Mathematical Algorithm Review

数学算法审查

Intensive analysis ensuring numerical stability and alignment with standards.
通过深度分析确保数值稳定性并符合相关标准。

Quick Start

快速开始

bash
/math-review
Verification: Run the command with
--help
flag to verify availability.
bash
/math-review
验证方式: 运行带
--help
参数的命令以确认技能可用。

When To Use

适用场景

  • Changes to mathematical models or algorithms
  • Statistical routines or probabilistic logic
  • Numerical integration or optimization
  • Scientific computing code
  • ML/AI model implementations
  • Safety-critical calculations
  • 数学模型或算法变更
  • 统计程序或概率逻辑
  • 数值积分或优化
  • 科学计算代码
  • ML/AI模型实现
  • 安全关键型计算

When NOT To Use

不适用场景

  • General algorithm review - use architecture-review
  • Performance optimization - use parseltongue:python-performance
  • General algorithm review - use architecture-review
  • Performance optimization - use parseltongue:python-performance
  • 通用算法审查 - use architecture-review
  • 性能优化 - use parseltongue:python-performance
  • 通用算法审查 - use architecture-review
  • 性能优化 - use parseltongue:python-performance

Required TodoWrite Items

所需TodoWrite事项

  1. math-review:context-synced
  2. math-review:requirements-mapped
  3. math-review:derivations-verified
  4. math-review:stability-assessed
  5. math-review:evidence-logged
  1. math-review:context-synced
  2. math-review:requirements-mapped
  3. math-review:derivations-verified
  4. math-review:stability-assessed
  5. math-review:evidence-logged

Core Workflow

核心工作流

1. Context Sync

1. 上下文同步

bash
pwd && git status -sb && git diff --stat origin/main..HEAD
Verification: Run
git status
to confirm working tree state. Enumerate math-heavy files (source, tests, docs, notebooks). Classify risk: safety-critical, financial, ML fairness.
bash
pwd && git status -sb && git diff --stat origin/main..HEAD
验证方式: 运行
git status
确认工作树状态。 列出涉及大量数学运算的文件(源码、测试、文档、笔记本)。进行风险分类:安全关键型、金融类、ML公平性相关。

2. Requirements Mapping

2. 需求映射

Translate requirements → mathematical invariants. Document pre/post conditions, conservation laws, bounds. Load:
modules/requirements-mapping.md
将需求转化为数学不变量。记录前置/后置条件、守恒定律、边界条件。加载模块:
modules/requirements-mapping.md

3. Derivation Verification

3. 推导验证

Re-derive formulas using CAS. Challenge approximations. Cite authoritative standards (NASA-STD-7009, ASME VVUQ). Load:
modules/derivation-verification.md
使用CAS重新推导公式。质疑近似假设。引用权威标准(NASA-STD-7009、ASME VVUQ)。加载模块:
modules/derivation-verification.md

4. Stability Assessment

4. 稳定性评估

Evaluate conditioning, precision, scaling, randomness. Compare complexity. Quantify uncertainty. Load:
modules/numerical-stability.md
评估条件数、精度、缩放、随机性。比较复杂度。量化不确定性。加载模块:
modules/numerical-stability.md

5. Proof of Work

5. 工作成果验证

bash
pytest tests/math/ --benchmark
jupyter nbconvert --execute derivation.ipynb
Verification: Run
pytest -v tests/math/
to verify. Log deviations, recommend: Approve / Approve with actions / Block. Load:
modules/testing-strategies.md
bash
pytest tests/math/ --benchmark
jupyter nbconvert --execute derivation.ipynb
验证方式: 运行
pytest -v tests/math/
进行验证。 记录偏差,给出建议:批准/附条件批准/阻止。加载模块:
modules/testing-strategies.md

Progressive Loading

渐进式加载

Default (200 tokens): Core workflow, checklists +Requirements (+300 tokens): Invariants, pre/post conditions, coverage analysis +Derivation (+350 tokens): CAS verification, standards, citations +Stability (+400 tokens): Numerical properties, precision, complexity +Testing (+350 tokens): Edge cases, benchmarks, reproducibility
Total with all modules: ~1600 tokens
默认(200 tokens): 核心工作流、检查清单 +需求映射(+300 tokens): 不变量、前置/后置条件、覆盖分析 +推导验证(+350 tokens): CAS验证、标准、引用 +稳定性评估(+400 tokens): 数值属性、精度、复杂度 +测试(+350 tokens): 边缘案例、基准测试、可复现性
加载所有模块总token数: ~1600

Essential Checklist

必备检查清单

Correctness: Formulas match spec | Edge cases handled | Units consistent | Domain enforced Stability: Condition number OK | Precision sufficient | No cancellation | Overflow prevented Verification: Derivations documented | References cited | Tests cover invariants | Benchmarks reproducible Documentation: Assumptions stated | Limitations documented | Error bounds specified | References linked
正确性: 公式符合规格 | 处理边缘案例 | 单位一致 | 域约束生效 稳定性: 条件数正常 | 精度足够 | 无抵消误差 | 防止溢出 验证: 推导过程已记录 | 引用参考资料 | 测试覆盖不变量 | 基准测试可复现 文档: 明确假设条件 | 记录局限性 | 说明误差范围 | 链接参考资料

Output Format

输出格式

markdown
undefined
markdown
undefined

Summary

摘要

[Brief findings]
[简要发现]

Context

上下文

Files | Risk classification | Standards
文件 | 风险分类 | 标准

Requirements Analysis

需求分析

| Invariant | Verified | Evidence |
| 不变量 | 已验证 | 证据 |

Derivation Review

推导审查

[Status and conflicts]
[状态与冲突]

Stability Analysis

稳定性分析

Condition number | Precision | Risks
条件数 | 精度 | 风险

Issues

问题

[M1] [Title]: Location | Issue | Fix
[M1] [标题]: 位置 | 问题描述 | 修复方案

Recommendation

建议

Approve / Approve with actions / Block
**Verification:** Run the command with `--help` flag to verify availability.
批准/附条件批准/阻止
**验证方式:** 运行带`--help`参数的命令以确认技能可用。

Exit Criteria

退出标准

  • Context synced, requirements mapped, derivations verified, stability assessed, evidence logged with citations
  • 已完成上下文同步、需求映射、推导验证、稳定性评估,并记录带引用的证据

Troubleshooting

故障排除

Common Issues

常见问题

Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior Enable verbose logging with
--verbose
flag
命令未找到 确保所有依赖已安装且在PATH中
权限错误 检查文件权限并使用适当权限运行
异常行为 使用
--verbose
参数启用详细日志