Skills sympy
Σ

sympy

Safe ⚡ Contains scripts⚙️ External commands📁 Filesystem access🌐 Network access

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.

Supports: Claude Codex Code(CC)
📊 70 Adequate
1

Download the skill ZIP

2

Upload in Claude

Go to Settings → Capabilities → Skills → Upload skill

3

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

Safe
v4 • 1/17/2026

All 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.

7
Files scanned
5,806
Lines analyzed
4
findings
4
Total audits
Audited by: claude View Audit History →

Quality Score

45
Architecture
90
Maintainability
85
Content
21
Community
100
Security
91
Spec Compliance

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

Basic equation solving
Solve the quadratic equation x^2 - 5x + 6 = 0 and verify the solutions
Calculus operations
Find the derivative of sin(x^2) and then compute the definite integral from 0 to pi
Matrix operations
Find the eigenvalues and eigenvectors of matrix [[1, 2], [2, 1]]
Code generation
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?
SymPy maintains exact symbolic expressions like sqrt(2) while numerical methods approximate as 1.414. Symbolic gives exact results.
When should I use lambdify()?
Use lambdify() when you need to evaluate a symbolic expression many times with numerical data. It converts expressions to fast NumPy functions.
How do I solve differential equations?
Use dsolve() from sympy. Define your function with symbols('f', cls=Function), then call dsolve(Derivative(f(x), x) - f(x), f(x)).
What are symbol assumptions?
Assumptions like positive=True, real=True, integer=True help SymPy simplify expressions correctly. sqrt(x**2) returns x only if x is positive.
How do I generate C/Fortran code?
Use sympy.utilities.codegen.codegen() to generate compilable C or Fortran code from symbolic expressions for performance-critical applications.
Can SymPy handle matrices with symbolic entries?
Yes, SymPy supports symbolic matrices. You can compute determinants, eigenvalues, inverses, and solve systems with symbols as matrix elements.

Developer Details

Author

K-Dense-AI

License

https://github.com/sympy/sympy/blob/master/LICENSE

Ref

main