跳到正文
Skillpedia
通用编程48k · #5916

sympy

它能做什么

这个工具可以像在数学笔记本上那样,使用符号进行精确的数学计算,而不只是处理数字。它可以求解方程、计算导数、积分等。

适用场景

  • ✓求解复杂方程,且不想使用近似数值时。
  • ✓计算函数的导数或积分时。
  • ✓需要精确处理矩阵时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/sympy/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/sympy/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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) not 1.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.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5916
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能