Show HN: SymDerive – A functional, stateless symbolic math library

Hey HN,

I’m a physicist turned quant. Some friends and I 'built' SymDerive because we wanted a symbolic math library that was "Agent-Native" by design, but still a practical tool for humans.

It boils down to two main goals:

1. Agent Reliability: I’ve found that AI agents write much more reliable code when they stick to stateless, functional pipelines (Lisp-style). It keeps them from hallucinating state changes or getting lost in long procedural scripts. I wanted a library that enforces that "Input -> Transform -> Output" flow by default.

2. Easing the transition to Python: For many physicists, Mathematica is the native tongue. I wanted a way to ease that transition—providing a bridge that keeps the familiar syntax (CamelCase, Sin, Integrate) while strictly using the Python scientific stack under the hood.

What I built: It’s a functional wrapper around the standard stack (SymPy, PySR, CVXPY) that works as a standalone engine for anyone—human or agent—who prefers a pipe-based workflow.

  # The "Pipe" approach (Cleaner for agents, readable for humans)
  result = (
      Pipe((x + 1)**3)
      .then(Expand)
      .then(Simplify) 
      .value
  )
The "Vibes" features:

Wolfram Syntax: Integrate, Det, Solve. If you know the math, you know the API.

Modular: The heavy stuff (Symbolic Regression, Convex Optimization) are optional installs ([regression], [optimize]). It won’t bloat your venv unless you ask it to.

Physics stuff: I added tools I actually use—abstract index notation for GR, Kramers-Kronig for causal models, etc.

It’s definitely opinionated, but if you’re building agents to do rigorous math, or just want a familiar functional interface for your own research, this might help.

I have found that orchestrators (Claude Code, etc) are fairly good at learning the tools and sending tasks to the right persona, we have been surprised by how well it has worked.

Repo here: https://github.com/closedform/deriver

I will cry if roasted too hard

26 points | by dinunnob 5 days ago

5 comments

  • dinunnob 1 hour ago
    Here's a blog post where symderive was used with Claude Code's team agent framework to recast Fischer's early work in a modern language:

    https://dinunno.substack.com/p/transforming-fisher-an-agenti...

  • nchagnet 20 hours ago
    This looks wonderful, I've dreamt of something like this back when I was in academia!

    You mention some advanced stuff like abstract index notation which is usually the hardest part to get right with things like simpy and even mathematica, how does your package handle simplifications of complex tensor expressions (GR, hydrodynamics, etc.)?

    • dinunnob 11 hours ago
      You can specify symmetry/antisymmetry patterns for tensor index slots and it takes advantage of that to speed up the calculations. This part was pretty important for me so i spent some time thinking about it. I wanted to try to put xACT’s patterns in but it would have been quite the undertaking.
      • dinunnob 11 hours ago
        It could definitely be better though
  • viraptor 1 day ago
    > The "Pipe" approach (Cleaner for agents

    How did you verify the benefit?

    • dinunnob 11 hours ago
      Not rigorous, but intuition derived from expression string complexity for postfix operations vs standard sympy style. I’ll take this out, readme was written from sleazy used car salesman advertising point of view. Was more rigorous in examples/test
      • dinunnob 9 hours ago
        removed claim from README
  • OutOfHere 1 day ago
    Please never use `from something import *`, not even for a demo. It is not explicit, not maintainable, and goes against all Python guidelines. Certainly never expect any user to use it either.
    • cl3misch 1 day ago
      FWIW the afaik most common symbolic math Python library sympy does that on the first page of their tutorial. I think in this space it's pretty common.

      https://docs.sympy.org/latest/tutorials/intro-tutorial/intro...

      I have to admit that I still like to use the ancient

          from pylab import *
      
      in scripts that only I will ever see. It makes it so much easier to use numpy in a "tool of thought" way. I would never do this in a library, though.
      • OutOfHere 1 day ago
        Two wrongs don't make a right. It risks significant ambiguity in longer snippets or files, and is therefore bad practice.
    • dinunnob 11 hours ago
      Yeah, you’re not wrong. Makes the syntax a bit annoying here (goal was to lower barrier of entry for physicists). I agree this is bad practice.
      • OutOfHere 11 hours ago
        In the limiting sense, especially when a user mixes your snippet with snippets from other packages, the barrier of entry becomes greater due to the resolution ambiguity, not less.
        • dinunnob 9 hours ago
          fixed in the readme. thanks -

          while we are talking imports ... how did `import pyspark.sql.functions as F` ever get past the pep police

    • marcelbundle 1 day ago
      You would be suprised on how many large scale project I saw this beauty lamao, not saying that this is okay, people just dgaf
  • Confirm2754 4 days ago
    [dead]