文档中的步骤
结构步骤(非实际执行时序)
marqdo
Not stdlib. Install: marqdo ext add linalg (or build marqdo_plugin_linalg).
Idea: if the .mq.md runs and the asserted form matches, the identity holds under the library rules. Algebra reads like a lecture; factorize / lstsq / draw stay explicit calculation steps.
| @ | name | rows | cols |
|---|---|---|---|
| 1 | A | 2 | 3 |
| 2 | B | 3 | 2 |
access(env, "A")access(env, "B")| _type | matrix |
| ascii | A |
| cols | 3 |
| kind | symbol |
| latex | A |
| name | A |
| … | |
| key | value | ||||||
|---|---|---|---|---|---|---|---|
| _type | matrix | ||||||
| ascii | A | ||||||
| cols | 3 | ||||||
| kind | symbol | ||||||
| latex | A | ||||||
| name | A | ||||||
| rows | 2 | ||||||
| shape |
|
| _type | matrix |
| ascii | B |
| cols | 2 |
| kind | symbol |
| latex | B |
| name | B |
| … | |
| key | value | ||||||
|---|---|---|---|---|---|---|---|
| _type | matrix | ||||||
| ascii | B | ||||||
| cols | 2 | ||||||
| kind | symbol | ||||||
| latex | B | ||||||
| name | B | ||||||
| rows | 3 | ||||||
| shape |
|
| _type | matrix |
| ascii | A*B |
| factors | List(2) |
| kind | mul |
| latex | AB |
| shape | List(2) |
| key | value | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| _type | matrix | |||||||||||||||||||||||||||||||||||||||
| ascii | A*B | |||||||||||||||||||||||||||||||||||||||
| factors |
| |||||||||||||||||||||||||||||||||||||||
| kind | mul | |||||||||||||||||||||||||||||||||||||||
| latex | AB | |||||||||||||||||||||||||||||||||||||||
| shape |
|
| A | Map(8) |
| B | Map(8) |
| _type | matrix_env |
| key | value | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A |
| ||||||||||||||||||||||||
| B |
| ||||||||||||||||||||||||
| _type | matrix_env |
| # | name | rows | cols |
|---|---|---|---|
| 1 | A | 2 | 3 |
| 2 | B | 3 | 2 |
| # | name | rows | cols |
|---|---|---|---|
| 1 | A | 2 | 3 |
| 2 | B | 3 | 2 |
结构步骤(非实际执行时序)
--- markup: occlusion title: How to write a linear-algebra formula document description: ext/linalg formula-doc — declare, infix, run-implies-correct import: la: ext/linalg/linalg.mq.md --- # Formula documents with ext/linalg Not stdlib. Install: `marqdo ext add linalg` (or build `marqdo_plugin_linalg`). *Idea:* if the `.mq.md` runs and the asserted form matches, the identity holds under the library rules. Algebra reads like a lecture; `factorize` / `lstsq` / `draw` stay explicit calculation steps. # main Declare symbols in a table, multiply, transpose — `T_ascii` is one-step display (auto-simplify). `shapes` = | @ | name | rows | cols | |---|------|------|------| | 1 | A | 2 | 3 | | 2 | B | 3 | 2 | **`env` = > la.declare table=`shapes`** **`A` = [A](access(env, "A"))** **`B` = [B](access(env, "B"))** **`P` = `A` * `B`** **`t` = > `P`.T_ascii** > print text=`t` 1. `t` == "B^T*A^T" > print text=formula-doc-ok 2. * > print text=formula-doc-fail > print text=see-examples-linalg-transpose