root-finding — Claude Code skill for numerical roots
root-finding is a Claude Code skill that selects a numerical method for finding equation or system roots based on available derivatives and a known interval.
MIT ★ 3,951 updated 2026-01-26
npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a claude-codeWhat root-finding does
The skill starts by sorting out whether the task involves one root or several, whether an interval containing a root is known, and whether derivatives are available. For a bracketed root without derivatives, it points to bisection or Brent’s method; with derivatives, it suggests Newton’s method. Systems of equations use scipy.optimize.fsolve.
Examples call scipy.optimize.brentq and scipy.optimize.newton. For symbolic solutions, the skill shows sympy_compute.py solve, while multiple roots can be approached by deflation or by trying several starting points. One practical distinction matters: the guide says brentq is guaranteed to converge when the root is bracketed.
To check a result, it recommends comparing the function value at the candidate root with a tolerance and checking that the root lies in the expected domain. It also gives z3_solve.py prove "f(root) == 0" as a proof command. The runnable examples use uv run python.
What it helps with
- select a root-finding method based on derivatives and a bracket
- compute an equation’s root with SciPy
- solve a nonlinear system of equations
- search for multiple roots from different starting points
- check a computed root against a tolerance and domain
Example prompts for the agent
- Find a root of
x**2 - 2between 0 and 2 and choose a suitable method. - Solve this nonlinear system with an appropriate SciPy method.
- Search for multiple roots from different starting points, then check the results.
How to install root-finding
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a claude-code2Manually: put the files in place
~/.claude/skills/root-finding/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/root-finding/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a codex2Manually: put the files in place
.agents/skills/root-finding/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a cursor2Manually: put the files in place
.cursor/skills/root-finding/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install parcadei/Continuous-Claude-v3 .claude/skills/math/numerical-methods/root-finding2Manually: put the files in place
.github/skills/root-finding/SKILL.md1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a gemini-cli2Platform CLI
gemini skills install https://github.com/parcadei/Continuous-Claude-v3 --path .claude/skills/math/numerical-methods/root-findingManually: put the files in place
.devin/skills/root-finding/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about root-finding
How do I install root-finding in Claude Code?
Run npx skills add parcadei/Continuous-Claude-v3 --skill root-finding -a claude-code. The skill file is at ~/.claude/skills/root-finding/SKILL.md.
What does root-finding do?
It helps choose a numerical method for an equation or system based on whether derivatives and a root-containing interval are available, then suggests checks for the result.
How does the skill recommend checking a root?
Compare the function’s value at the candidate root with a tolerance and confirm the root is in the expected domain. The guide also gives z3_solve.py prove "f(root) == 0".
Source text
SKILL.md · MIT
---
name: root-finding
description: "Problem-solving strategies for root finding in numerical methods"
allowed-tools: [Bash, Read]
---
# Root Finding
## When to Use
Use this skill when working on root-finding problems in numerical methods.
## Decision Tree
1. **Characterize the Problem**
- Single root or multiple roots?
- Bracketed (know interval containing root)?
- Derivatives available?
2. **Method Selection**
| Situation | Method | Implementation |
|-----------|--------|----------------|
| Bracketed, no derivatives | Bisection, Brent | `scipy.optimize.brentq` |
| Derivatives available | Newton-Raphson | `scipy.optimize.newton` |
| No derivatives | Secant method | `scipy.optimize.newton` (no fprime) |
| System of equations | `scipy.optimize.fsolve` | Requires Jacobian ideally |
3. **Implement Root Finding**
- `scipy.optimize.brentq(f, a, b)` - guaranteed convergence if bracketed
- `scipy.optimize.newton(f, x0, fprime=df)` - quadratic convergence near root
- For systems: `scipy.optimize.fsolve(F, x0)`
4. **Handle Multiple Roots**
- Deflation: divide out found roots
- Multiple starting points
- `sympy_compute.py solve "f(x)" --var x` for symbolic solutions
5. **Verify Solutions**
- Check |f(root)| < tolerance
- Verify root is in expected domain
- `z3_solve.py prove "f(root) == 0"`
## Tool Commands
### Scipy_Brentq
```bash
uv run python -c "from scipy.optimize import brentq; root = brentq(lambda x: x**2 - 2, 0, 2); print('Root:', root)"
```
### Scipy_Newton
```bash
uv run python -c "from scipy.optimize import newton; root = newton(lambda x: x**2 - 2, 1.0, fprime=lambda x: 2*x); print('Root:', root)"
```
### Sympy_Solve
```bash
uv run python -m runtime.harness scripts/sympy_compute.py solve "x**3 - x - 1" --var x
```
## Key Techniques
*From indexed textbooks:*
- [Numerical analysis (Burden R.L., Fair... (Z-Library)] How accurate was his approximation? C H A P T E R 2 Solutions of Equations in One Variable 2. Survey of Methods and Software In this chapter we have considered the problem of solving the equation f (x) = 0, where f is a given continuous function.
- [An Introduction to Numerical Analysis... (Z-Library)] Computational Solution of Nonlinear Operator Equations. Methods for Solving Systems of Nonlinear Equations. Society for Industrial and Applied Mathematics, Philadelphia.
- [An Introduction to Numerical Analysis... (Z-Library)] General polynomial rootfinding methods There are a large number of rootfind ing algorithms designed especially for polynomials. Many of these are taken up in detail in the books Dejon and Henrici (1969), Henrici (1974, chap. There are far too many types of such methods to attempt to describe them all here.
- [An Introduction to Numerical Analysis... (Z-Library)] J n Consider the product a 0 a 1 ••• am, where a 0 , a1, ••• , am are m + 1 num bers stored in a computer that uses n digit base fJ arithmetic. What is a rigorous bound for w? What is a statistical estimate for the size of w?
- [An Introduction to Numerical Analysis... (Z-Library)] Discussion of the Literature There is a large literature on methods for calculating the roots of a single equation. See the books by Householder (1970), Ostrowski (1973), and Traub (1964) for a more extensive development than has been given here. Newton's method is one of the most widely used methods, and its development is due to many people.
## Cognitive Tools Reference
See `.claude/skills/math-mode/SKILL.md` for full tool documentation.
© parcadei · MIT · parcadei/Continuous-Claude-v3