docs: add Newton-cooling calibration skill example (Modelica + brent)#66
Merged
Merged
Conversation
New skills/examples/ walkthrough showing the fz skill solving a one-parameter engineering inverse problem end to end: an AI agent discovers the ready-made Modelica wrapper (fz install model modelica) and the brent algorithm (fz install algorithm brent) to calibrate the cooling coefficient k of a Newton's-law-of-cooling model against a single temperature measurement. Leads with the one-shot natural-language ask, then breaks down the path the agent follows (discover wrappers -> parameterize .mo -> scalar output -> verify forward run -> fzd+brent root-finding), with a checkable analytic outcome (k ~ 0.002088 1/s). Validated end to end against OpenModelica 1.26.1: brent.R recovers k = 0.002088. Doc reflects the verified reality (brent is an R root-finder with ytarget/ytol/ xtol; calculator auto-discovery; the wrapper's res output flattens to res_<Model>_<col> trajectory arrays, so a scalar T_final output is added). Also add a "Worked examples" pointer and list code-wrapper.md in skills/howto.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the first end-to-end “worked example” for the fz agent skill, showing how an agent can solve a simple inverse problem (Newton cooling coefficient calibration) by discovering and reusing existing fz wrappers/algorithms rather than building everything from scratch.
Changes:
- Add a new worked example walkthrough: Newton’s-law-of-cooling calibration using the Modelica wrapper +
brent. - Add a “Worked examples” section to the skill how-to, linking to the new example.
- Update the “What’s in the skill” list to include
code-wrapper.mdand refine the algorithm-wrapper description.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| skills/howto.md | Adds a “Worked examples” section and updates the skill contents list. |
| skills/examples/newton-cooling-calibration.md | New detailed tutorial for Modelica forward simulation + fzd/brent calibration with a checkable analytic result. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+40
to
+42
| - **R with rpy2** — the installed `brent` algorithm is implemented in R (`brent.R`), so fz | ||
| evaluates it through rpy2; it also needs the R package `base64enc`. (`pip install rpy2`, | ||
| and an R install; fz auto-installs `base64enc` via its `#require` header on first use.) |
Comment on lines
+169
to
+174
| > Note the `fzd` CLI quirks: unlike `fzi`/`fzc`/`fzr` (which take `--input_path` and | ||
| > `--input_variables`), `fzd` names these `--input_dir`/`-i` and `--input_vars`/`-v`, and | ||
| > it has no `--format` flag — it prints a convergence summary and writes the design and | ||
| > final analysis under `results_fzd/` (override with `--results_dir`). `--input_dir` | ||
| > accepts a single input file as well as a directory. Like `fzr`, it auto-discovers the | ||
| > installed calculator, so no `--calculators` is required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the first worked fz skill example: an AI agent solving a real engineering inverse problem end to end by discovering two ready-made fz packages rather than building from scratch.
The example
skills/examples/newton-cooling-calibration.md— calibrate the cooling coefficientkof a Newton's-law-of-cooling model (dT/dt = -k·(T − T_env)) against a single measurement (T = 40 °Catt = 600 s), using:fz install model modelica— the Modelica wrapper (OpenModelica forward simulation);fz install algorithm brent— a 1-D root-finder for the calibration loop.It leads with the one-shot natural-language ask, then walks the path the agent follows (discover wrappers → parameterize
.mo→ add a scalar output → verify the forward run →fzd+ brent root-finding), with a checkable analytic outcome (k ≈ 0.002088 1/s).Also adds a "Worked examples" pointer in
skills/howto.mdand listscode-wrapper.mdthere.Validated end to end
Ran against OpenModelica 1.26.1 with the real installed packages: brent.R recovered
k = 0.002088(8 iterations, converged) — the exact analytic value. The doc reflects the verified reality, in particular:brentisbrent.R, an R root-finder (optionsytarget/ytol/xtol), so the objective is the raw residualT_final − 40, not a squared error;--calculators);resoutput flattens tores_<Model>_<col>trajectory arrays, so a scalarT_finaloutput is added for the objective.Depends on #65
Validating this example is what surfaced the
fzdCLI bug fixed in #65. The CLI calibration step here requires that fix to run; #65 should merge first.🤖 Generated with Claude Code