sympy
Symbolic mathematics in Python — use for algebraic equation solving, calculus operations (derivatives, integrals, limits), matrix manipulation, physics calculations, and generating executable code from mathematical expressions when exact symbolic results are needed.
Symbolic algebra, calculus, and exact mathematical computation
Trigger phrases
Phrases that activate this skill when typed to Claude Code:
solve this equation symbolicallytake the derivative ofcompute this integralsimplify this expressionsympy calculation
What it does
sympy is a Claude Code skill from K-Dense AI’s scientific-agent-skills repo. It turns Claude into a SymPy expert for symbolic computation — solving equations algebraically, computing derivatives and integrals exactly, expanding and factoring expressions, working with matrices symbolically, number theory, geometry, and generating lambdify code that converts symbolic expressions into fast numerical functions.
A session produces verified symbolic results: exact closed-form answers rather than numerical approximations, with optional code generation to evaluate the expression numerically at specific values.
When to use it
Reach for it when:
- You need an exact symbolic answer — a formula, not a floating-point number
- You’re deriving gradients or Jacobians for optimization problems and want the exact expression before numerical evaluation
- You’re checking whether a complex algebraic expression simplifies to a known form
When not to reach for it:
- Pure numerical computation where floating-point precision is acceptable — numpy/scipy are faster
- Statistical modeling or data analysis — this is a pure mathematics tool
Install
Copy the SKILL.md from K-Dense AI’s sympy folder into .claude/skills/sympy/ in your project.
Trigger phrases: “solve this equation symbolically”, “take the derivative of”, “compute this integral”, “simplify this expression”.
What a session looks like
A typical session has three phases:
- Expression setup. Describe the mathematical problem — equation to solve, expression to differentiate or integrate, or matrix to analyze. Claude sets up the SymPy symbolic variables and expressions.
- Symbolic computation. The requested operation runs:
sympy.solve(),sympy.diff(),sympy.integrate(),sympy.simplify(), or the appropriate algebra or calculus function. Claude shows intermediate steps for complex derivations. - Code and verification. The result is returned in both human-readable LaTeX and executable SymPy code. For expressions that will be evaluated numerically, Claude generates a
lambdifywrapper for fast numerical evaluation.
Receipts
Where it works well:
- Gradient derivation for custom loss functions — SymPy produces the exact gradient expression that can then be verified against automatic differentiation results
- Definite integral evaluation for probability density functions — SymPy handles many integrals that require Mathematica or hours of hand calculation otherwise
Where it backfires:
- Very complex integrals that have no closed form — SymPy returns the input unevaluated rather than notifying you that numerical integration is the right approach
- Performance: symbolic simplification can be slow for large expressions; Claude doesn’t always warn about this upfront
Pattern that works: always call sympy.simplify() or sympy.trigsimp() on the result — SymPy often returns correct but unsimplified expressions that look more complex than they are.
Source and attribution
Originally authored by K-Dense Inc.. The canonical SKILL.md lives in the sympy folder of their public scientific-agent-skills repository.
License: MIT. Install, adapt, and redistribute with attribution preserved.
This page documents the skill from a practitioner’s perspective. For the formal spec and any updates, defer to the source repo.