Files
marqdo/tests/ext/linalg-basic-smoke.mq.md
T
cflmyandCursor 687c168014 feat(parse): use nested YAML import: maps instead of one-liner binds
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target
entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the
old one-liner form, and migrate lib/ext/examples/tests/docs accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 19:33:58 +08:00

65 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: linalg basic smoke (L2)
description: from_formula, det, solve 2×2, explicit mul.
import:
la: ext/linalg/linalg.mq.md
math: lib/math.mq.md
---
# main
`A` =
$$
\begin{bmatrix}2&1\\1&3\end{bmatrix}
$$
`b` =
$$
\begin{pmatrix}5\\5\end{pmatrix}
$$
**`A` = > la.from_formula formula=`A`**
**`b` = > la.from_formula formula=`b`**
**`eps` = > math.div a=1 b=1000**
**`d` = > la.det expr=`A`**
**`d0` = > math.sub a=`d` b=5**
**`d0` = > math.abs value=`d0`**
1. `d0` < `eps`
> print text=det-ok
2. *
> print text=det-fail
**`tr` = > la.trace expr=`A`**
**`t0` = > math.sub a=`tr` b=5**
**`t0` = > math.abs value=`t0`**
1. `t0` < `eps`
> print text=trace-ok
2. *
> print text=trace-fail
**`sol` = > la.solve a=`A` b=`b`**
**`x` = [x](sol)**
**`data` = [data](x)**
**`row0` = > at value=`data` index=0**
**`x0` = > at value=`row0` index=0**
**`e0` = > math.sub a=`x0` b=2**
**`e0` = > math.abs value=`e0`**
1. `e0` < `eps`
> print text=solve-ok
2. *
> print text=solve-fail
**`I` = > la.eye n=2**
**`P` = > la.mul a=`A` b=`I`**
**`E` = > la.explicit expr=`P`**
**`ed` = [data](E)**
**`ed0` = > at value=`ed` index=0**
**`ed00` = > at value=`ed0` index=0**
**`ee` = > math.sub a=`ed00` b=2**
**`ee` = > math.abs value=`ee`**
1. `ee` < `eps`
> print text=explicit-ok
2. *
> print text=explicit-fail