Files
marqdo/examples/oa2026-showcase/calculus.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

1.4 KiB
Executable File

markup, title, description, import
markup title description import
occlusion 一份可执行的求导讲义 公式、求导、求根、求值与绘图,在同一条叙述里完成。
math
lib/math.mq.md

main

返回 类型 说明
result any None; execute this page's documented steps in order and observe their output or stated effects

我们从一条曲线开始。下面这个公式既是排版出来的数学对象, 也是运行时可以直接求导、求根与绘图的f。

f =


x^3 - 3*x

对它求导,得到df;再让df在 x = 2 处取值,得到切线斜率。

We first df = [Compute df](math.diff(formula=f, var="x")) for the next step. We first slope = [Compute slope](math.eval(formula=df, var="x", value=2)) for the next step. We now [Display this step's result](> print text=df). We now [Display this step's result](> print text=slope).

曲线与 x 轴的交点同样可以被机器找出来。这里不需要另写一段脚本。

We first roots = [Compute roots](math.solve(formula=f, var="x", min=-3, max=3)) for the next step. We now [Display this step's result](> print text=roots).

最后把公式画成图。图不是截图,而是本文档运行产生的派生物。

We first _svg = [Compute _svg](math.plot(formula=f, var="x", min=-3, max=3, path="calculus-plot.svg")) for the next step. We now [Display this step's result](> print text="plot-ok").