sympy
Helps your agent perform exact symbolic mathematics. It's useful for algebra, calculus, and solving equations, generating precise results.
What it does
This tool lets you do exact math calculations using symbols, instead of approximate numbers. It helps with algebra, calculus, solving equations, and even physics.
When to use it
- ✓Solving equations like 'x + 5 = 10' exactly.
- ✓Calculating derivatives or integrals of math functions.
- ✓Simplifying complex mathematical expressions.
Example of what to ask your AI
“Solve the equation x^2 - 4 = 0 for x.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
You tell the AI what the symbols are (like 'x' or 'y') and then write the math expression or equation. The AI will use the SymPy tool to calculate the exact result.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add K-Dense-AI/scientific-agent-skills --skill sympyOr download just the file:
curl -L https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/main/skills/sympy/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
SymPy - Symbolic Mathematics in Python
Overview
SymPy is a Python library for symbolic mathematics that enables exact computation using mathematical symbols rather than numerical approximations. This skill provides comprehensive guidance for performing symbolic algebra, calculus, linear algebra, equation solving, physics calculations, and code generation using SymPy.
Installation
Reviewed against current official documentation and executed with SymPy 1.14.0
on Python 3.13.3 (2026-10-01). Core SymPy requires Python 3.9+; the tested
NumPy 2.5.3 / SciPy 1.18.1 stack needs Python 3.12+. SymPy 1.14.0 requires
mpmath>=1.1,<1.4; use the compatible 1.3.0, not the newer 1.4.x release.
See verification and official sources for coverage.
# Install SymPy using uv
uv pip install "sympy==1.14.0"
# Optional: for lambdify and plotting examples
uv pip install numpy scipy matplotlib
Check your version:
import sympy
print(sympy.__version__)
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...)
Core Capabilities
Seven capability areas are documented in references/core_capabilities.md:
- Symbolic computation basics — symbols, expressions, simplification, substitution.
- Calculus — differentiation, integration, limits, series.
- Equation solving —
solve,solveset, linear and nonlinear systems, ODEs. - Matrices and linear algebra — see references/matrices-linear-algebra.md.
- Physics and mechanics — see references/physics-mechanics.md.
- Advanced mathematics — see references/advanced-topics.md.
- Code generation and output — see references/code-generation-printing.md.
Deeper treatment of the first three is in references/core-capabilities.md.
Working with SymPy: Best Practices
1. Always Define Symbols First
from sympy import symbols
x, y, z = symbols('x y z')
# Now x, y, z can be used in expressions
2. Use Assumptions for Better Simplification
from sympy import symbols, sqrt
x = symbols('x', positive=True, real=True)
sqrt(x**2) # Returns x (not Abs(x)) due to positive assumption
Common assumptions: real, positive, negative, integer, rational, complex, even, odd
3. Use Exact Arithmetic
from sympy import Rational, S
# Correct (exact):
expr = Rational(1, 2) * x
expr = S(1)/2 * x
# Approximate (appropriate for measured/numerical inputs):
expr = 0.5 * x # Creates approximate value
4. Numerical Evaluation When Needed
from sympy import pi, sqrt
result = sqrt(8) + pi
result.evalf() # 5.96371554103586
result.evalf(50) # Request 50 decimal digits; cannot recover precision lost in inputs
5. Convert to NumPy for Performance
from sympy import symbols, lambdify
import numpy as np
x = symbols("x")
expr = x**2 + 1
# Slow for many evaluations:
for x_val in range(1000):
result = expr.subs(x, x_val).evalf()
# Fast:
f = lambdify(x, expr, 'numpy')
results = f(np.arange(1000))
6. Use Appropriate Solvers
solveset: Algebraic equations (primary)linsolve: Linear systemsnonlinsolve: Nonlinear systemsdsolve: Differential equationssolve: General purpose; supports some problemssolvesetdoes not
…
FAQ
What's the difference between this tool and a normal calculator?
Normal calculators use approximate numbers (like 3.14159). This tool uses exact symbols (like pi or the square root of 2) for precise answers.
Can I use numbers and symbols together?
Yes, you can mix numbers and symbols. For example, you can ask it to simplify '2*x + 3*x'.
Can it solve any kind of math problem?
It's very powerful for algebra, calculus, and some areas of physics, but it might not solve extremely complex or very specialized math problems.
Details
Original description by the author
Performs exact symbolic mathematics with SymPy for algebra, calculus, equation solving, symbolic linear algebra, physics, and lambdify or LaTeX code generation. Use when a task needs symbolic results, explicit assumptions, or exact arithmetic; use NumPy or SciPy for purely numerical workloads.
Popularity
- GitHub stars
- 51k
- Ranking position
- #1987
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
13c-metabolic-flux
Estimates metabolic fluxes using carbon-13 isotope tracing data. It is useful for analyzing cellular metabolism and biochemical pathways.
K-Dense-AI/scientific-agent-skills
adaptyv
Designs protein characterization experiments using the Adaptyv API. It helps estimate costs, submit sequences, and monitor lab results.
K-Dense-AI/scientific-agent-skills
aeon
Performs machine learning tasks on time series data. It is useful for classifying, forecasting, detecting anomalies, and finding patterns in sequential data.
K-Dense-AI/scientific-agent-skills
alphagenome
Looks up precomputed genomic effects for genetic variants. It provides scores and explanations to understand the impact of variants on the genome.
K-Dense-AI/scientific-agent-skills
Similar skills
pytorch-patterns
Helps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
affaan-m/ECC
evm-token-decimals
Helps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
affaan-m/ECC
knowledge-agent
Creates and queries knowledge bases using AI. It allows asking questions about past work or compiling expertise on a topic.
thedotmack/claude-mem