
Sympy
Equip your coding agent with SymPy recipes for symbolic geometry, number theory, combinatorics, and polynomials when building scientific or math-heavy Python features.
Overview
SymPy is an agent skill for the Build phase that teaches coding agents advanced SymPy patterns for symbolic geometry, number theory, and related mathematics in Python.
Install
npx skills add https://github.com/k-dense-ai/scientific-agent-skills --skill sympyWhat is this skill?
- 2D geometry primitives: points, lines, segments, circles, triangles, and polygons with distance and intersection helpers
- Number theory, combinatorics, logic and sets, statistics, polynomials, and special functions in one reference
- Executable Python patterns for geometric queries such as containment, parallelism, and perpendicular checks
- Symbolic exact results (e.g. 25*pi area) instead of floating-point drift for teaching and verification workflows
- Advanced topics companion to core SymPy—use when agents need beyond-basic calculus and algebra snippets
Adoption & trust: 545 installs on skills.sh; 27.6k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need exact symbolic math and geometry in Python but your agent keeps hallucinating SymPy APIs or mixing float approximations with symbolic work.
Who is it for?
Indie data-science or edtech builders adding symbolic math, geometry homework checkers, or research notebooks with agent-assisted coding.
Skip if: Teams that only need numeric NumPy stacks with no symbolic algebra, or builders who want a full SymPy tutorial instead of agent-oriented recipe cards.
When should I use this skill?
Implementing symbolic geometry, number theory, combinatorics, statistics, polynomials, or special functions with SymPy in Python.
What do I get? / Deliverables
Your agent emits vetted SymPy snippets for shapes, queries, and advanced domains so scientific features compile and behave symbolically as intended.
- SymPy-based Python functions or modules
- Correct symbolic expressions and geometric query code
Recommended Skills
Journey fit
Symbolic math and geometry code belongs in the build phase when you are implementing computational backends, notebooks, or research tooling—not in early discovery. Advanced SymPy usage is backend and data-layer work: exact arithmetic, geometric queries, and special functions power APIs and offline analysis pipelines.
How it compares
Reference skill for SymPy advanced APIs—not a Jupyter MCP server or a automatic equation solver product.
Common Questions / FAQ
Who is sympy for?
Solo and indie Python builders who use AI coding agents on scientific, educational, or analytics products and need trustworthy SymPy examples for non-trivial math.
When should I use sympy?
During Build when implementing symbolic geometry, number-theory helpers, combinatorics, or polynomial logic in backend or notebook code—not before you have a concrete math feature to ship.
Is sympy safe to install?
Treat it like any third-party skill: review the Security Audits panel on this Prism page and inspect the SKILL.md in your repo before granting filesystem or shell access to your agent.
SKILL.md
READMESKILL.md - Sympy
# SymPy Advanced Topics This document covers SymPy's advanced mathematical capabilities including geometry, number theory, combinatorics, logic and sets, statistics, polynomials, and special functions. ## Geometry ### 2D Geometry ```python from sympy.geometry import Point, Line, Circle, Triangle, Polygon # Points p1 = Point(0, 0) p2 = Point(1, 1) p3 = Point(1, 0) # Distance between points dist = p1.distance(p2) # Lines line = Line(p1, p2) line_from_eq = Line(Point(0, 0), slope=2) # Line properties line.slope # Slope line.equation() # Equation of line line.length # oo (infinite for lines) # Line segment from sympy.geometry import Segment seg = Segment(p1, p2) seg.length # Finite length seg.midpoint # Midpoint # Intersection line2 = Line(Point(0, 1), Point(1, 0)) intersection = line.intersection(line2) # [Point(1/2, 1/2)] # Circles circle = Circle(Point(0, 0), 5) # Center, radius circle.area # 25*pi circle.circumference # 10*pi # Triangles tri = Triangle(p1, p2, p3) tri.area # Area tri.perimeter # Perimeter tri.angles # Dictionary of angles tri.vertices # Tuple of vertices # Polygons poly = Polygon(Point(0, 0), Point(1, 0), Point(1, 1), Point(0, 1)) poly.area poly.perimeter poly.vertices ``` ### Geometric Queries ```python # Check if point is on line/curve point = Point(0.5, 0.5) line.contains(point) # Check if parallel/perpendicular line1 = Line(Point(0, 0), Point(1, 1)) line2 = Line(Point(0, 1), Point(1, 2)) line1.is_parallel(line2) # True line1.is_perpendicular(line2) # False # Tangent lines from sympy.geometry import Circle, Point circle = Circle(Point(0, 0), 5) point = Point(5, 0) tangents = circle.tangent_lines(point) ``` ### 3D Geometry ```python from sympy.geometry import Point3D, Line3D, Plane # 3D Points p1 = Point3D(0, 0, 0) p2 = Point3D(1, 1, 1) p3 = Point3D(1, 0, 0) # 3D Lines line = Line3D(p1, p2) # Planes plane = Plane(p1, p2, p3) # From 3 points plane = Plane(Point3D(0, 0, 0), normal_vector=(1, 0, 0)) # From point and normal # Plane equation plane.equation() # Distance from point to plane point = Point3D(2, 3, 4) dist = plane.distance(point) # Intersection of plane and line intersection = plane.intersection(line) ``` ### Curves and Ellipses ```python from sympy.geometry import Ellipse, Curve from sympy import sin, cos, pi # Ellipse ellipse = Ellipse(Point(0, 0), hradius=3, vradius=2) ellipse.area # 6*pi ellipse.eccentricity # Eccentricity # Parametric curves from sympy.abc import t curve = Curve((cos(t), sin(t)), (t, 0, 2*pi)) # Circle ``` ## Number Theory ### Prime Numbers ```python from sympy.ntheory import isprime, primerange, prime, nextprime, prevprime # Check if prime isprime(7) # True isprime(10) # False # Generate primes in range list(primerange(10, 50)) # [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] # nth prime prime(10) # 29 (10th prime) # Next and previous primes nextprime(10) # 11 prevprime(10) # 7 ``` ### Prime Factorization ```python from sympy import factorint, primefactors, divisors # Prime factorization factorint(60) # {2: 2, 3: 1, 5: 1} means 2^2 * 3^1 * 5^1 # List of prime factors primefactors(60) # [2, 3, 5] # All divisors divisors(60) # [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60] ``` ### GCD and LCM ```python from sympy import gcd, lcm, igcd, ilcm # Greatest common divisor gcd(60, 48) # 12 igcd(60, 48) # 12 (integer version) # Least common multiple lcm(60, 48) # 240 ilcm(60, 48) # 240 (integer version) # Multiple arguments gcd(60, 48, 36) # 12 ``` ### Modular Arithmetic ```python from sympy.ntheory import mod_inverse, totient, is_primitive_root # Modular inverse (find x such that a*x ≡ 1 (mod m)) mod_inverse(3, 7) # 5 (because 3*5 = 15 ≡ 1 (mod 7)) # Euler's totient function totient(10) # 4 (numbers less than 10 coprime to 10: 1,3,7,9) # Primitive roots is_primitive_root(2, 5) # True ``` ### Diophantine Equations ```python from sympy.solvers.diophantine i