作者打造 FieldTrip 向量微積分實驗室,讓 Gemma 規劃互動實驗
I Wanted to Be Lazy About Calculus. So I Built a Gemma Lab That Does the Experiments for Me
Abhishek Nandy 打造 FieldTrip,一個以本機 Gemma 選擇向量微積分實驗、再由程式計算並呈現結果的互動實驗室。FieldTrip 提供五種起始場景、參數比較及可重播設定,並設有人工確認步驟,讓用戶檢視 Gemma 選出的實驗。作者以 24 條自建問題測試 Gemma 4 E2B,模型在 15 條支援請求中全部選對場景,但只正確拒絕 9 條範圍外請求中的 1 條。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
I asked Gemma to explain a vector field. It was confidently wrong. So I built FieldTrip.
Less setup. More aha. A local Gemma-powered vector calculus lab for the Slow and Steady challenge.
Gemma told me a smooth vector field was singular.
The animation looked convincing. The explanation was wrong.
I had asked it about a rotating field with components (-2y, 2x, 0). Its explanation mixed up the curl, the integrals, and an excluded axis that this field does not have.
That became the most useful failure in this project. I needed a clearer division of work: let the model interpret the question, let math tools calculate, and let me inspect both.
I also wanted to stop doing the repetitive parts of exploring calculus: writing plotting code, rebuilding a scene, changing one parameter, recording the result, and doing it again.
So I built FieldTrip, a small vector calculus lab where one question can become a reviewable experiment, an interactive 3D scene, and a table of comparisons you can replay.
The sloth gets to watch the arrows. The lab does the setup.
What I Built
FieldTrip turns supported natural-language questions into visual investigations of vector fields.
Ask:
Show a rotating field and compare loop sizes.
Local Gemma selects a field and a comparison. FieldTrip shows that selection before running it. After I accept, code supplies the formula, calculates derivatives and integrals, and builds the scene.
The lab includes five starting points:
| Field | Question to explore |
|---|---|
| Vortex | Can something rotate without expanding? |
| Source | Can something expand without rotating? |
| Saddle | Can a shape stretch while preserving local volume? |
| Gradient | What does following an uphill direction look like? |
| Excluded-axis vortex | Why can zero curl coexist with nonzero circulation? |
There are particles to follow, arrows to inspect, a boundary curve, a spanning surface, and controls for radius, strength, surface lift, and orientation. The math panel exposes symbolic divergence and curl. A point probe lets you inspect a location.
Explore for me runs parameter comparisons. Each table row has a replay button that restores its configuration. Investigations can be exported as JSON and imported again; calculations are recomputed rather than accepted from the imported numbers.
The public lab runs curated experiments immediately. Local Gemma inference uses the downloaded app and Ollama.
Demo
The public deployment and the local AI version have different responsibilities. Render hosts the interactive front end. Gemma runs on my laptop through Ollama. Opening the public URL does not provision a model for the visitor.
How I Built It
Give Gemma a small, useful job
The first version gave the model too much freedom. It could produce expressions and explanations that sounded plausible while disagreeing with the calculations.
The current planner returns a small structured object:
{
"field": "vortex",
"comparison": "radius"
}
The allowed field IDs correspond to the five examples, plus an outside-scope response. The comparison is radius, surface, orientation, or none. Unknown IDs and extra properties are rejected.
Gemma does not generate the preset formulas. It chooses which supported experiment fits the request.
Before anything changes, a review dialog shows the selected field, comparison, formula, and defaults. I can run it or keep the current experiment.



