math-solve

star 3

Solve math problems step-by-step with full working. Use for: solve integral, solve differential equation, solve ODE, solve system of equations, find eigenvalues, solve optimization problem, homework help, exam problem, step-by-step solution, show your work, explain how to solve, tutorial. Triggers: "solve", "find", "show steps", "step by step", "how to solve", "homework", "exam", "explain the solution", "work through"

imvladikon By imvladikon schedule Updated 2/26/2026

name: math-solve description: | Solve math problems step-by-step with full working. Use for: solve integral, solve differential equation, solve ODE, solve system of equations, find eigenvalues, solve optimization problem, homework help, exam problem, step-by-step solution, show your work, explain how to solve, tutorial. Triggers: "solve", "find", "show steps", "step by step", "how to solve", "homework", "exam", "explain the solution", "work through" allowed-tools: Bash(python:), Bash(pip:), WebFetch, WebSearch

Mathematical Problem Solver

Solve university-level mathematics with rigorous step-by-step solutions.

Anti-Hallucination Rules

  1. NEVER write a solution step without verifying it computationally
  2. NEVER skip algebra - show every step, verify each transformation
  3. ALWAYS substitute back - final answer must satisfy original equation
  4. If stuck: admit it, try alternative methods, or search for techniques

Problem-Solving Workflow

Phase 1: ANALYZE
  - What is given?
  - What is asked?
  - What type of problem? (ODE, integral, eigenvalue, optimization...)
  - What method to use?

Phase 2: SOLVE (with SymPy verification at each step)
  - Execute each step in Python
  - Show intermediate results
  - Catch errors early

Phase 3: VERIFY (REQUIRED - never skip)
  - Substitute solution back into original
  - Check numerically at specific points
  - Test boundary/edge cases

Solution Patterns

```python from sympy import * x = symbols('x') y = Function('y')

Step 1: Classify and set up

ode = Eq(y(x).diff(x, 2) + 4y(x), sin(2x)) print(f"Order: 2, Linear: Yes, Constant coefficients: Yes")

Step 2: Solve

sol = dsolve(ode, y(x)) print(f"General solution: {sol}")

Step 3: Apply initial conditions (if given)

ics = {y(0): 0, y(x).diff(x).subs(x, 0): 1} sol_ivp = dsolve(ode, y(x), ics=ics) print(f"Particular solution: {sol_ivp}")

Step 4: VERIFY by substitution

lhs = sol_ivp.rhs.diff(x, 2) + 4sol_ivp.rhs rhs = sin(2x) check = simplify(lhs - rhs) print(f"Verification (should be 0): {check}") assert check == 0, "Solution failed verification!"

</pattern>

<pattern name="Integrals">
```python
from sympy import *
x = symbols('x')

# Step 1: Set up integral
expr = x**2 * exp(-x)
a, b = 0, oo

# Step 2: Check convergence (for improper integrals)
print(f"Integrand behavior as x->oo: {limit(expr, x, oo)}")

# Step 3: Compute
result = integrate(expr, (x, a, b))
print(f"Symbolic result: {result}")

# Step 4: Verify numerically
from scipy.integrate import quad
import numpy as np
numerical, _ = quad(lambda t: t**2 * np.exp(-t), 0, 100)
print(f"Numerical check: {numerical}")
print(f"Match: {abs(float(result) - numerical) < 1e-6}")
```python from sympy import Matrix, simplify, pprint

Step 1: Define matrix

A = Matrix([[1, 2], [3, 4]]) print("Matrix A:"); pprint(A)

Step 2: Find eigenvalues

eigenvals = A.eigenvals() print(f"Eigenvalues: {eigenvals}")

Step 3: Find eigenvectors

for val, mult, vecs in A.eigenvects(): print(f"lambda = {val}: eigenvector = {vecs[0].T}")

Step 4: Diagonalize

P, D = A.diagonalize() print("P ="); pprint(P) print("D ="); pprint(D)

Step 5: VERIFY

check = simplify(P * D * P.inv() - A) print(f"PDP^(-1) - A = {check}") # should be zero matrix

</pattern>

<pattern name="Optimization with Constraints">
```python
from sympy import *

x, y, lam = symbols('x y lambda', real=True)

# Step 1: Define objective and constraint
f = x**2 + y**2           # minimize this
g = x + y - 1             # subject to g = 0

# Step 2: Set up Lagrangian
L = f - lam * g

# Step 3: Solve KKT conditions
eqs = [
    Eq(diff(L, x), 0),    # dL/dx = 0
    Eq(diff(L, y), 0),    # dL/dy = 0
    Eq(g, 0)              # constraint
]
critical = solve(eqs, [x, y, lam])
print(f"Critical points: {critical}")

# Step 4: Verify and classify
for point in critical:
    x_val, y_val, lam_val = point
    obj_val = f.subs([(x, x_val), (y, y_val)])
    constraint_check = g.subs([(x, x_val), (y, y_val)])
    print(f"Point ({x_val}, {y_val}): f = {obj_val}, g = {constraint_check}")
```python from sympy import * x, n = symbols('x n')

Taylor series

print("Taylor series of sin(x):") print(series(sin(x), x, 0, n=7))

Sum infinite series

print(f"Sum of 1/n^2: {Sum(1/n**2, (n, 1, oo)).doit()}") # = pi^2/6

Limits

print(f"lim (1+1/n)^n as n->oo: {limit((1 + 1/n)**n, n, oo)}") # = e

</pattern>

## Output Format

```markdown
## Problem
[Restate the problem clearly]

## Solution

### Step 1: [Analyze/Setup]
[Explanation of approach]
```python
# Code with output

Step 2: [Main computation]

[Explanation]

# Code with output

Step 3: [Continue as needed]

...

Verification

# Substitution check
# Numerical check

All checks passed.

Final Answer

$$ \boxed{\text{answer}} $$


## Domain Checklists

| Domain | Key Steps |
|--------|-----------|
| ODEs | Classify order/linearity, solve homogeneous + particular, apply ICs, verify by substitution |
| Integrals | Check convergence, compute, verify numerically |
| Linear Algebra | Check properties, compute, verify A = PDP^{-1} |
| Optimization | Find critical points, check Hessian/bordered Hessian, verify constraint satisfaction |
Install via CLI
npx skills add https://github.com/imvladikon/dot-claude --skill math-solve
Repository Details
star Stars 3
call_split Forks 1
navigation Branch main
article Path SKILL.md
More from Creator