Use when "SymPy", "symbolic math", "symbolic computation", "algebraic solver", or asking about "solve equations", "derivatives symbolically", "integrals symbolically", "differential equations", "matrix algebra", "LaTeX output", "lambdify"
Performs symbolic mathematics including solving equations, calculus operations, and matrix algebra.
/plugin marketplace add eyadsibai/ltk/plugin install ltk@ltk-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Python library for symbolic mathematics - exact computation with mathematical symbols.
sqrt(2) not 1.414...)from sympy import symbols, solve, diff, integrate, simplify
from sympy import sin, cos, exp, sqrt, pi, oo
# Define symbols
x, y, z = symbols('x y z')
# Solve equations
solutions = solve(x**2 - 5*x + 6, x) # [2, 3]
# Derivatives
derivative = diff(sin(x**2), x) # 2*x*cos(x**2)
# Integrals
integral = integrate(x**2, (x, 0, 1)) # 1/3
from sympy import solveset, linsolve, nonlinsolve, dsolve, Eq, Function
# Algebraic equations
solveset(x**2 - 4, x) # {-2, 2}
# Systems of linear equations
linsolve([x + y - 2, x - y], x, y) # {(1, 1)}
# Nonlinear systems
nonlinsolve([x**2 + y - 2, x + y**2 - 3], x, y)
# Differential equations
f = Function('f')
dsolve(f(x).diff(x) - f(x), f(x)) # f(x) = C1*exp(x)
from sympy import diff, integrate, limit, series
# Derivatives
diff(x**3, x) # 3*x**2
diff(x**4, x, 3) # 24*x (third derivative)
# Integrals
integrate(exp(-x), (x, 0, oo)) # 1 (improper)
# Limits
limit(sin(x)/x, x, 0) # 1
# Series expansion
series(exp(x), x, 0, 6) # 1 + x + x**2/2 + ...
from sympy import simplify, expand, factor, cancel, trigsimp
simplify(sin(x)**2 + cos(x)**2) # 1
expand((x + 1)**3) # x**3 + 3*x**2 + 3*x + 1
factor(x**2 - 1) # (x - 1)*(x + 1)
trigsimp(sin(x)*cos(y) + cos(x)*sin(y)) # sin(x + y)
from sympy import Matrix, eye, zeros
M = Matrix([[1, 2], [3, 4]])
M_inv = M**-1 # Inverse
M.det() # Determinant
M.eigenvals() # Eigenvalues
M.eigenvects() # Eigenvectors
P, D = M.diagonalize() # M = P*D*P^-1
# Constrain symbols for better simplification
x = symbols('x', positive=True, real=True)
n = symbols('n', integer=True)
# With positive assumption
sqrt(x**2) # Returns x (not Abs(x))
from sympy import lambdify, N
import numpy as np
# Single value
result = sqrt(8) + pi
result.evalf() # 5.96371554103586
result.evalf(50) # 50 digits precision
# Convert to NumPy function (fast)
expr = x**2 + 2*x + 1
f = lambdify(x, expr, 'numpy')
x_vals = np.linspace(0, 10, 100)
y_vals = f(x_vals) # Fast vectorized evaluation
from sympy import latex, pprint
from sympy.utilities.codegen import codegen
# LaTeX output
latex_str = latex(integrate(x**2, x)) # \frac{x^{3}}{3}
# Pretty print
pprint(integrate(x**2, x))
# Generate C code
[(c_name, c_code), (h_name, h_header)] = codegen(
('my_func', x**2 + 1), 'C'
)
symbols() before expressionspositive=True, real=True, integer=TrueRational(1, 2) not 0.5solveset for algebraic, dsolve for ODEs| Tool | Best For |
|---|---|
| SymPy | Symbolic math, exact results, algebraic manipulation |
| NumPy | Numerical computation, arrays |
| SciPy | Numerical optimization, integration |
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.