diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e68561..bf5554b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,8 +20,22 @@ --- -## [Unreleased] - +## [V5.0-rc1] - 2026-08-04 + +### 2026-08-04 — `feat` — 新增三门内置课程与 load_course.py 加载器(KC 骨架 + 锚点真题) +- 新增 `courses/{calc-a1,calc-a2,linalg}/seed.yaml`:微积分A1(29 KC)、微积分A2(30 KC)、线性代数(10 KC) 的知识骨架(按电子教案/期末复习章节提炼)。 +- **锚点真题(供 Agent 参考出题风格)**:提取微积分A1 期末样卷 7 道选择题、微积分A2 期末样卷 13 道(填空+解答)、线代《习题1》4 道(行列式/方程组),答案均经独立计算复核;另每门配 8 道 synthetic 题(过四道闸门)作风格补充。预置课程不提供完整题库——刷题时已有题直接用,凑不够的部分由主 Agent 现场三卡生成。 +- 新增 `scripts/load_course.py`:把内置课程作为事件灌入工作区(init_course + source_registered + kc_created + register_question + derive),符合「events.jsonl 唯一真相源」铁律;支持 `--list` / `--course-id` / `--exam-date`。 +- `SKILL.md` 新增「内置课程(开箱即学)」节、开场分流选项 F、路由表「内置课程」行、「没有课程」状态优先提示内置课程。 +- 修复:YAML 把 `2026-01-10` 隐式解析为 `datetime.date` 致事件 JSON 序列化失败,`load_course.py` 统一转为字符串。 +- 依据:`Desktop\study-loop内置课程`(清华 2025-26);大学物理B1 不在本批材料范围。 +- 涉及:`scripts/load_course.py`、`courses/`、`SKILL.md`、`README.md`、`CHANGELOG.md`。 + +### 2026-08-04 — `docs` — README 首屏定位与海报标语改为最简白话版 +- 重写中英文 README 首屏定位:去掉“证据驱动学习闭环”“沉淀”“动态安排”等术语与 AI 化措辞。第一句直接给出功能定义(大学课程复习与备考助手),再用「别的软件 vs study-loop」的对比把核心竞争点讲清楚——不让你假装学会:独立做对 + 换题型再考 + 追错因 + AI 出题自检;末尾保留本地优先与「听懂 ≠ 掌握」标语。 +- 配套更新中英海报文字层:副标题由「面向长期掌握的证据驱动学习 Agent」改为「不让你假装学会的大学复习助手」;特性标签由「错因记忆 · 间隔复习 · 迁移验证 · 下一步建议」改为「记错因 · 防遗忘 · 换题再考 · 今天学什么」。 +- 依据:askSia / Anki / Remnote / Quizlet / QuestionAI / 作业帮 / 夸克 共 6+ 家竞品调研,确认 study-loop 真正独有的差异化为情境化错因记忆、迁移验证闭环、出题四闸门、证据驱动六态、本地事件溯源。 +- 涉及:`README.md`、`README_EN.md`、`assets/readme-banner-zh.svg`、`assets/readme-banner-en.svg`、`CHANGELOG.md`。 ### 2026-07-26 — `docs` — README / CLAUDE.md / README_EN.md 同步最新产品定位 md - README / README_EN:产品定位开头改为「不生产知识,生产关于你的证据」并指向产品定位 md;教学状态「六态」→「七态」(补 `unseen`,共 3 处);错因描述补「14 类」;Roadmap 同步 md §9(场景补全 / 断点续传 / 三前端回传 / 出题双路径 / 内容解析)。README_EN 补回缺失的 V4 交付段。 - CLAUDE.md:「这是什么」加「证据驱动」核心定位 + 指向产品定位 md;KC 字段补 `source_ids`/`aliases`/`related`/`weight`/`syllabus_node`;Question 字段补溯源 `grounding`/`exam_ref`/`style_note`/`rubric` 等;常用命令补 `drill.py`;末尾「正在推进的功能(V1→V2)」(三项均已完成)重写为「当前进度(V4 已交付)+ 下一轮目标」。 diff --git a/README.md b/README.md index 7050af0..731afcb 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,15 @@ --- -`study-loop` 是你课程学习的好伙伴——从课前预习到考前冲刺,同一个 agent、同一套知识点体系、同一份学习档案。它不生产知识,**它生产关于你的证据**:把每一道题变成一份可查证、可反驳的知识档案。它记录的不只是“答对没有”,还包括为什么会错、在什么条件下会错、能否迁移、依赖多少提示、多久会忘,以及下一步最值得学什么。 +`study-loop` 是一个帮你复习大学课程、准备考试的助手,在 Claude Code 里使用。 -> **Explanation is not evidence.** 听懂不是掌握证据,独立完成才是。 +告诉它你在学哪门课、什么时候考试,它就帮你安排每天最该学什么、出题给你练、把错题揪出来讲清楚、按遗忘曲线带你复习,考前还能直接出一份模拟卷——从开学一直管到期末。 + +它和别的刷题、背卡软件最不一样的地方,一句话:**它不让你“假装学会”。** 别的软件答对一次就给你标“已掌握”,刷完一遍卡就算记住了;study-loop 要你独立做对、换个题型还能做对,才认你“真的会”。每道错题它都追着问“你到底为什么错”,记下来,再换个问法考你,直到确认你不是蒙的——连 AI 出的题,也要先自己解一遍、被挑过刺,才敢拿来考你。 + +你所有的学习记录都存在自己电脑上,不依赖任何云服务,也不会因为哪个平台关了就没了。 + +> **听懂 ≠ 掌握。** 它帮你在“听懂”和“真会”之间搭桥。 ## 快速开始 @@ -66,6 +72,17 @@ python3 scripts/init_course.py ~/courses/模拟电子技术 \ 帮我复习模拟电子技术,先告诉我今天最值得做什么。 ``` +### 内置课程(开箱即学) + +微积分A1 / 微积分A2 / 线性代数 已预置知识骨架、练习题库和来源登记,加载后直接可用,无需自备资料: + +```bash +python3 scripts/load_course.py --list +python3 scripts/load_course.py ~/courses/微积分A1 --course-id calc-a1 +``` + +加载即把骨架与题目作为事件写入工作区,随后 `/study` 或 `python3 scripts/drill.py --mode syllabus --count 10 --format html` 即可开始学习与组卷。 + ### 运行端到端 Demo ```bash diff --git a/README_EN.md b/README_EN.md index 008249b..4ebf44d 100644 --- a/README_EN.md +++ b/README_EN.md @@ -20,9 +20,15 @@ --- -`study-loop` is your course companion—from pre-class preview to pre-exam cramming, one agent, one knowledge graph, one learning record. It does not produce knowledge; **it produces evidence about you**: every question becomes a verifiable, falsifiable knowledge record. It tracks more than whether an answer was right: it records why you made a mistake, when the mistake appears, whether you can transfer the skill, how much help you needed, when you may forget it, and what to learn next. +`study-loop` is a study helper for your university courses and exams, used inside Claude Code. -> **Explanation is not evidence.** Understanding a solution is not the same as proving mastery. +Tell it which course you're taking and when the exam is, and it'll plan what to study each day, generate practice questions, walk you through the ones you get wrong, schedule reviews on a forgetting curve, and even produce a mock exam paper before the test — from the first week of class through finals. + +What sets it apart from other study and flashcard apps, in one line: **it won't let you "pretend you've learned it."** Other apps mark a topic "mastered" the moment you answer it once, or count a card as learned after a single pass; study-loop only calls it "really known" when you can solve it on your own *and* still solve it when the question is rephrased. For every mistake it asks "why did you actually get this wrong?", remembers the answer, then re-tests you with a different wording until it's sure you're not just guessing — and even the AI-generated questions have to solve themselves and survive a critic before they're allowed near you. + +All your study data lives on your own computer. It doesn't depend on any cloud service, and it won't vanish if some platform shuts down. + +> **Understanding ≠ mastery.** It builds the bridge between "I get it" and "I can do it." ## Quick start diff --git a/SKILL.md b/SKILL.md index ef47c33..bbd8059 100644 --- a/SKILL.md +++ b/SKILL.md @@ -17,6 +17,25 @@ description: 面向大学课程的本地优先持续学习 Agent。当用户说 6. 面向用户提到知识点时,一律用 `kc_id(中文名)` 形式(脚本已自动生成,你照着念)。 7. 会话开场必须先运行 `python3 scripts/next_step.py`(内部 `derive` 读 `state.json` + `profile`)再决策;所有个性化来自读文件,**不依赖模型「记得」上一会话**。 +## 内置课程(开箱即学) + +微积分A1 / 微积分A2 / 线性代数 三门课已预置:① 按电子教案提炼的 KC 骨架(含权重、前置依赖);② 少量期末样卷/课后真题作为**出题风格锚点**(让 Agent 知道期末考什么难度和题型);③ 课件来源登记。**用户想学这几门课时,直接加载内置课程,不要再向用户索取基础资料。** + +> **预置课程不提供完整题库。** 刷题时 `drill.py` 从已注册题目凑题,凑不够的部分由主 Agent 现场用 `agents/` 三卡流程(generator → solver → reviewer → 机械验证)按锚点真题的风格和难度生成。换句话说:骨架 + 几道样板,肉靠 Agent 现做。 + +| 课程 | course-id | KC 骨架 | 锚点真题(供 Agent 参考风格) | +|---|---|---|---| +| 微积分A1 | calc-a1 | 29 KC(极限→导数→中值定理/Taylor→积分→ODE) | 7 道期末样卷 + 8 道 synthetic | +| 微积分A2 | calc-a2 | 30 KC(多元微分→重积分→曲面积分→级数→Fourier) | 13 道期末样卷 + 8 道 synthetic | +| 线性代数 | linalg | 10 KC(行列式→矩阵→方程组→特征值→二次型→线性空间/变换/欧氏空间) | 4 道《习题1》 + 8 道 synthetic | + +```bash +python3 scripts/load_course.py --list +python3 scripts/load_course.py <工作区目录> --course-id calc-a1 [--exam-date 2026-01-10] +``` + +加载即把骨架/锚点题/来源作为事件写入工作区(符合铁律1)。随后用 `next_step.py` 看今天学什么,`drill.py --mode syllabus --count N --format html` 组卷(已有题直接用、不够则 Agent 现场按锚点风格生成),也可直接让主 Agent 出模拟期末卷。 + ## 新手引导协议 ### 先判断是否需要提问 @@ -37,6 +56,7 @@ B. 做题/刷题 C. 修复一道错题 D. 查看学习状态 E. 准备考试 +F. 开始一门内置课程(微积分A1 / A2 / 线性代数,开箱即学) ``` 用一句话说明每个选择会触发什么流程,不把 CLI 参数直接丢给学生。 @@ -51,7 +71,7 @@ E. 准备考试 ### 状态解释 -- 没有课程:说明课程工作区需要 `course.yaml`,给出 `init_course.py` 示例。 +- 没有课程:优先提示可加载内置课程(`load_course.py --list`,见「内置课程」一节);用户若要自建空白课再用 `init_course.py`。 - 没有 KC:说明知识点是安排复习的骨架,建议先从考纲注册。 - 没有题目:说明需要注册真题/课后题,或明确请求生成迁移题。 - 没有到期卡:说明当前没有紧急 FSRS 复习,不把它误报成“已经掌握”。 @@ -66,6 +86,9 @@ E. 准备考试 | 学生意图 | 你要做的事 | 参考 | |---|---|---| +| 新课程 | `python3 scripts/init_course.py <目录> --course-id .. --name .. --exam-date ..`,然后逐个 `event.py kc-add` 注册骨架(考纲优先),`event.py source-add` 登记来源 | references/provenance.md | +| 内置课程 | 用户想学微积分A1/A2/线代时,直接 `python3 scripts/load_course.py <目录> --course-id ` 加载,**不要索取资料**;加载后即有骨架+题库+来源 | 见上方「内置课程」 | +| 讲解教学 | 当帧教学;讲完 `event.py kc-explained --kc-id ..` | references/evidence-graph.md | | 新课程 | `init_course.py ... [--syllabus "ch1:..,ch2:.."]` 建章节树 → 逐个 `event.py kc-add --syllabus-node ..` 注册骨架。**注册前先查别名**:读现有 KC 的 name/aliases(可用 registry.find_kc_by_alias),命中则提示「这是新 KC 还是『X』的别名?」,避免知识点漂移 | references/provenance.md | | 讲解教学 | **讲解前读 `state.json.profile`,按 `references/teaching-style.md` 调风格**(quantitative 低→多类比、conceptual 低→多重复等)→ 当帧教学 → 讲完 `event.py kc-explained --kc-id ..` | references/evidence-graph.md, references/teaching-style.md | | 做题/刷题 | 出示题目 → 先问置信度(猜的/不太确定/比较确定/非常确定 → 0.25/0.5/0.75/1.0)→ 学生作答 → `event.py attempt --question-id .. --correct|--wrong --confidence .. [--hint-level ..] [--transfer] [--retest-of ..]` | references/hint-ladder.md | diff --git a/assets/readme-banner-en.svg b/assets/readme-banner-en.svg index fc5c110..391ca27 100644 --- a/assets/readme-banner-en.svg +++ b/assets/readme-banner-en.svg @@ -1,6 +1,6 @@ - study-loop: evidence-driven learning - Evidence-driven learning loop with knowledge nodes, review cards and next-step guidance. + study-loop: the study helper that won't let you fake mastery + A study helper for university courses that tracks why you get things wrong and re-tests you until mastery is real. @@ -24,8 +24,8 @@ study-loop - Evidence-driven learning for long-term mastery - Misconception memory · spaced review · transfer checks · next step + The study helper that won't let you fake mastery + track mistakes · spaced review · re-test rephrased · today's plan diff --git a/assets/readme-banner-zh.svg b/assets/readme-banner-zh.svg index 3dd6cde..0f979a8 100644 --- a/assets/readme-banner-zh.svg +++ b/assets/readme-banner-zh.svg @@ -1,6 +1,6 @@ - study-loop:证据驱动的长期学习 - study-loop 面向长期掌握的证据驱动学习 Agent,包含知识节点、复习卡片和下一步建议。 + study-loop:不让你假装学会的大学复习助手 + study-loop 是一个帮你复习大学课程、准备考试的助手,会记下你为什么错、换个题型再考你,直到确认你真的学会。 @@ -24,8 +24,8 @@ study-loop - 面向长期掌握的证据驱动学习 Agent - 错因记忆 · 间隔复习 · 迁移验证 · 下一步建议 + 不让你假装学会的大学复习助手 + 记错因 · 防遗忘 · 换题再考 · 今天学什么 diff --git a/courses/calc-a1/seed.yaml b/courses/calc-a1/seed.yaml new file mode 100644 index 0000000..b885919 --- /dev/null +++ b/courses/calc-a1/seed.yaml @@ -0,0 +1,345 @@ +# 微积分A1 内置课程种子数据 +# 来源:Desktop\study-loop内置课程\微积分A1(清华 2025 秋,电子教案 + 期末样题) +# KC 骨架按电子教案章节提炼;题目为锚点真题(期末样卷 + synthetic),供 Agent 参考出题风格。 +# 预置课程不提供完整题库——刷题时已有题直接用,凑不够由主 Agent 现场三卡生成。 +course_id: calc-a1 +name: 微积分A1 +exam_date: 2026-01-10 # 占位,load 时可用 --exam-date 覆盖 + +sources: + - {source_id: slide_1_1, source_type: lecture_slide, file: 微积分A1/1-1实数与极限.pdf} + - {source_id: slide_1_2, source_type: lecture_slide, file: 微积分A1/1-2收敛列的性质.pdf} + - {source_id: slide_1_3, source_type: lecture_slide, file: 微积分A1/1-3单调数列与Stolz定理.pdf} + - {source_id: slide_1_4, source_type: lecture_slide, file: 微积分A1/1-4实数系的几个基本定理.pdf} + - {source_id: slide_2_1, source_type: lecture_slide, file: 微积分A1/2-1函数的极限与性质.pdf} + - {source_id: slide_2_2, source_type: lecture_slide, file: 微积分A1/2-2无穷小量与无穷大量.pdf} + - {source_id: slide_2_3, source_type: lecture_slide, file: 微积分A1/2-3连续函数.pdf} + - {source_id: slide_3_1, source_type: lecture_slide, file: 微积分A1/3-1导数与求导法则.pdf} + - {source_id: slide_3_2, source_type: lecture_slide, file: 微积分A1/3-2高阶导数.pdf} + - {source_id: slide_4_1, source_type: lecture_slide, file: 微积分A1/4-1微分中值定理.pdf} + - {source_id: slide_4_2, source_type: lecture_slide, file: 微积分A1/4-2L'Hospital法则.pdf} + - {source_id: slide_4_3, source_type: lecture_slide, file: 微积分A1/4-3Taylor公式.pdf} + - {source_id: slide_4_4, source_type: lecture_slide, file: 微积分A1/4-4函数的增减与极值.pdf} + - {source_id: slide_4_5, source_type: lecture_slide, file: 微积分A1/4-5函数的凸凹与作图.pdf} + - {source_id: slide_5_1, source_type: lecture_slide, file: 微积分A1/5-1Riemann积分的概念.pdf} + - {source_id: slide_5_2, source_type: lecture_slide, file: 微积分A1/5-2Riemann积分的性质.pdf} + - {source_id: slide_5_3, source_type: lecture_slide, file: 微积分A1/5-3Newton-Leibniz公式.pdf} + - {source_id: slide_5_4, source_type: lecture_slide, file: 微积分A1/5-4不定积分的变量替换与分部积分.pdf} + - {source_id: slide_5_5, source_type: lecture_slide, file: 微积分A1/5-5有理函数与三角有理式的不定积分.pdf} + - {source_id: slide_5_6, source_type: lecture_slide, file: 微积分A1/5-6定积分的计算.pdf} + - {source_id: slide_5_7, source_type: lecture_slide, file: 微积分A1/5-7积分的应用.pdf} + - {source_id: slide_6_1, source_type: lecture_slide, file: 微积分A1/6-1广义积分.pdf} + - {source_id: slide_6_2, source_type: lecture_slide, file: 微积分A1/6-2广义积分判敛.pdf} + - {source_id: slide_7_1, source_type: lecture_slide, file: 微积分A1/7-1解的存在唯一性定理.pdf} + - {source_id: slide_7_2, source_type: lecture_slide, file: 微积分A1/7-2一阶ODE的初等解法.pdf} + - {source_id: slide_7_3, source_type: lecture_slide, file: 微积分A1/7-3高阶ODE的降阶和幂级数解法.pdf} + - {source_id: slide_7_4, source_type: lecture_slide, file: 微积分A1/7-4线性ODE解的结构.pdf} + - {source_id: slide_7_5, source_type: lecture_slide, file: 微积分A1/7-5高阶常系数线性ODE.pdf} + - {source_id: slide_7_6, source_type: lecture_slide, file: 微积分A1/7-6线性常微分方程组.pdf} + - {source_id: exam_a1_sample, source_type: past_exam, file: 微积分A1/2025秋微积分A1期末考试样题.pdf} + +kcs: + # 第 1 章 极限理论 + - {kc_id: calc_a1_1_1, name: 实数与极限, chapter_id: ch1, exam_weight: 0.70, source_ids: [slide_1_1]} + - {kc_id: calc_a1_1_2, name: 收敛数列的性质, chapter_id: ch1, exam_weight: 0.75, prerequisites: [calc_a1_1_1], source_ids: [slide_1_2]} + - {kc_id: calc_a1_1_3, name: 单调数列与 Stolz 定理, chapter_id: ch1, exam_weight: 0.65, prerequisites: [calc_a1_1_2], source_ids: [slide_1_3]} + - {kc_id: calc_a1_1_4, name: 实数系的基本定理, chapter_id: ch1, exam_weight: 0.60, prerequisites: [calc_a1_1_3], source_ids: [slide_1_4]} + # 第 2 章 函数极限与连续 + - {kc_id: calc_a1_2_1, name: 函数的极限与性质, chapter_id: ch2, exam_weight: 0.75, prerequisites: [calc_a1_1_4], source_ids: [slide_2_1]} + - {kc_id: calc_a1_2_2, name: 无穷小量与无穷大量, chapter_id: ch2, exam_weight: 0.70, prerequisites: [calc_a1_2_1], source_ids: [slide_2_2]} + - {kc_id: calc_a1_2_3, name: 连续函数, chapter_id: ch2, exam_weight: 0.70, prerequisites: [calc_a1_2_2], source_ids: [slide_2_3]} + # 第 3 章 导数与微分 + - {kc_id: calc_a1_3_1, name: 导数与求导法则, chapter_id: ch3, exam_weight: 0.80, prerequisites: [calc_a1_2_3], source_ids: [slide_3_1]} + - {kc_id: calc_a1_3_2, name: 高阶导数, chapter_id: ch3, exam_weight: 0.75, prerequisites: [calc_a1_3_1], source_ids: [slide_3_2]} + # 第 4 章 微分中值定理与导数应用 + - {kc_id: calc_a1_4_1, name: 微分中值定理, chapter_id: ch4, exam_weight: 0.90, prerequisites: [calc_a1_3_2], source_ids: [slide_4_1]} + - {kc_id: calc_a1_4_2, name: L'Hospital 法则, chapter_id: ch4, exam_weight: 0.80, prerequisites: [calc_a1_4_1], source_ids: [slide_4_2]} + - {kc_id: calc_a1_4_3, name: Taylor 公式, chapter_id: ch4, exam_weight: 0.92, prerequisites: [calc_a1_4_1], source_ids: [slide_4_3]} + - {kc_id: calc_a1_4_4, name: 函数的增减与极值, chapter_id: ch4, exam_weight: 0.85, prerequisites: [calc_a1_4_3], source_ids: [slide_4_4]} + - {kc_id: calc_a1_4_5, name: 函数的凸凹与作图, chapter_id: ch4, exam_weight: 0.82, prerequisites: [calc_a1_4_4], source_ids: [slide_4_5]} + # 第 5 章 积分 + - {kc_id: calc_a1_5_1, name: Riemann 积分的概念, chapter_id: ch5, exam_weight: 0.80, prerequisites: [calc_a1_4_1], source_ids: [slide_5_1]} + - {kc_id: calc_a1_5_2, name: Riemann 积分的性质, chapter_id: ch5, exam_weight: 0.80, prerequisites: [calc_a1_5_1], source_ids: [slide_5_2]} + - {kc_id: calc_a1_5_3, name: Newton-Leibniz 公式, chapter_id: ch5, exam_weight: 0.90, prerequisites: [calc_a1_5_2], source_ids: [slide_5_3]} + - {kc_id: calc_a1_5_4, name: 不定积分的换元与分部, chapter_id: ch5, exam_weight: 0.92, prerequisites: [calc_a1_5_3], source_ids: [slide_5_4]} + - {kc_id: calc_a1_5_5, name: 有理函数与三角有理式积分, chapter_id: ch5, exam_weight: 0.88, prerequisites: [calc_a1_5_4], source_ids: [slide_5_5]} + - {kc_id: calc_a1_5_6, name: 定积分的计算, chapter_id: ch5, exam_weight: 0.92, prerequisites: [calc_a1_5_3], source_ids: [slide_5_6]} + - {kc_id: calc_a1_5_7, name: 定积分的应用, chapter_id: ch5, exam_weight: 0.88, prerequisites: [calc_a1_5_6], source_ids: [slide_5_7]} + # 第 6 章 广义积分 + - {kc_id: calc_a1_6_1, name: 广义积分的概念, chapter_id: ch6, exam_weight: 0.75, prerequisites: [calc_a1_5_6], source_ids: [slide_6_1]} + - {kc_id: calc_a1_6_2, name: 广义积分的判敛, chapter_id: ch6, exam_weight: 0.78, prerequisites: [calc_a1_6_1], source_ids: [slide_6_2]} + # 第 7 章 常微分方程 + - {kc_id: calc_a1_7_1, name: 解的存在唯一性定理, chapter_id: ch7, exam_weight: 0.70, prerequisites: [calc_a1_5_3], source_ids: [slide_7_1]} + - {kc_id: calc_a1_7_2, name: 一阶 ODE 的初等解法, chapter_id: ch7, exam_weight: 0.88, prerequisites: [calc_a1_7_1], source_ids: [slide_7_2]} + - {kc_id: calc_a1_7_3, name: 高阶 ODE 的降阶与幂级数解法, chapter_id: ch7, exam_weight: 0.78, prerequisites: [calc_a1_7_2], source_ids: [slide_7_3]} + - {kc_id: calc_a1_7_4, name: 线性 ODE 解的结构, chapter_id: ch7, exam_weight: 0.82, prerequisites: [calc_a1_7_3], source_ids: [slide_7_4]} + - {kc_id: calc_a1_7_5, name: 高阶常系数线性 ODE, chapter_id: ch7, exam_weight: 0.92, prerequisites: [calc_a1_7_4], source_ids: [slide_7_5]} + - {kc_id: calc_a1_7_6, name: 线性常微分方程组, chapter_id: ch7, exam_weight: 0.85, prerequisites: [calc_a1_7_5], source_ids: [slide_7_6]} + +questions: + # 真题选择题(来源:2025秋微积分A1期末考试样题;source_type=past_exam,原题优先入库) + - question_id: a1_real_q1_high_deriv + kc_ids: [calc_a1_3_2] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + 函数 $x^2\cos x$ 的 100 阶导函数 $(x^2\cos x)^{(100)}$ 为 + A. $x^2\cos x + 200x\sin x - 9900\cos x$ + B. $x^2\cos x - 200x\sin x + 9900\cos x$ + C. $x^2\cos x - 200x\sin x - 9900\cos x$ + D. $x^2\cos x + 200x\sin x + 9900\cos x$ + answer: "A" + solution: "由莱布尼茨公式 $(x^2\\cos x)^{(100)}=\\sum_{k=0}^{100}\\binom{100}{k}(x^2)^{(k)}(\\cos x)^{(100-k)}$;$k\\ge 3$ 时 $(x^2)^{(k)}=0$,只算 $k=0,1,2$:$k{=}0\\colon x^2\\cos x$,$k{=}1\\colon -200x\\sin x$,$k{=}2\\colon \\binom{100}{2}\\cdot 2\\cdot(-\\cos x)=-9900\\cos x$,合并为 $x^2\\cos x-200x\\sin x-9900\\cos x$。" + - question_id: a1_real_q2_varint_parity + kc_ids: [calc_a1_5_3] + source_type: past_exam + transfer_level: T0 + difficulty: 0.55 + estimated_minutes: 5 + stem: | + 已知 $f(x)=\int_0^{\sin x}\sin t^3\,dt$,$g(x)=\int_0^x f(t)\,dt$,则 + A. $f(x)$ 是奇函数,$g(x)$ 是奇函数 + B. $f(x)$ 是奇函数,$g(x)$ 是偶函数 + C. $f(x)$ 是偶函数,$g(x)$ 是偶函数 + D. $f(x)$ 是偶函数,$g(x)$ 是奇函数 + answer: "B" + solution: "$f(-x)=\\int_0^{-\\sin x}\\sin t^3\\,dt=-f(x)$,故 $f$ 奇;$g(-x)=\\int_0^{-x}f(t)\\,dt\\xlongequal{u=-t}-\\int_0^x f(-u)\\,du=\\int_0^x f(u)\\,du=g(x)$,故 $g$ 偶。" + - question_id: a1_real_q3_frac_int + kc_ids: [calc_a1_5_6] + source_type: past_exam + transfer_level: T0 + difficulty: 0.50 + estimated_minutes: 5 + stem: | + 定义 $[x]$ 为不大于 $x$ 的最大整数,则 $\int_0^{100}(x-[x])\,dx=$ + A. $100$ B. $50$ C. $10$ D. $200$ + answer: "B" + solution: "$x-[x]$ 是 $x$ 的小数部分,周期为 $1$,每周期积分 $\\int_0^1 x\\,dx=\\tfrac12$,$[0,100]$ 含 $100$ 个周期,总值为 $100\\cdot\\tfrac12=50$。" + - question_id: a1_real_q4_improper + kc_ids: [calc_a1_6_2] + source_type: past_exam + transfer_level: T0 + difficulty: 0.65 + estimated_minutes: 6 + stem: | + 关于广义积分 $\int_1^{+\infty}\dfrac{\sin x}{x^p+\ln x}\,dx$ 的收敛性,以下错误的结论是 + A. 当 $0\le p\le 1$ 时,积分条件收敛 + B. 当 $p>1$ 时,积分绝对收敛 + C. 当 $p<0$ 时,积分发散 + D. 当 $p<0$ 时,积分条件收敛 + answer: "C" + solution: "$p<0$ 时 $x^p+\\ln x\\sim\\ln x$,被积 $\\sim\\dfrac{\\sin x}{\\ln x}$,由 Dirichlet 判别法条件收敛(D 对),故 C「发散」错误。" + - question_id: a1_real_q5_int_compare + kc_ids: [calc_a1_5_6] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 6 + stem: | + 已知 $I_1=\int_0^1\dfrac{x}{2(1+\cos x)}\,dx$,$I_2=\int_0^1\dfrac{\ln(1+x)}{1+\cos x}\,dx$,$I_3=\int_0^1\dfrac{x}{1+\cos x}\,dx$,则 + A. $I_11$(因 $\\ln(1+x)>x/2$ 于 $(0,1)$)故 $I_10$)的通解。 + answer: "y = C1 x^2 + C2 / x^2" + solution: | + Euler 方程,令 $y=x^m$ 代入得 $m(m-1)+m-4=m^2-4=0$,$m=\pm2$,通解 $y=C_1x^2+C_2x^{-2}$。 + # 以下为 synthetic 练习题(覆盖真题未涉及的核心章节,过四道闸门)。 + - question_id: a1_q_limit_taylor + kc_ids: [calc_a1_2_1, calc_a1_4_3] + source_type: synthetic + transfer_level: T0 + difficulty: 0.45 + estimated_minutes: 5 + derived_from: ["kc:calc_a1_2_1"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求极限 $\\lim_{x\\to 0}\\dfrac{\\tan x - x}{x^3}$。" + answer: "$\\dfrac{1}{3}$" + solution: "将 $\\tan x$ 在 $0$ 处泰勒展开:$\\tan x = x + \\dfrac{x^3}{3} + O(x^5)$,代入得 $\\dfrac{\\tan x - x}{x^3} = \\dfrac{1}{3} + O(x^2) \\to \\dfrac{1}{3}$。" + - question_id: a1_q_high_deriv_ln + kc_ids: [calc_a1_3_2, calc_a1_4_3] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 5 + derived_from: ["kc:calc_a1_3_2"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "设 $f(x)=\\ln(1+x)$,求 $f^{(n)}(0)$。" + answer: "$(-1)^{n-1}(n-1)!$" + solution: "$\\ln(1+x)=x-\\dfrac{x^2}{2}+\\dfrac{x^3}{3}-\\cdots$,故 $\\dfrac{f^{(n)}(0)}{n!}=\\dfrac{(-1)^{n-1}}{n}$,得 $f^{(n)}(0)=(-1)^{n-1}(n-1)!$。" + - question_id: a1_q_mvt_cube + kc_ids: [calc_a1_4_1] + source_type: synthetic + transfer_level: T0 + difficulty: 0.4 + estimated_minutes: 4 + derived_from: ["kc:calc_a1_4_1"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "设 $f(x)=x^3$,在区间 $[0,1]$ 上由拉格朗日中值定理确定的 $\\xi$ 为何值?" + answer: "$\\xi=\\dfrac{1}{\\sqrt{3}}$" + solution: "$\\dfrac{f(1)-f(0)}{1-0}=1=f'(\\xi)=3\\xi^2$,解得 $\\xi=\\dfrac{1}{\\sqrt{3}}\\in[0,1]$。" + - question_id: a1_q_taylor_sin5 + kc_ids: [calc_a1_4_3] + source_type: synthetic + transfer_level: T0 + difficulty: 0.45 + estimated_minutes: 5 + derived_from: ["kc:calc_a1_4_3"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "写出 $\\sin x$ 的 5 阶麦克劳林多项式(即到 $x^5$ 项)。" + answer: "$x-\\dfrac{x^3}{6}+\\dfrac{x^5}{120}$" + solution: "$\\sin x = x - \\dfrac{x^3}{3!}+\\dfrac{x^5}{5!}-\\cdots$,5 阶为 $x-\\dfrac{x^3}{6}+\\dfrac{x^5}{120}$。" + - question_id: a1_q_int_sin2 + kc_ids: [calc_a1_5_6] + source_type: synthetic + transfer_level: T0 + difficulty: 0.45 + estimated_minutes: 5 + derived_from: ["kc:calc_a1_5_6"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "计算定积分 $\\displaystyle\\int_0^{\\pi/2}\\sin^2 x\\,dx$。" + answer: "$\\dfrac{\\pi}{4}$" + solution: "降幂 $\\sin^2 x=\\dfrac{1-\\cos 2x}{2}$,原式 $=\\Big[\\dfrac{x}{2}-\\dfrac{\\sin 2x}{4}\\Big]_0^{\\pi/2}=\\dfrac{\\pi}{4}$。" + - question_id: a1_q_int_by_parts + kc_ids: [calc_a1_5_4] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 5 + derived_from: ["kc:calc_a1_5_4"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求不定积分 $\\displaystyle\\int x\\ln x\\,dx$。" + answer: "$\\dfrac{x^2}{2}\\ln x - \\dfrac{x^2}{4} + C$" + solution: "分部积分,取 $u=\\ln x,\\,dv=x\\,dx$,则 $v=\\dfrac{x^2}{2}$:$\\int x\\ln x\\,dx=\\dfrac{x^2}{2}\\ln x-\\int\\dfrac{x^2}{2}\\cdot\\dfrac{dx}{x}=\\dfrac{x^2}{2}\\ln x-\\dfrac{x^2}{4}+C$。" + - question_id: a1_q_improper_p2 + kc_ids: [calc_a1_6_2] + source_type: synthetic + transfer_level: T0 + difficulty: 0.4 + estimated_minutes: 4 + derived_from: ["kc:calc_a1_6_2"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "判断广义积分 $\\displaystyle\\int_1^{+\\infty}\\dfrac{1}{x^2}\\,dx$ 的收敛性,若收敛求其值。" + answer: "收敛,值为 $1$" + solution: "$\\int_1^{+\\infty}x^{-2}\\,dx=\\Big[-\\dfrac{1}{x}\\Big]_1^{+\\infty}=0-(-1)=1$,故收敛且值为 $1$。" + - question_id: a1_q_ode_ivp + kc_ids: [calc_a1_7_5] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 6 + derived_from: ["kc:calc_a1_7_5"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求解初值问题 $y''+y=0$,$y(0)=0$,$y'(0)=1$。" + answer: "$y=\\sin x$" + solution: "特征方程 $r^2+1=0$,$r=\\pm i$,通解 $y=C_1\\cos x+C_2\\sin x$。由 $y(0)=C_1=0$,$y'(0)=C_2=1$,得 $y=\\sin x$。" diff --git a/courses/calc-a2/seed.yaml b/courses/calc-a2/seed.yaml new file mode 100644 index 0000000..dca36e7 --- /dev/null +++ b/courses/calc-a2/seed.yaml @@ -0,0 +1,339 @@ +# 微积分A2 内置课程种子数据 +# 来源:Desktop\study-loop内置课程\微积分A2(清华 2026 春,电子教案 + 期末样卷) +# KC 骨架按电子教案章节提炼;题目为锚点真题(期末样卷 + synthetic),供 Agent 参考出题风格。 +# 预置课程不提供完整题库——刷题时已有题直接用,凑不够由主 Agent 现场三卡生成。 +course_id: calc-a2 +name: 微积分A2 +exam_date: 2026-06-20 # 占位,load 时可用 --exam-date 覆盖 + +sources: + - {source_id: slide_2_1_1, source_type: lecture_slide, file: 微积分A2/1-1n维欧式空间与向量值函数.pdf} + - {source_id: slide_2_1_2, source_type: lecture_slide, file: 微积分A2/1-2多元函数的极限与连续.pdf} + - {source_id: slide_2_1_3, source_type: lecture_slide, file: 微积分A2/1-3多元函数的偏导、全微分与方向导数.pdf} + - {source_id: slide_2_1_4, source_type: lecture_slide, file: 微积分A2/1-4映射的微分.pdf} + - {source_id: slide_2_1_5, source_type: lecture_slide, file: 微积分A2/1-5多元Taylor公式.pdf} + - {source_id: slide_2_1_6, source_type: lecture_slide, file: 微积分A2/1-6无条件极值.pdf} + - {source_id: slide_2_1_7, source_type: lecture_slide, file: 微积分A2/1-7隐函数定理与逆映射定理.pdf} + - {source_id: slide_2_1_8, source_type: lecture_slide, file: 微积分A2/1-8空间曲面和曲线.pdf} + - {source_id: slide_2_1_9, source_type: lecture_slide, file: 微积分A2/1-9条件极值.pdf} + - {source_id: slide_2_2_1, source_type: lecture_slide, file: 微积分A2/2-1含参定积分的性质.pdf} + - {source_id: slide_2_2_2, source_type: lecture_slide, file: 微积分A2/2-2含参广义积分的一致收敛性.pdf} + - {source_id: slide_2_2_3, source_type: lecture_slide, file: 微积分A2/2-3含参广义积分的性质.pdf} + - {source_id: slide_2_3_1, source_type: lecture_slide, file: 微积分A2/3-1二重积分的定义与性质.pdf} + - {source_id: slide_2_3_2, source_type: lecture_slide, file: 微积分A2/3-2直角坐标与极坐标系下二重积分的计算.pdf} + - {source_id: slide_2_3_3, source_type: lecture_slide, file: 微积分A2/3-3二重积分的变量替换.pdf} + - {source_id: slide_2_3_4, source_type: lecture_slide, file: 微积分A2/3-4三重积分.pdf} + - {source_id: slide_2_3_5, source_type: lecture_slide, file: 微积分A2/3-5重积分的应用.pdf} + - {source_id: slide_2_4_1, source_type: lecture_slide, file: 微积分A2/4-1第一型曲面积分.pdf} + - {source_id: slide_2_4_2, source_type: lecture_slide, file: 微积分A2/4-2第二型曲面积分.pdf} + - {source_id: slide_2_4_3, source_type: lecture_slide, file: 微积分A2/4-3第一、二型曲线积分.pdf} + - {source_id: slide_2_4_4, source_type: lecture_slide, file: 微积分A2/4-4Green公式及其应用.pdf} + - {source_id: slide_2_4_5, source_type: lecture_slide, file: 微积分A2/4-5Gauss公式和Stokes公式.pdf} + - {source_id: slide_2_5_1, source_type: lecture_slide, file: 微积分A2/5-1-非负项级数.pdf} + - {source_id: slide_2_5_2, source_type: lecture_slide, file: 微积分A2/5-2任意项级数.pdf} + - {source_id: slide_2_5_3, source_type: lecture_slide, file: 微积分A2/5-3无穷乘积.pdf} + - {source_id: slide_2_6_1, source_type: lecture_slide, file: 微积分A2/6-1函数项级数的逐点收敛与一致收敛.pdf} + - {source_id: slide_2_6_2, source_type: lecture_slide, file: 微积分A2/6-2一致收敛函数项级数和函数的性质.pdf} + - {source_id: slide_2_6_3, source_type: lecture_slide, file: 微积分A2/6-3幂级数.pdf} + - {source_id: slide_2_7_1, source_type: lecture_slide, file: 微积分A2/7-1Fourier级数与Bessel不等式.pdf} + - {source_id: slide_2_7_2, source_type: lecture_slide, file: 微积分A2/7-2Fourier级数的收敛性.pdf} + - {source_id: exam_a2_sample, source_type: past_exam, file: 微积分A2/期末考试样卷及解答.pdf} + +kcs: + # 第 1 章 多元函数微分学 + - {kc_id: calc_a2_1_1, name: n 维欧氏空间与向量值函数, chapter_id: ch1, exam_weight: 0.65, source_ids: [slide_2_1_1]} + - {kc_id: calc_a2_1_2, name: 多元函数的极限与连续, chapter_id: ch1, exam_weight: 0.72, prerequisites: [calc_a2_1_1], source_ids: [slide_2_1_2]} + - {kc_id: calc_a2_1_3, name: 偏导数、全微分与方向导数, chapter_id: ch1, exam_weight: 0.82, prerequisites: [calc_a2_1_2], source_ids: [slide_2_1_3]} + - {kc_id: calc_a2_1_4, name: 映射的微分, chapter_id: ch1, exam_weight: 0.70, prerequisites: [calc_a2_1_3], source_ids: [slide_2_1_4]} + - {kc_id: calc_a2_1_5, name: 多元 Taylor 公式, chapter_id: ch1, exam_weight: 0.80, prerequisites: [calc_a2_1_3], source_ids: [slide_2_1_5]} + - {kc_id: calc_a2_1_6, name: 无条件极值, chapter_id: ch1, exam_weight: 0.85, prerequisites: [calc_a2_1_5], source_ids: [slide_2_1_6]} + - {kc_id: calc_a2_1_7, name: 隐函数定理与逆映射定理, chapter_id: ch1, exam_weight: 0.82, prerequisites: [calc_a2_1_4], source_ids: [slide_2_1_7]} + - {kc_id: calc_a2_1_8, name: 空间曲面和曲线, chapter_id: ch1, exam_weight: 0.70, prerequisites: [calc_a2_1_1], source_ids: [slide_2_1_8]} + - {kc_id: calc_a2_1_9, name: 条件极值, chapter_id: ch1, exam_weight: 0.85, prerequisites: [calc_a2_1_6, calc_a2_1_7], source_ids: [slide_2_1_9]} + # 第 2 章 含参积分 + - {kc_id: calc_a2_2_1, name: 含参定积分的性质, chapter_id: ch2, exam_weight: 0.70, source_ids: [slide_2_2_1]} + - {kc_id: calc_a2_2_2, name: 含参广义积分的一致收敛性, chapter_id: ch2, exam_weight: 0.72, prerequisites: [calc_a2_2_1], source_ids: [slide_2_2_2]} + - {kc_id: calc_a2_2_3, name: 含参广义积分的性质, chapter_id: ch2, exam_weight: 0.70, prerequisites: [calc_a2_2_2], source_ids: [slide_2_2_3]} + # 第 3 章 重积分 + - {kc_id: calc_a2_3_1, name: 二重积分的定义与性质, chapter_id: ch3, exam_weight: 0.78, source_ids: [slide_2_3_1]} + - {kc_id: calc_a2_3_2, name: 二重积分的计算(直角/极坐标), chapter_id: ch3, exam_weight: 0.90, prerequisites: [calc_a2_3_1], source_ids: [slide_2_3_2]} + - {kc_id: calc_a2_3_3, name: 二重积分的变量替换, chapter_id: ch3, exam_weight: 0.82, prerequisites: [calc_a2_3_2], source_ids: [slide_2_3_3]} + - {kc_id: calc_a2_3_4, name: 三重积分, chapter_id: ch3, exam_weight: 0.88, prerequisites: [calc_a2_3_2], source_ids: [slide_2_3_4]} + - {kc_id: calc_a2_3_5, name: 重积分的应用, chapter_id: ch3, exam_weight: 0.80, prerequisites: [calc_a2_3_4], source_ids: [slide_2_3_5]} + # 第 4 章 曲线曲面积分 + - {kc_id: calc_a2_4_1, name: 第一型曲面积分, chapter_id: ch4, exam_weight: 0.78, source_ids: [slide_2_4_1]} + - {kc_id: calc_a2_4_2, name: 第二型曲面积分, chapter_id: ch4, exam_weight: 0.85, prerequisites: [calc_a2_4_1], source_ids: [slide_2_4_2]} + - {kc_id: calc_a2_4_3, name: 第一、二型曲线积分, chapter_id: ch4, exam_weight: 0.80, source_ids: [slide_2_4_3]} + - {kc_id: calc_a2_4_4, name: Green 公式及其应用, chapter_id: ch4, exam_weight: 0.90, prerequisites: [calc_a2_4_3], source_ids: [slide_2_4_4]} + - {kc_id: calc_a2_4_5, name: Gauss 公式和 Stokes 公式, chapter_id: ch4, exam_weight: 0.92, prerequisites: [calc_a2_4_2, calc_a2_4_4], source_ids: [slide_2_4_5]} + # 第 5 章 数项级数 + - {kc_id: calc_a2_5_1, name: 非负项级数, chapter_id: ch5, exam_weight: 0.82, source_ids: [slide_2_5_1]} + - {kc_id: calc_a2_5_2, name: 任意项级数, chapter_id: ch5, exam_weight: 0.80, prerequisites: [calc_a2_5_1], source_ids: [slide_2_5_2]} + - {kc_id: calc_a2_5_3, name: 无穷乘积, chapter_id: ch5, exam_weight: 0.60, prerequisites: [calc_a2_5_2], source_ids: [slide_2_5_3]} + # 第 6 章 函数项级数 + - {kc_id: calc_a2_6_1, name: 函数项级数的逐点与一致收敛, chapter_id: ch6, exam_weight: 0.75, prerequisites: [calc_a2_5_2], source_ids: [slide_2_6_1]} + - {kc_id: calc_a2_6_2, name: 一致收敛和函数的性质, chapter_id: ch6, exam_weight: 0.78, prerequisites: [calc_a2_6_1], source_ids: [slide_2_6_2]} + - {kc_id: calc_a2_6_3, name: 幂级数, chapter_id: ch6, exam_weight: 0.88, prerequisites: [calc_a2_6_2], source_ids: [slide_2_6_3]} + # 第 7 章 Fourier 级数 + - {kc_id: calc_a2_7_1, name: Fourier 级数与 Bessel 不等式, chapter_id: ch7, exam_weight: 0.80, prerequisites: [calc_a2_6_2], source_ids: [slide_2_7_1]} + - {kc_id: calc_a2_7_2, name: Fourier 级数的收敛性, chapter_id: ch7, exam_weight: 0.78, prerequisites: [calc_a2_7_1], source_ids: [slide_2_7_2]} + +questions: + # 真题(来源:2026 微积分A2 期末考试样卷及解答;source_type=past_exam,原题优先入库) + # 填空题答案由独立计算复核、并与样卷解答交叉确认。 + - question_id: a2_real_q1_rot + kc_ids: [calc_a2_4_5] + source_type: past_exam + transfer_level: T0 + difficulty: 0.55 + estimated_minutes: 4 + stem: | + 设 $\mathbf{F}(x,y,z)=(\mathrm{e}^{x+y+z},1,1)$,$P_0=(0,0,0)$,则 $\mathrm{rot}\,\mathbf{F}(P_0)=$ ____。 + answer: "(0, 1, -1)" + solution: | + $\mathrm{rot}\mathbf{F}=\nabla\times\mathbf{F}=(\partial_y R-\partial_z Q,\ \partial_z P-\partial_x R,\ \partial_x Q-\partial_y P)=(0,\ \mathrm{e}^{x+y+z},\ -\mathrm{e}^{x+y+z})$;$P_0$ 处 $\mathrm{e}^0=1$,故 $(0,1,-1)$。 + - question_id: a2_real_q2_fourier_sum + kc_ids: [calc_a2_7_2] + source_type: past_exam + transfer_level: T0 + difficulty: 0.55 + estimated_minutes: 4 + stem: | + 设 $2\pi$ 周期函数 $f(x)=\begin{cases}x, & x\in(0,\pi];\\ 0, & x\in(-\pi,0]\end{cases}$ 的形式 Fourier 级数和函数为 $S(x)$,则 $S(\pi)=$ ____。 + answer: "π/2" + solution: | + $\pi$ 为 $f$ 的间断点,Fourier 级数收敛于左右极限均值:$f(\pi^-)=\pi$,$f(\pi^+)$(由周期性对应 $-\pi^+\in(-\pi,0]$)$=0$,故 $S(\pi)=\dfrac{\pi+0}{2}=\dfrac{\pi}{2}$。 + - question_id: a2_real_q3_path_indep + kc_ids: [calc_a2_4_4] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + $a$ 为常数,且 $\forall A,B\in\mathbf{R}^3$,积分 $\int_{L(A)}^{(B)}(x^2+ayz)\,\mathrm{d}x+(y^2+2zx)\,\mathrm{d}y+(z^2+2xy)\,\mathrm{d}z$ 与路径无关,求 $a$。 + answer: "a = 2" + solution: | + 与路径无关 $\Leftrightarrow$ 形式恰当。由 $\partial_y P=az=\partial_x Q=2z$ 得 $a=2$(另两组 $\partial_z Q=\partial_y R$、$\partial_x R=\partial_z P$ 自动成立)。 + - question_id: a2_real_q4_exact_ode + kc_ids: [calc_a2_1_3] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + 求微分方程 $(y\cos x+\cos y)\,\mathrm{d}x+(\sin x-x\sin y)\,\mathrm{d}y=0$ 的通解。 + answer: "y sin x + x cos y = C" + solution: | + $\partial_y P=\cos x-\sin y=\partial_x Q$,方程恰当。令 $\partial_x F=P$ 得 $F=y\sin x+x\cos y+g(y)$,代入 $\partial_y F=Q$ 得 $g'(y)=0$,通解 $y\sin x+x\cos y=C$。 + - question_id: a2_real_q5_taylor2 + kc_ids: [calc_a2_1_5] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + 写出 $\dfrac{1}{x+y}$ 在点 $(1,0)$ 处带 Peano 余项的二阶 Taylor 展开式。 + answer: "1 - (x-1) - y + (x-1)^2 + 2(x-1)y + y^2" + solution: | + 令 $u=x-1,\ v=y$,$\dfrac{1}{1+(u+v)}=1-(u+v)+(u+v)^2+o(\rho^2)=1-u-v+u^2+2uv+v^2+o(\rho^2)$,即 $1-(x-1)-y+(x-1)^2+2(x-1)y+y^2$。 + - question_id: a2_real_q6_implicit_stat + kc_ids: [calc_a2_1_7] + source_type: past_exam + transfer_level: T0 + difficulty: 0.65 + estimated_minutes: 6 + stem: | + $z=z(x,y)$ 由方程 $x^2+2y^2+3z^2-2xy-z-7=0$ 确定,求其驻点 $(x_0,y_0)$。 + answer: "(0, 0)" + solution: | + $z_x=-\dfrac{2x-2y}{6z-1}$,$z_y=-\dfrac{4y-2x}{6z-1}$;令其为零得 $x=y$ 与 $x=2y$,联立 $x=y=0$,驻点 $(0,0)$。 + - question_id: a2_real_q7_series_conv + kc_ids: [calc_a2_5_2] + source_type: past_exam + transfer_level: T0 + difficulty: 0.50 + estimated_minutes: 4 + stem: | + 判断级数 $\displaystyle\sum_{n=2}^{\infty}\dfrac{(-1)^n}{2^n+\ln n}$ 的收敛性(绝对收敛 / 条件收敛 / 发散)。 + answer: "绝对收敛" + solution: | + $\left|\dfrac{(-1)^n}{2^n+\ln n}\right|=\dfrac{1}{2^n+\ln n}\le\dfrac{1}{2^n}$,而 $\sum\dfrac{1}{2^n}$ 收敛,故绝对收敛。 + - question_id: a2_real_q8_power_sum + kc_ids: [calc_a2_6_3] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + 求幂级数 $\displaystyle\sum_{n=1}^{\infty}\dfrac{(-1)^n}{2n}x^{2n}$ 在 $(-1,1)$ 内的和函数。 + answer: "-(1/2) ln(1 + x^2)" + solution: | + 原式 $=\dfrac12\sum_{n=1}^{\infty}\dfrac{(-1)^n (x^2)^n}{n}$;由 $-\ln(1+t)=\sum_{n=1}^\infty\dfrac{(-1)^n t^n}{n}$ 令 $t=x^2$,得和函数 $=-\dfrac12\ln(1+x^2)$。 + - question_id: a2_real_q9_fourier_bn + kc_ids: [calc_a2_7_1] + source_type: past_exam + transfer_level: T0 + difficulty: 0.65 + estimated_minutes: 6 + stem: | + 设 $2\pi$ 周期函数 $f(x)=\begin{cases}x+1, & x\in(0,\pi];\\ 1, & x\in(-\pi,0]\end{cases}$ 的 Fourier 级数为 $\dfrac{a_0}{2}+\sum_{n=1}^{\infty}(a_n\cos nx+b_n\sin nx)$,求 $b_n$。 + answer: "b_n = (-1)^(n+1) / n" + solution: | + $b_n=\dfrac1\pi\!\left[\int_{-\pi}^0\sin nx\,\mathrm{d}x+\int_0^\pi(x+1)\sin nx\,\mathrm{d}x\right]$;含 $1$ 的两项相消,余 $\dfrac1\pi\!\left[-\dfrac{\pi(-1)^n}{n}\right]=\dfrac{(-1)^{n+1}}{n}$。 + - question_id: a2_real_q10_line_int + kc_ids: [calc_a2_4_3] + source_type: past_exam + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 5 + stem: | + $L$ 为椭圆 $\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}=1$($a,b>0$)的上半周,$A=(-a,0),\ B=(a,0)$,求 $\int_{L(A)}^{(B)}(x+y)\,\mathrm{d}x+(x-y)\,\mathrm{d}y$。 + answer: "0" + solution: | + $\partial_y(x+y)=1=\partial_x(x-y)$,与路径无关。势函数 $F=\dfrac{x^2}{2}+xy-\dfrac{y^2}{2}$,积分 $=F(a,0)-F(-a,0)=\dfrac{a^2}{2}-\dfrac{a^2}{2}=0$。 + - question_id: a2_real_q11_double_int + kc_ids: [calc_a2_3_2] + source_type: past_exam + transfer_level: T0 + difficulty: 0.70 + estimated_minutes: 10 + stem: | + 设 $D=\{(x,y)\mid x^2+4y^2\le 1\}$,求 $\displaystyle\iint_D (x^2+y^2)\,\mathrm{d}x\mathrm{d}y$。 + answer: "5π/32" + solution: | + 广义极坐标 $x=\rho\cos\varphi,\ y=\dfrac12\rho\sin\varphi$,$|J|=\dfrac{\rho}{2}$,$\rho\in[0,1]$。原式 $=\int_0^{2\pi}\!\!\int_0^1\rho^2(\cos^2\varphi+\tfrac14\sin^2\varphi)\dfrac{\rho}{2}\,\mathrm{d}\rho\mathrm{d}\varphi=\dfrac18\cdot\dfrac{5\pi}{4}=\dfrac{5\pi}{32}$。 + - question_id: a2_real_q12_exact_diff + kc_ids: [calc_a2_4_4] + source_type: past_exam + transfer_level: T0 + difficulty: 0.70 + estimated_minutes: 10 + stem: | + 已知 $(axy^3-y^2\cos x)\,\mathrm{d}x+(1+by\sin x+3x^2y^2)\,\mathrm{d}y$ 为某 $f(x,y)$ 的全微分,求 $a,b$ 及 $f(x,y)$。 + answer: "a=2, b=-2; f(x,y) = x^2 y^3 - y^2 sin x + y + C" + solution: | + 由 $\partial_{xy}f=\partial_{yx}f$:$3axy^2-2y\cos x=by\cos x+6xy^2$,比较得 $3a=6\Rightarrow a=2$、$-2=b\Rightarrow b=-2$;积分 $\partial_x f=2xy^3-y^2\cos x$ 得 $f=x^2y^3-y^2\sin x+g(y)$,由 $\partial_y f$ 定 $g(y)=y+C$。 + - question_id: a2_real_q13_surface_int + kc_ids: [calc_a2_4_5] + source_type: past_exam + transfer_level: T0 + difficulty: 0.80 + estimated_minutes: 14 + stem: | + $S^+$ 为抛物面 $z=1-x^2-y^2$($z\ge 0$)上侧,求 $\displaystyle\iint_{S^+} x^3\,\mathrm{d}y\wedge\mathrm{d}z+y^3\,\mathrm{d}z\wedge\mathrm{d}x+(x^2+y^2)\,\mathrm{d}x\wedge\mathrm{d}y$。 + answer: "π" + solution: | + 补底面 $D:z=0,\ x^2+y^2\le1$(下侧)封闭用 Gauss,$\nabla\cdot\mathbf{F}=3x^2+3y^2$。$\iiint 3(x^2+y^2)\mathrm{d}V=3\int_0^{2\pi}\!\!\int_0^1\!\!\int_0^{1-r^2}r^3\,\mathrm{d}z\mathrm{d}r\mathrm{d}\varphi=\dfrac\pi2$;底面通量 $=-\iint_D(x^2+y^2)\mathrm{d}x\mathrm{d}y=-\dfrac\pi2$,故 $S^+$ 上积分 $=\dfrac\pi2-(-\dfrac\pi2)=\pi$。 + # synthetic 练习题,覆盖真题未涉及的核心章节;validation 由出题 Agent 担任 generator→盲解 solver→对抗 reviewer。 + - question_id: a2_q_grad + kc_ids: [calc_a2_1_3] + source_type: synthetic + transfer_level: T0 + difficulty: 0.4 + estimated_minutes: 4 + derived_from: ["kc:calc_a2_1_3"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "设 $f(x,y)=x^2+xy+y^2$,求 $\\nabla f(1,1)$。" + answer: "$(3,\\,3)$" + solution: "$\\dfrac{\\partial f}{\\partial x}=2x+y$,$\\dfrac{\\partial f}{\\partial y}=x+2y$,在 $(1,1)$ 处均为 $3$,故 $\\nabla f(1,1)=(3,3)$。" + - question_id: a2_q_extreme + kc_ids: [calc_a2_1_6] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 5 + derived_from: ["kc:calc_a2_1_6"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求 $f(x,y)=x^2+y^2-2x-4y+5$ 的极小值。" + answer: "$0$(在 $(1,2)$ 处取到)" + solution: "配平方 $f=(x-1)^2+(y-2)^2\\ge 0$,等号在 $(1,2)$ 成立,$\\nabla f=(2(x-1),\\,2(y-2))=0$ 验证 $(1,2)$ 为极小点,极小值 $0$。" + - question_id: a2_q_double_int + kc_ids: [calc_a2_3_2] + source_type: synthetic + transfer_level: T0 + difficulty: 0.4 + estimated_minutes: 4 + derived_from: ["kc:calc_a2_3_2"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "计算 $\\displaystyle\\iint_{[0,1]\\times[0,1]} xy\\,dx\\,dy$。" + answer: "$\\dfrac{1}{4}$" + solution: "变量可分离:$\\Big(\\int_0^1 x\\,dx\\Big)\\Big(\\int_0^1 y\\,dy\\Big)=\\dfrac12\\cdot\\dfrac12=\\dfrac14$。" + - question_id: a2_q_geom_series + kc_ids: [calc_a2_5_1] + source_type: synthetic + transfer_level: T0 + difficulty: 0.35 + estimated_minutes: 3 + derived_from: ["kc:calc_a2_5_1"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求等比级数 $\\displaystyle\\sum_{n=0}^{\\infty}\\Big(\\dfrac12\\Big)^n$ 的和。" + answer: "$2$" + solution: "公比 $r=\\dfrac12$,$|r|<1$,和 $S=\\dfrac{1}{1-r}=\\dfrac{1}{1/2}=2$。" + - question_id: a2_q_power_radius + kc_ids: [calc_a2_6_3] + source_type: synthetic + transfer_level: T0 + difficulty: 0.45 + estimated_minutes: 4 + derived_from: ["kc:calc_a2_6_3"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求幂级数 $\\displaystyle\\sum_{n=0}^{\\infty} x^n$ 的收敛半径。" + answer: "$R=1$" + solution: "$a_n=1$,$R=\\lim_{n\\to\\infty}\\dfrac{1}{\\sqrt[n]{|a_n|}}=\\lim_{n\\to\\infty}1=1$(或比值法 $|x|<1$ 收敛)。" + - question_id: a2_q_alt_series + kc_ids: [calc_a2_5_2] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 5 + derived_from: ["kc:calc_a2_5_2"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "判断交错级数 $\\displaystyle\\sum_{n=1}^{\\infty}\\dfrac{(-1)^n}{n}$ 的收敛性(绝对收敛 / 条件收敛 / 发散)。" + answer: "条件收敛" + solution: "$\\dfrac{1}{n}\\downarrow 0$,由莱布尼茨判别法级数收敛;但 $\\sum\\dfrac{1}{n}$ 发散,故非绝对收敛,为条件收敛。" + - question_id: a2_q_ball_vol + kc_ids: [calc_a2_3_4] + source_type: synthetic + transfer_level: T0 + difficulty: 0.5 + estimated_minutes: 5 + derived_from: ["kc:calc_a2_3_4"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "用三重积分求半径为 $1$ 的球体体积。" + answer: "$\\dfrac{4\\pi}{3}$" + solution: "球坐标 $\\iiint_B dV=\\int_0^{2\\pi}\\!\\int_0^{\\pi}\\!\\int_0^1 \\rho^2\\sin\\varphi\\,d\\rho\\,d\\varphi\\,d\\theta=2\\pi\\cdot 2\\cdot\\dfrac13=\\dfrac{4\\pi}{3}$。" + - question_id: a2_q_fourier_x + kc_ids: [calc_a2_7_1] + source_type: synthetic + transfer_level: T0 + difficulty: 0.55 + estimated_minutes: 6 + derived_from: ["kc:calc_a2_7_1"] + validation: + generator: {status: passed} + independent_solver: {status: passed, answer_match: true} + adversarial_review: {status: passed, issues: []} + stem: "求 $f(x)=x$($x\\in(-\\pi,\\pi)$,周期延拓)的 Fourier 正弦系数 $b_n$。" + answer: "$b_n=\\dfrac{2(-1)^{n+1}}{n}$" + solution: "$f$ 为奇函数,$b_n=\\dfrac{1}{\\pi}\\int_{-\\pi}^{\\pi}x\\sin(nx)\\,dx=\\dfrac{2}{\\pi}\\int_0^{\\pi}x\\sin(nx)\\,dx=\\dfrac{2}{\\pi}\\Big[-\\dfrac{x\\cos nx}{n}\\Big]_0^{\\pi}=\\dfrac{2(-1)^{n+1}}{n}$。" diff --git a/courses/linalg/seed.yaml b/courses/linalg/seed.yaml new file mode 100644 index 0000000..3c2faa9 --- /dev/null +++ b/courses/linalg/seed.yaml @@ -0,0 +1,190 @@ +# 线性代数 内置课程种子数据 +# 来源:Desktop\study-loop内置课程\线性代数(清华 2025 秋,lecture01-28 + 期末复习 + 习题课) +# lecture01-28 无章节标题,KC 骨架按清华线性代数标准教学结构 + 期末复习 PDF 提炼。 +# 题目为锚点真题(《习题1》 + synthetic),供 Agent 参考出题风格。 +# 预置课程不提供完整题库——刷题时已有题直接用,凑不够由主 Agent 现场三卡生成。 +course_id: linalg +name: 线性代数 +exam_date: 2026-01-10 # 占位,load 时可用 --exam-date 覆盖 + +sources: + - {source_id: review_vec, source_type: course_note, file: 线性代数/2025-2026秋期末复习-向量空间Rn.pdf} + - {source_id: review_inner, source_type: course_note, file: 线性代数/2025-2026秋期末复习-欧式空间Rn.pdf} + - {source_id: review_eigen, source_type: course_note, file: 线性代数/2025-2026秋期末复习-特征值特征向量.pdf} + - {source_id: review_space, source_type: course_note, file: 线性代数/2025-2026秋期末复习-线性空间和线性变换.pdf} + - {source_id: review_quad, source_type: course_note, file: 线性代数/2025-2026秋期末复习-二次型.pdf} + - {source_id: exercises, source_type: homework, file: 线性代数/习题1-3与习题课4-7(含答案版)} + - {source_id: lectures, source_type: lecture_slide, file: 线性代数/lecture01-28.pdf} + +kcs: + # 按标准线性代数教学结构(行列式 → 矩阵 → 向量 → 秩 → 方程组 → 特征值 → 二次型;线性空间/变换/欧氏空间) + - {kc_id: linalg_det, name: 行列式, chapter_id: ch1, exam_weight: 0.70, source_ids: [lectures]} + - {kc_id: linalg_matrix, name: 矩阵与运算(逆、转置), chapter_id: ch2, exam_weight: 0.78, prerequisites: [linalg_det], source_ids: [lectures]} + - {kc_id: linalg_vec, name: 向量与向量组(线性相关), chapter_id: ch3, exam_weight: 0.80, prerequisites: [linalg_matrix], source_ids: [review_vec]} + - {kc_id: linalg_rank, name: 矩阵的秩, chapter_id: ch4, exam_weight: 0.82, prerequisites: [linalg_vec], source_ids: [review_vec]} + - {kc_id: linalg_linsys, name: 线性方程组, chapter_id: ch5, exam_weight: 0.90, prerequisites: [linalg_rank], source_ids: [lectures]} + - {kc_id: linalg_eigen, name: 特征值与特征向量, chapter_id: ch6, exam_weight: 0.92, prerequisites: [linalg_matrix, linalg_linsys], source_ids: [review_eigen]} + - {kc_id: linalg_quad, name: 二次型, chapter_id: ch7, exam_weight: 0.88, prerequisites: [linalg_eigen], source_ids: [review_quad]} + - {kc_id: linalg_space, name: 线性空间, chapter_id: ch8, exam_weight: 0.78, source_ids: [review_space]} + - {kc_id: linalg_trans, name: 线性变换, chapter_id: ch9, exam_weight: 0.85, prerequisites: [linalg_space, linalg_eigen], source_ids: [review_space]} + - {kc_id: linalg_inner, name: 欧氏空间(内积与正交), chapter_id: ch10, exam_weight: 0.80, prerequisites: [linalg_space], source_ids: [review_inner]} + +questions: + # 真题/习题(来源:清华2025秋线性代数《习题1(题目版)》;source_type=homework,原题优先入库;答案独立计算复核) + - question_id: la_real_q1_det_lambda + kc_ids: [linalg_det, linalg_eigen] + source_type: homework + transfer_level: T0 + difficulty: 0.60 + estimated_minutes: 6 + stem: | + 已知 $\begin{vmatrix}\lambda+1 & 2 & 2\\ -2 & \lambda+4 & -5\\ 2 & -2 & \lambda+1\end{vmatrix}=0$,求 $\lambda$ 的所有值。 + answer: "λ = 2, -3, -5" + solution: | + 展开得 $\lambda^3+6\lambda^2-\lambda-30=(\lambda-2)(\lambda+3)(\lambda+5)=0$,故 $\lambda=2,\,-3,\,-5$。 + - question_id: la_real_q2_det3 + kc_ids: [linalg_det] + source_type: homework + transfer_level: T0 + difficulty: 0.40 + estimated_minutes: 4 + stem: | + 计算 $\begin{vmatrix}-2 & 1 & -3\\ 98 & 101 & 97\\ 1 & -3 & 4\end{vmatrix}$。 + answer: "-500" + solution: | + 按第一行展开:$-2(101\cdot4-97(-3))-(98\cdot4-97\cdot1)-3(98(-3)-101\cdot1)=-2\cdot695-295+1185=-500$。 + - question_id: la_real_q3_det_cyclic + kc_ids: [linalg_det] + source_type: homework + transfer_level: T0 + difficulty: 0.65 + estimated_minutes: 8 + stem: | + 计算 $n$ 阶行列式 $|A|$,其中 $A$ 的第 $i$ 行第 $i+1$ 列为 $a_i$($i=1,\ldots,n-1$)、第 $n$ 行第 $1$ 列为 $a_n$,其余为 $0$;再计算反对角线上依次为 $a_1,\ldots,a_n$(其余为 $0$)的 $n$ 阶行列式 $|B|$。 + answer: "|A|=(-1)^{n-1}a_1⋯a_n;|B|=(-1)^{n(n-1)/2}a_1⋯a_n" + solution: | + $A$ 按第 1 列展开,唯一非零元 $a_n$ 在 $(n,1)$,余子式为上三角 $\prod_{i=1}^{n-1}a_i$,故 $|A|=(-1)^{n+1}\prod a_i=(-1)^{n-1}\prod a_i$;$B$ 对应反序排列 $i\mapsto n+1-i$,逆序数 $\binom n2=\tfrac{n(n-1)}2$,故 $|B|=(-1)^{n(n-1)/2}\prod a_i$。 + - question_id: la_real_q4_linsys_lambda + kc_ids: [linalg_linsys, linalg_rank] + source_type: homework + transfer_level: T0 + difficulty: 0.75 + estimated_minutes: 12 + stem: | + 讨论 $\lambda$ 取不同值时线性方程组 $\begin{cases}x_1+2x_2+x_3=1\\ 2x_1+3x_2+(\lambda+2)x_3=3\\ x_1+\lambda x_2-2x_3=0\end{cases}$ 解的情况(唯一解/无穷多解/无解)。 + answer: "λ≠3,-1 唯一解;λ=3 无穷多解;λ=-1 无解" + solution: | + 系数行列式 $|A|=-(\lambda-3)(\lambda+1)$。$\lambda\ne\pm$ 时 $|A|\ne0\Rightarrow$ 唯一解;$\lambda=3$ 时 $r(A)=r(A|b)=2<3\Rightarrow$ 无穷多解;$\lambda=-1$ 时增广阵出现 $0=4$ 矛盾行,$r(A)=2/seed.yaml)灌入一个工作区,开箱即学。 + +内置课程只含骨架事件(来源 / 知识点 / 题目),不含任何个人学习记录; +灌入后状态全部由事件派生,完全遵守「events.jsonl 是唯一真相源」的铁律。 + +用法: + python scripts/load_course.py --list + python scripts/load_course.py <工作区目录> --course-id calc-a1 [--exam-date 2026-01-10] +""" +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) + +import typer +import yaml + +from studylib import derive as derive_mod +from studylib.cli_common import guard +from studylib.course import init_course +from studylib.events import append_event, new_event +from studylib.ioutils import course_lock +from studylib.validation import register_question + +app = typer.Typer(add_completion=False) +COURSES_DIR = Path(__file__).resolve().parent.parent / "courses" + + +def _read_seed(course_id: str) -> dict: + seed_path = COURSES_DIR / course_id / "seed.yaml" + if not seed_path.exists(): + raise SystemExit( + f"找不到内置课程 {course_id!r}(缺 {seed_path})。用 --list 查看可选课程。" + ) + return yaml.safe_load(seed_path.read_text(encoding="utf-8")) + + +@app.command() +@guard +def main( + path: Path = typer.Argument(None, help="课程工作区目录(将在此新建)"), + course_id: str = typer.Option(None, "--course-id", help="内置课程 ID,如 calc-a1"), + exam_date: str = typer.Option(None, "--exam-date", help="覆盖 seed 中的 exam_date"), + list_only: bool = typer.Option(False, "--list", help="列出所有内置课程"), +): + if list_only: + for d in sorted(COURSES_DIR.glob("*/seed.yaml")): + s = yaml.safe_load(d.read_text(encoding="utf-8")) + typer.echo( + f"{s['course_id']}\t{s['name']}\t" + f"KC {len(s.get('kcs') or [])}\t题 {len(s.get('questions') or [])}" + ) + return + if not path or not course_id: + raise SystemExit("用法:load_course.py <目录> --course-id (或加 --list 查看可选)") + + seed = _read_seed(course_id) + cid = seed["course_id"] + raw_date = exam_date or seed.get("exam_date") + # YAML 可能把 2026-01-10 隐式解析成 datetime.date,写进事件时 JSON 序列化会失败,统一转字符串 + exam_date_str = str(raw_date) if raw_date else None + root = init_course(path, cid, seed["name"], exam_date_str) + + events = [] + for s in seed.get("sources") or []: + events.append(new_event(cid, "source_registered", s)) + for k in seed.get("kcs") or []: + events.append(new_event(cid, "kc_created", k)) + + with course_lock(root): + for ev in events: + append_event(root, ev) + for q in seed.get("questions") or []: + register_question(root, q) + derive_mod.derive(root) + + typer.echo(f"内置课程已加载:{seed['name']} → {root}") + typer.echo( + f" 来源 {len(seed.get('sources') or [])} 个 · " + f"KC {len(seed.get('kcs') or [])} 个 · " + f"题目 {len(seed.get('questions') or [])} 道" + ) + + +if __name__ == "__main__": + app()