sympy
Solve symbolic math problems with SymPy
Also available from: davila7
Need exact mathematical results instead of numerical approximations. This skill provides comprehensive guidance for symbolic algebra, calculus, equation solving, matrix operations, and physics calculations using Python SymPy library.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "sympy". Solve x^2 - 4 = 0 for x
Expected outcome:
- Solutions: x = -2, x = 2
- Method: solveset(x**2 - 4, x)
- The equation has two real solutions
Using "sympy". Find derivative of sin(x^2)
Expected outcome:
- Derivative: 2*x*cos(x^2)
- Method: diff(sin(x**2), x)
- Use integrate() for the integral
Using "sympy". Find eigenvalues of [[1, 2], [2, 1]]
Expected outcome:
- Eigenvalues: 3, -1
- Eigenvectors: [1, 1], [1, -1]
- Matrix is diagonalizable: True
Security Audit
SafeAll 497 static findings are FALSE POSITIVES. This skill is pure documentation for the SymPy symbolic mathematics library. The detected patterns (backticks, imports, eval, file operations) are legitimate documentation elements: markdown code formatting, Python code examples showing SymPy features like lambdify and srepr, and file export for mathematical results. No malicious behavior present.
Risk Factors
⚡ Contains scripts (4)
⚙️ External commands (3)
📁 Filesystem access (2)
🌐 Network access (2)
Quality Score
What You Can Build
Derive equations of motion
Set up Lagrangian mechanics problems and derive equations of motion symbolically
Symbolic feature engineering
Create symbolic expressions for mathematical transformations before numerical evaluation
Learn symbolic computation
Explore step-by-step mathematical derivations, simplifications, and solution verification
Try These Prompts
Solve the quadratic equation x^2 - 5x + 6 = 0 and verify the solutions
Find the derivative of sin(x^2) and then compute the definite integral from 0 to pi
Find the eigenvalues and eigenvectors of matrix [[1, 2], [2, 1]]
Convert the expression x^2 + sin(x) to a NumPy function for numerical evaluation
Best Practices
- Define symbols with assumptions (positive=True, integer=True) to improve simplification
- Use lambdify() to create fast numerical functions from symbolic expressions
- Use Rational() or S() for exact arithmetic instead of floating-point numbers
- Choose appropriate solvers: solveset for algebra, linsolve for linear systems, dsolve for ODEs
Avoid
- Using floating-point numbers (0.5) instead of Rational(1, 2) for exact results
- Using subs() and evalf() in loops instead of lambdify() for performance
- Forgetting to define symbols with symbols() before using them
- Skipping assumptions when working with constrained variables (positive, real, integer)
Frequently Asked Questions
What is symbolic vs numerical computation?
When should I use lambdify()?
How do I solve differential equations?
What are symbol assumptions?
How do I generate C/Fortran code?
Can SymPy handle matrices with symbolic entries?
Developer Details
File structure