$npx -y skills add parcadei/Continuous-Claude-v3 --skill math-helpGuide to the math cognitive stack - what tools exist and when to use each
| 1 | # Math Cognitive Stack Guide |
| 2 | |
| 3 | Cognitive prosthetics for exact mathematical computation. This guide helps you choose the right tool for your math task. |
| 4 | |
| 5 | ## Quick Reference |
| 6 | |
| 7 | | I want to... | Use this | Example | |
| 8 | |--------------|----------|---------| |
| 9 | | Solve equations | sympy_compute.py solve | `solve "x**2 - 4 = 0" --var x` | |
| 10 | | Integrate/differentiate | sympy_compute.py | `integrate "sin(x)" --var x` | |
| 11 | | Compute limits | sympy_compute.py limit | `limit "sin(x)/x" --var x --to 0` | |
| 12 | | Matrix operations | sympy_compute.py / numpy_compute.py | `det "[[1,2],[3,4]]"` | |
| 13 | | Verify a reasoning step | math_scratchpad.py verify | `verify "x = 2 implies x^2 = 4"` | |
| 14 | | Check a proof chain | math_scratchpad.py chain | `chain --steps '[...]'` | |
| 15 | | Get progressive hints | math_tutor.py hint | `hint "Solve x^2 - 4 = 0" --level 2` | |
| 16 | | Generate practice problems | math_tutor.py generate | `generate --topic algebra --difficulty 2` | |
| 17 | | Prove a theorem (constraints) | z3_solve.py prove | `prove "x + y == y + x" --vars x y` | |
| 18 | | Check satisfiability | z3_solve.py sat | `sat "x > 0, x < 10, x*x == 49"` | |
| 19 | | Optimize with constraints | z3_solve.py optimize | `optimize "x + y" --constraints "..."` | |
| 20 | | Plot 2D/3D functions | math_plot.py | `plot2d "sin(x)" --range -10 10` | |
| 21 | | Arbitrary precision | mpmath_compute.py | `pi --dps 100` | |
| 22 | | Numerical optimization | scipy_compute.py | `minimize "x**2 + 2*x" "5"` | |
| 23 | | Formal machine proof | Lean 4 (lean4 skill) | `/lean4` | |
| 24 | |
| 25 | ## The Five Layers |
| 26 | |
| 27 | ### Layer 1: SymPy (Symbolic Algebra) |
| 28 | |
| 29 | **When:** Exact algebraic computation - solving, calculus, simplification, matrix algebra. |
| 30 | |
| 31 | **Key Commands:** |
| 32 | ```bash |
| 33 | # Solve equation |
| 34 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 35 | solve "x**2 - 5*x + 6 = 0" --var x --domain real |
| 36 | |
| 37 | # Integrate |
| 38 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 39 | integrate "sin(x)" --var x |
| 40 | |
| 41 | # Definite integral |
| 42 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 43 | integrate "x**2" --var x --bounds 0 1 |
| 44 | |
| 45 | # Differentiate (2nd order) |
| 46 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 47 | diff "x**3" --var x --order 2 |
| 48 | |
| 49 | # Simplify (trig strategy) |
| 50 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 51 | simplify "sin(x)**2 + cos(x)**2" --strategy trig |
| 52 | |
| 53 | # Limit |
| 54 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 55 | limit "sin(x)/x" --var x --to 0 |
| 56 | |
| 57 | # Matrix eigenvalues |
| 58 | uv run python -m runtime.harness scripts/sympy_compute.py \ |
| 59 | eigenvalues "[[1,2],[3,4]]" |
| 60 | ``` |
| 61 | |
| 62 | **Best For:** Closed-form solutions, calculus, exact algebra. |
| 63 | |
| 64 | ### Layer 2: Z3 (Constraint Solving & Theorem Proving) |
| 65 | |
| 66 | **When:** Proving theorems, checking satisfiability, constraint optimization. |
| 67 | |
| 68 | **Key Commands:** |
| 69 | ```bash |
| 70 | # Prove commutativity |
| 71 | uv run python -m runtime.harness scripts/cc_math/z3_solve.py \ |
| 72 | prove "x + y == y + x" --vars x y --type int |
| 73 | |
| 74 | # Check satisfiability |
| 75 | uv run python -m runtime.harness scripts/cc_math/z3_solve.py \ |
| 76 | sat "x > 0, x < 10, x*x == 49" --type int |
| 77 | |
| 78 | # Optimize |
| 79 | uv run python -m runtime.harness scripts/cc_math/z3_solve.py \ |
| 80 | optimize "x + y" --constraints "x >= 0, y >= 0, x + y <= 100" \ |
| 81 | --direction maximize --type real |
| 82 | ``` |
| 83 | |
| 84 | **Best For:** Logical proofs, constraint satisfaction, optimization with constraints. |
| 85 | |
| 86 | ### Layer 3: Math Scratchpad (Reasoning Verification) |
| 87 | |
| 88 | **When:** Verifying step-by-step reasoning, checking derivation chains. |
| 89 | |
| 90 | **Key Commands:** |
| 91 | ```bash |
| 92 | # Verify single step |
| 93 | uv run python -m runtime.harness scripts/cc_math/math_scratchpad.py \ |
| 94 | verify "x = 2 implies x^2 = 4" |
| 95 | |
| 96 | # Verify with context |
| 97 | uv run python -m runtime.harness scripts/cc_math/math_scratchpad.py \ |
| 98 | verify "x^2 = 4" --context '{"x": 2}' |
| 99 | |
| 100 | # Verify chain of reasoning |
| 101 | uv run python -m runtime.harness scripts/cc_math/math_scratchpad.py \ |
| 102 | chain --steps '["x^2 - 4 = 0", "(x-2)(x+2) = 0", "x = 2 or x = -2"]' |
| 103 | |
| 104 | # Explain a step |
| 105 | uv run python -m runtime.harness scripts/cc_math/math_scratchpad.py \ |
| 106 | explain "d/dx(x^3) = 3*x^2" |
| 107 | ``` |
| 108 | |
| 109 | **Best For:** Checking your work, validating derivations, step-by-step verification. |
| 110 | |
| 111 | ### Layer 4: Math Tutor (Educational) |
| 112 | |
| 113 | **When:** Learning, getting hints, generating practice problems. |
| 114 | |
| 115 | **Key Commands:** |
| 116 | ```bash |
| 117 | # Step-by-step solution |
| 118 | uv run python scripts/cc_math/math_tutor.py steps "x**2 - 5*x + 6 = 0" --operation solve |
| 119 | |
| 120 | # Progressive hint (level 1-5) |
| 121 | uv run python scripts/cc_math/math_tutor.py hint "Solve x**2 - 4 = 0" --level 2 |
| 122 | |
| 123 | # Generate practice problem |
| 124 | uv run python scripts/cc_math/math_tutor.py generate --topic algebra --difficulty 2 |
| 125 | ``` |
| 126 | |
| 127 | **Best For:** Learning, tutoring, practice. |
| 128 | |
| 129 | ### Layer 5: Lean 4 (Formal Proofs) |
| 130 | |
| 131 | **When:** Rigorous machine-verified mathematical proofs, category theory, type theory. |
| 132 | |
| 133 | **Access:** Use `/lean4` skill for full documentation. |
| 134 | |
| 135 | **Best For:** |