math

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/math - Unified Math Capabilities

/math - 统一数学能力

One entry point for all computation and explanation. I route to the right tool based on your request.
For formal proofs, use
/prove
instead.

所有计算与讲解的统一入口。我会根据你的请求匹配合适的工具。
如需形式化证明,请使用
/prove

Quick Examples

快速示例

You SayI Use
"Solve x² - 4 = 0"SymPy solve
"Integrate sin(x) from 0 to π"SymPy integrate
"Eigenvalues of [[1,2],[3,4]]"SymPy eigenvalues
"Is x² + 1 > 0 for all x?"Z3 prove
"Convert 5 miles to km"Pint
"Explain what a functor is"Category theory skill

你输入我使用
"Solve x² - 4 = 0"SymPy solve
"Integrate sin(x) from 0 to π"SymPy integrate
"Eigenvalues of [[1,2],[3,4]]"SymPy eigenvalues
"Is x² + 1 > 0 for all x?"Z3 prove
"Convert 5 miles to km"Pint
"Explain what a functor is"范畴论技能

Computation Scripts

计算脚本

SymPy (Symbolic Math)

SymPy(符号数学)

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" <command> <args>
CommandDescriptionExample
solve
Solve equations
solve "x**2 - 4" --var x
integrate
Definite/indefinite integral
integrate "sin(x)" --var x --lower 0 --upper pi
diff
Derivative
diff "x**3" --var x
simplify
Simplify expression
simplify "sin(x)**2 + cos(x)**2"
limit
Compute limit
limit "sin(x)/x" --var x --point 0
series
Taylor expansion
series "exp(x)" --var x --point 0 --n 5
dsolve
Solve ODE
dsolve "f''(x) + f(x)" --func f --var x
laplace
Laplace transform
laplace "sin(t)" --var t
Matrix Operations:
CommandDescription
det
Determinant
eigenvalues
Eigenvalues
eigenvectors
Eigenvectors with multiplicities
inverse
Matrix inverse
transpose
Transpose
rref
Row echelon form
rank
Matrix rank
nullspace
Null space basis
linsolve
Linear system Ax=b
charpoly
Characteristic polynomial
Number Theory:
CommandDescription
factor
Factor polynomial
factorint
Prime factorization
isprime
Primality test
gcd
Greatest common divisor
lcm
Least common multiple
modinverse
Modular inverse
Combinatorics:
CommandDescription
binomial
C(n,k)
factorial
n!
permutation
P(n,k)
partition
Integer partitions p(n)
catalan
Catalan numbers
bell
Bell numbers

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" <command> <args>
命令描述示例
solve
求解方程
solve "x**2 - 4" --var x
integrate
定积分/不定积分
integrate "sin(x)" --var x --lower 0 --upper pi
diff
求导
diff "x**3" --var x
simplify
化简表达式
simplify "sin(x)**2 + cos(x)**2"
limit
计算极限
limit "sin(x)/x" --var x --point 0
series
泰勒展开
series "exp(x)" --var x --point 0 --n 5
dsolve
求解常微分方程
dsolve "f''(x) + f(x)" --func f --var x
laplace
拉普拉斯变换
laplace "sin(t)" --var t
矩阵运算:
命令描述
det
行列式
eigenvalues
特征值
eigenvectors
特征向量(含重数)
inverse
矩阵逆
transpose
转置
rref
行最简形
rank
矩阵秩
nullspace
零空间基
linsolve
线性方程组Ax=b求解
charpoly
特征多项式
数论:
命令描述
factor
多项式因式分解
factorint
素因数分解
isprime
素性测试
gcd
最大公约数
lcm
最小公倍数
modinverse
模逆元
组合数学:
命令描述
binomial
组合数C(n,k)
factorial
阶乘n!
permutation
排列数P(n,k)
partition
整数分拆p(n)
catalan
卡特兰数
bell
贝尔数

Z3 (Constraint Solving)

Z3(约束求解)

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/z3_solve.py" <command> <args>
CommandUse Case
sat
Is this satisfiable?
prove
Is this always true?
optimize
Find min/max subject to constraints

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/z3_solve.py" <command> <args>
命令使用场景
sat
判断是否可满足
prove
判断是否恒成立
optimize
带约束的极值求解

Pint (Units)

Pint(单位转换)

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/pint_compute.py" convert <value> <from_unit> <to_unit>
Example:
convert 5 miles kilometers

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/pint_compute.py" convert <value> <from_unit> <to_unit>
示例:
convert 5 miles kilometers

Math Router (Auto-Route)

数学路由工具(自动匹配)

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/math_router.py" route "<natural language request>"
Returns the exact command to run. Use when unsure which script.

bash
uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/math_router.py" route "<natural language request>"
返回要执行的具体命令。当你不确定使用哪个脚本时使用此工具。

Topic Skills (For Explanation)

主题技能(用于讲解)

