sympy
它能做什么
这个工具可以像在数学笔记本上那样,使用符号进行精确的数学计算,而不只是处理数字。它可以求解方程、计算导数、积分等。
适用场景
- ✓求解复杂方程,且不想使用近似数值时。
- ✓计算函数的导数或积分时。
- ✓需要精确处理矩阵时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/sympy/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“求解方程 x^2 - 4 = 0 中的 x。”
每周 5 个新技能,1 分钟读完。
工作原理
你告诉我要解决的数学问题,我会使用一个名为 SymPy 的专用库来求出精确答案。它能理解“x”“y”这样的符号,并据此进行计算。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
SymPy - Symbolic Mathematics in Python
Detailed Guide
Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
When to Use This Skill
Use this skill when:
- Solving equations symbolically (algebraic, differential, systems of equations)
- Performing calculus operations (derivatives, integrals, limits, series)
- Manipulating and simplifying algebraic expressions
- Working with matrices and linear algebra symbolically
- Doing physics calculations (mechanics, quantum mechanics, vector analysis)
- Number theory computations (primes, factorization, modular arithmetic)
- Geometric calculations (2D/3D geometry, analytic geometry)
- Converting mathematical expressions to executable code (Python, C, Fortran)
- Generating LaTeX or other formatted mathematical output
- Needing exact mathematical results (e.g.,
sqrt(2)not1.414...)
Getting Started Examples
Example 1: Solve Quadratic Equation
from sympy import symbols, solve, sqrt
x = symbols('x')
solution = solve(x**2 - 5*x + 6, x)
# [2, 3]
Example 2: Calculate Derivative
from sympy import symbols, diff, sin
x = symbols('x')
f = sin(x**2)
df_dx = diff(f, x)
# 2*x*cos(x**2)
Example 3: Evaluate Integral
from sympy import symbols, integrate, exp
x = symbols('x')
integral = integrate(x * exp(-x**2), (x, 0, oo))
# 1/2
Example 4: Matrix Eigenvalues
from sympy import Matrix
M = Matrix([[1, 2], [2, 1]])
eigenvals = M.eigenvals()
# {3: 1, -1: 1}
Example 5: Generate Python Function
from sympy import symbols, lambdify
import numpy as np
x = symbols('x')
expr = x**2 + 2*x + 1
f = lambdify(x, expr, 'numpy')
f(np.array([1, 2, 3]))
# array([ 4, 9, 16])
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题
什么是“符号计算”?
就是用字母和符号(比如“x”“y”“sqrt(2)”)来做数学运算,而不是只用近似数字(比如用 1.414 表示根号 2)。这样能确保答案是精确的。
它能用于所有数学问题吗?
它非常适合代数、微积分、线性代数,以及部分物理和数论领域。但它不适用于复杂的统计学或机器学习。
我需要会用 Python 编程吗?
不需要。你只需用日常语言说明你的需求,我会负责使用 SymPy 的技术部分。
详情
作者的原始描述
SymPy is a Python library for symbolic mathematics that enables exact computation using mathematical symbols rather than numerical approximations.
热度
- GitHub 星标
- 48k
- 排名
- #5916
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。