展示HN:SymDerive – 一个功能齐全的无状态符号数学库
嘿,HN,
我是一名转行的量化物理学家。我和一些朋友“构建”了SymDerive,因为我们希望有一个符号数学库,设计上是“代理原生”的,同时又是一个对人类实用的工具。
这归结为两个主要目标:
1. 代理可靠性:我发现,当AI代理遵循无状态的函数式管道(类似Lisp风格)时,它们编写的代码要可靠得多。这可以防止它们产生状态变化的幻觉或在长的过程脚本中迷失。我希望有一个库默认强制执行“输入 -> 转换 -> 输出”的流程。
2. 缓解向Python的过渡:对于许多物理学家来说,Mathematica是他们的母语。我想提供一种方式来缓解这一过渡——提供一座桥梁,保持熟悉的语法(驼峰命名法、Sin、Integrate),同时在底层严格使用Python科学栈。
我构建的内容:这是一个围绕标准栈(SymPy、PySR、CVXPY)的函数式封装,作为一个独立的引擎,适用于任何人——无论是人类还是代理——喜欢基于管道的工作流程。
```python
# “管道”方法(对代理更清晰,对人类可读)
result = (
Pipe((x + 1)**3)
.then(Expand)
.then(Simplify)
.value
)
```
“氛围”特性:
- Wolfram语法:Integrate、Det、Solve。如果你懂数学,你就懂这个API。
- 模块化:重的功能(符号回归、凸优化)是可选安装([regression]、[optimize])。除非你要求,否则不会膨胀你的虚拟环境。
- 物理工具:我添加了我实际使用的工具——广义相对论的抽象指标符号、因果模型的克拉默斯-克罗尼希等。
这绝对是有主见的,但如果你正在构建代理来进行严格的数学计算,或者只是想要一个熟悉的函数式接口来进行自己的研究,这可能会有所帮助。
我发现协调者(Claude Code等)在学习工具和将任务发送到正确角色方面相当不错,我们对它的效果感到惊讶。
代码库在这里:https://github.com/closedform/deriver
如果被嘲笑得太狠我会哭的。
查看原文
Hey HN,<p>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.<p>It boils down to two main goals:<p>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.<p>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.<p>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.<p><pre><code> # The "Pipe" approach (Cleaner for agents, readable for humans)
result = (
Pipe((x + 1)**3)
.then(Expand)
.then(Simplify)
.value
)
</code></pre>
The "Vibes" features:<p>Wolfram Syntax: Integrate, Det, Solve. If you know the math, you know the API.<p>Modular: The heavy stuff (Symbolic Regression, Convex Optimization) are optional installs ([regression], [optimize]). It won’t bloat your venv unless you ask it to.<p>Physics stuff: I added tools I actually use—abstract index notation for GR, Kramers-Kronig for causal models, etc.<p>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.<p>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.<p>Repo here: https://github.com/closedform/deriver<p>I will cry if roasted too hard