When the request is "explain X" or "what is X", I reference these:
TopicSkill LocationKey Concepts
Abstract Algebra
math/abstract-algebra/
Groups, rings, fields, homomorphisms
Category Theory
math/category-theory/
Functors, natural transformations, limits
Complex Analysis
math/complex-analysis/
Analytic functions, residues, contour integrals
Functional Analysis
math/functional-analysis/
Banach spaces, operators, spectra
Linear Algebra
math/linear-algebra/
Matrices, eigenspaces, decompositions
Mathematical Logic
math/mathematical-logic/
Propositional, predicate, proof theory
Measure Theory
math/measure-theory/
Lebesgue, σ-algebras, integration
Real Analysis
math/real-analysis/
Limits, continuity, convergence
Topology
math/topology/
Open sets, compactness, connectedness
ODEs/PDEs
math/odes-pdes/
Differential equations, boundary problems
Optimization
math/optimization/
Convex, LP, gradient methods
Numerical Methods
math/numerical-methods/
Approximation, error analysis
Graph/Number Theory
math/graph-number-theory/
Graphs, primes, modular arithmetic
Information Theory
math/information-theory/
Entropy, coding, channels

当请求为“解释X”或“什么是X”时,我会参考以下内容:
主题技能位置核心概念
抽象代数
math/abstract-algebra/
群、环、域、同态
范畴论
math/category-theory/
函子、自然变换、极限
复分析
math/complex-analysis/
解析函数、留数、围道积分
泛函分析
math/functional-analysis/
巴拿赫空间、算子、谱
线性代数
math/linear-algebra/
矩阵、特征空间、分解
数理逻辑
math/mathematical-logic/
命题逻辑、谓词逻辑、证明论
测度论
math/measure-theory/
勒贝格测度、σ-代数、积分
实分析
math/real-analysis/
极限、连续性、收敛性
拓扑学
math/topology/
开集、紧性、连通性
常微分方程/偏微分方程
math/odes-pdes/
微分方程、边值问题
优化理论
math/optimization/
凸优化、线性规划、梯度方法
数值方法
math/numerical-methods/
近似计算、误差分析
图论/数论
math/graph-number-theory/
图、素数、模算术
信息论
math/information-theory/
熵、编码、信道

Routing Logic

路由逻辑

I decide based on your request:
"solve/calculate/compute" → SymPy (exact symbolic)
"is X always true?" → Z3 (constraint proving)
"convert units" → Pint
"explain/what is" → Topic skill for context
"prove formally" → Redirect to /prove

我会根据你的请求做出判断:
"solve/calculate/compute" → SymPy(精确符号计算)
"is X always true?" → Z3(约束证明)
"convert units" → Pint
"explain/what is" → 主题技能(提供上下文)
"prove formally" → 重定向到 /prove

Examples

示例

Solve Equation

求解方程

User: Solve x² - 5x + 6 = 0
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" solve "x**2 - 5*x + 6" --var x
Result: x = 2 or x = 3
用户:Solve x² - 5x + 6 = 0
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" solve "x**2 - 5*x + 6" --var x
结果:x = 2 或 x = 3

Compute Eigenvalues

计算特征值

User: Find eigenvalues of [[2, 1], [1, 2]]
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" eigenvalues "[[2,1],[1,2]]"
Result: {1: 1, 3: 1}  (eigenvalue 1 with multiplicity 1, eigenvalue 3 with multiplicity 1)
用户:Find eigenvalues of [[2, 1], [1, 2]]
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/sympy_compute.py" eigenvalues "[[2,1],[1,2]]"
结果:{1: 1, 3: 1} (特征值1的重数为1,特征值3的重数为1)

Prove Inequality

证明不等式

User: Is x² + y² ≥ 2xy always true?
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/z3_solve.py" prove "x**2 + y**2 >= 2*x*y"
Result: PROVED (equivalent to (x-y)² ≥ 0)
用户:Is x² + y² ≥ 2xy always true?
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/z3_solve.py" prove "x**2 + y**2 >= 2*x*y"
结果:PROVED(等价于(x-y)² ≥ 0)

Convert Units

单位转换

User: How many kilometers in 26.2 miles?
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/pint_compute.py" convert 26.2 miles kilometers
Result: 42.16 km

用户:26.2英里等于多少公里?
Claude: uv run python "$CLAUDE_PROJECT_DIR/.claude/scripts/cc_math/pint_compute.py" convert 26.2 miles kilometers
结果:42.16 km

When to Use /prove Instead

何时使用 /prove 替代

Use
/prove
when you need:
  • Machine-verified formal proof (Lean 4)
  • Category theory proofs (functors, Yoneda, etc.)
  • Publication-quality verification
  • Abstract algebra proofs
/math
is for computation.
/prove
is for verification.
当你需要以下功能时,使用
/prove
  • 机器验证的形式化证明(Lean 4)
  • 范畴论证明(函子、米田引理等)
  • 可用于发表的验证结果
  • 抽象代数证明
/math
用于计算,
/prove
用于验证。