Old and new apps, via modern coding agents
Old and new apps, via modern coding agents
通过现代编程智能体实现旧应用焕新与新应用开发
I have been interested in machine-assisted ways to do and teach mathematics from as far back as 1999, when I started coding several applets in Java 1.0, both for my complex analysis and linear algebra courses, as well as to visualize various mathematical objects I was interested in (such as honeycombs or Besicovitch sets). 早在1999年,我就对利用机器辅助数学研究与教学产生了浓厚兴趣。当时,我用Java 1.0编写了几个小程序(applets),既用于我的复分析和线性代数课程,也用于可视化我感兴趣的各种数学对象(例如蜂窝结构或Besicovitch集)。
This was moderately successful; but the applets were time-consuming to program. Eventually, the standards for web pages stopped supporting this version of Java, and the applets became non-functional. 这些尝试取得了一定的成功,但编写这些小程序非常耗时。最终,网页标准不再支持该版本的Java,这些小程序也随之失效了。
However, in the last few days I have begun the process of migrating much of my old web page and blog data to a more maintainable repository, using modern AI assistance. As an experiment, I asked the agent to port my old applets to a modern supported language (we landed on Javascript), and it managed to do so in a matter of hours, with all of my old applets now functional again, with even a few graphical upgrades (for instance, the Besicovitch set applet is now colorized, in contrast to my original monochrome version). 然而,在过去几天里,我开始利用现代AI辅助,将我大部分旧网页和博客数据迁移到一个更易于维护的存储库中。作为一项实验,我要求智能体将我的旧小程序移植到一种现代支持的语言(我们最终选择了Javascript)上。它在几小时内就完成了任务,我所有的旧小程序现在都恢复了功能,甚至还进行了一些图形化升级(例如,Besicovitch集小程序现在有了颜色,而我最初的版本是单色的)。
I am particularly pleased to see the honeycomb applet that I wrote with Allen Knutson in 1999 come back to life, as this was a particularly tricky one to code by hand: Notoriously, LLM-based coding agents can create various blatant or subtle bugs in their code; but in the porting of these two dozen or so applets, I could only find one minor bug (the handling of a drag event in one of the complex analysis applets had unwanted behavior when dragging outside of the main box), and in fact the agent identified two bugs in the original code that I was not aware of, so it ended up being a net wash as far as code quality was concerned. 我特别高兴看到我和Allen Knutson在1999年编写的蜂窝小程序重获新生,因为当初手工编写它时非常棘手。众所周知,基于大语言模型(LLM)的编程智能体可能会在代码中制造各种明显或隐蔽的错误;但在移植这二十多个小程序的过程中,我只发现了一个小错误(其中一个复分析小程序在主框外拖动时,拖拽事件的处理出现了异常行为)。事实上,智能体还识别出了我原代码中未曾察觉的两个错误,因此就代码质量而言,这最终达到了收支平衡。
In any event, as these applets are meant to be secondary visual aids rather than critical components of a mathematical argument, the downside risk of such bugs is relatively low. The process was painless enough that I decided to also try coding some new apps, in addition to porting the old ones. 无论如何,由于这些小程序旨在作为辅助性的视觉工具,而非数学论证的关键组成部分,因此这类错误带来的风险相对较低。整个过程非常轻松,以至于我决定在移植旧程序之外,也尝试编写一些新的应用。
Back in 1999 I had an ambitious idea for a visualization tool for special relativity; this was before the release of the software tool Inkscape, but the idea I had in mind was basically “Inkscape, but in Minkowski space”. I had even started writing Java code for this app, but the code complexity became too much for me, and I abandoned the project. 早在1999年,我就有一个关于狭义相对论可视化工具的宏大构想;那是在Inkscape软件发布之前,但我脑海中的想法基本上就是“在闵可夫斯基空间里的Inkscape”。我甚至开始为这个应用编写Java代码,但代码的复杂性超出了我的能力范围,我最终放弃了这个项目。
However, after a couple hours of “vibe coding” with an AI agent, I was finally able to generate an applet that matched the vision I had back in 1999, which can now be found here. A summary of the conversation I had with the agent to generate this code can be found here (it has been edited down to remove a large number of tedious technical implementation reports). 然而,在与AI智能体进行了几个小时的“直觉编程”(vibe coding)后,我终于能够生成一个符合我1999年愿景的小程序,现在可以在这里找到它。我与智能体生成此代码的对话摘要可以在这里找到(为了去除大量繁琐的技术实现报告,内容经过了编辑)。
While I have playtested the app somewhat, I would be interested in receiving further feedback on this “alpha” version of the applet, as I am sure (especially given the LLM-generated nature of the code) that there are still some bugs and rough edges to be ironed out. 虽然我已经对该应用进行了一些测试,但我很希望能收到关于这个“Alpha”版本小程序的进一步反馈,因为我确信(考虑到代码是由LLM生成的),仍然存在一些需要解决的错误和粗糙之处。
After writing my blog post on the Gilbreath conjecture paper earlier today, I realized that I could similarly ask the agent to code a visualization tool for the Gilbreath conjecture to accompany the paper and blog post. After another few hours of conversation, this is now done; you can try out the visualization here. 今天早些时候写完关于Gilbreath猜想论文的博客文章后,我意识到我同样可以要求智能体为Gilbreath猜想编写一个可视化工具,以配合论文和博客文章。经过几个小时的对话,现在已经完成了;你可以在这里尝试这个可视化工具。
Again, the procedure was quite painless (see this transcript of the process), and I think I may add such interactive visualizations as supplements for future papers; as such supplements are not mission-critical to the core of the paper, I again feel that the downside risk of using guided interaction with LLM agents to generate such visualizations is acceptable. 同样,整个过程非常轻松(参见此过程记录),我想我可能会在未来的论文中添加此类交互式可视化作为补充;由于这些补充内容对论文核心并非至关重要,我再次认为,利用与LLM智能体的引导式交互来生成此类可视化所带来的风险是可以接受的。