Skip to content

Commit

Permalink
docs: 开始将答案框架整合进主文档中 (#83)
Browse files Browse the repository at this point in the history
* docs: move `\term` to LALUbook.cls

* docs: answers deprecation warning

* docs: implement writing answer to external file

* docs: new answer framework

* docs: copy history exams to main directory

* CI: test new answer framework

* docs: fix compilation

* docs: answer framework example

* build: remove ans from main Makefile
  • Loading branch information
45gfg9 authored Sep 24, 2024
1 parent 1122301 commit 5d91cfe
Show file tree
Hide file tree
Showing 35 changed files with 1,693 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
with:
name: LALU-build-${{ github.run_number }}-${{ steps.build.outputs.sha }}
if-no-files-found: error
path: ${{ github.workspace }}/gh-actions-build/*.pdf
path: ${{ github.workspace }}/讲义/*.pdf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
build
gh-actions-build
讲义/LALU.tex
讲义/LALU-ans-contents.tex
习题参考答案/LALU-answers.tex

## latexindent.pl backup files
Expand Down
2 changes: 2 additions & 0 deletions LALUbook.cls
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
\NewDocumentEnvironment{proof}{O{}O{}}{\begin{tcblaluthmbox}{{\heiti 证明}}{#1}{#2}\fangsong}{\hspace*{\fill}$\square$\end{tcblaluthmbox}}
\NewDocumentEnvironment{solution}{O{}O{}}{\begin{tcblaluthmbox}{{\heiti 解}}{#1}{#2}\fangsong}{\end{tcblaluthmbox}}

\NewDocumentCommand{\term}{m}{{\sffamily\heiti\bfseries{#1}}}

\DeclareMathOperator{\Ob}{Ob}
\DeclareMathOperator{\Hom}{Hom}
\newcommand{\cC}{\mathcal{C}}
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ export GH_ACTIONS_DIR := gh-actions-build

.PHONY: all gh-actions main ans clean

all: main ans
all: main

gh-actions:
# used by GitHub Actions
mkdir -p $(GH_ACTIONS_DIR)
make -C $(MAIN_DIR) gh-cp
make -C $(ANSWERS_DIR) gh-cp
# mkdir -p $(GH_ACTIONS_DIR)
# make -C $(MAIN_DIR) gh-cp
# make -C $(ANSWERS_DIR) gh-cp
make -C $(MAIN_DIR)

main:
$(MAKE) -C $(MAIN_DIR)
Expand Down
4 changes: 4 additions & 0 deletions 习题参考答案/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 习题参考答案

!!! [Warning]
习题参考答案目前正在和讲义合并。仍然可以在本文件夹下运行 `make` 构建,在答案全部迁移完成后应删除本文件夹。
123 changes: 123 additions & 0 deletions 讲义/LALU-answers.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
\makeatletter
\def\input@path{{..}} % 搜索上层目录的 LALUbook
\makeatother

\documentclass[
% colors = false,
geometry = 16k,
]{LALUbook}

\usepackage{booktabs} % Excel 导出的大表格

\usetikzlibrary{arrows, arrows.meta, calc, intersections, decorations.pathreplacing, patterns, decorations.markings}

\title{\heiti 浙江大学 2023--2024 学年 \\ 线性代数荣誉课辅学习题答案}
\author{2023--2024 学年线性代数 I/II(H)辅学授课 \\ 吴一航 \quad \verb|[email protected]|}

\AtEndPreamble{\hypersetup{
pdfauthor = {吴一航},
pdftitle = {线性代数荣誉课辅学习题答案},
}}

\newcounter{LUsection}

\makeatletter
\newcommand*{\LUgroupsancheck}{%
\expandafter\@ifundefined{@exist@LUsection@\arabic{section}}%
{}
{\endgroup}
}
\let\@std@section\section
\renewcommand*{\section}{%
\LUgroupsancheck%
\@std@section
}
\makeatother

\NewDocumentCommand{\LUsection}{m}{%
\LUgroupsancheck
\begingroup
\addtocounter{section}{-1}
\refstepcounter{LUsection}
\renewcommand*{\thesection}{未竟专题\zhnumber{\arabic{LUsection}}}
\renewcommand*{\theHsection}{LU.\arabic{LUsection}}
\ctexset{
section={format={\centering\Huge\bfseries},name={未竟专题,},number={\zhnumber{\arabic{LUsection}}}},
}
\csname @std@section\endcsname{#1}
\expandafter\xdef\csname @exist@LUsection@\arabic{section}\endcsname{\null}
}

\begin{document}
\frontmatter

\pdfbookmark[0]{目录}{contents}
\tableofcontents

\addtolength{\parskip}{.5em}

\mainmatter

\ctexset{
chapter={format={\centering\Huge\bfseries},name={,},number={}},
section={format={\raggedright\Large\bfseries},name={第,讲},number={\arabic{section}}},
}
\renewcommand*{\thechapter}{}
\renewcommand*{\thesection}{第\arabic{section}讲}

\chapter{《线性代数:未竟之美》习题参考答案}
\titleformat{\subsection}[block]{\centering\heiti\bfseries}{}{1em}{}
\input{LALU-ans-contents.tex}

\LUgroupsancheck

\makeatletter
\let\section\@std@section
\let\@std@section\relax
\makeatother

\ctexset{
section={format={\raggedright\Large\bfseries},name={,},number={}},
}
\renewcommand*{\thesection}{}

% 线代I期中/练习
\chapter{线性代数I(H)期中/小测历年卷试题集}
\input{./历年卷/2020-2021-1extzy1.tex}
\input{./历年卷/2020-2021-1extzy2.tex}
\input{./历年卷/2020-2021-1midwzx.tex}
\input{./历年卷/2021-2022-1exlks.tex}
\input{./历年卷/2021-2022-1midwzx.tex}
\input{./历年卷/2022-2023-1midlks.tex}
\input{./历年卷/2022-2023-1midtzy.tex}
\input{./历年卷/2022-2023-1midwzx.tex}

% 线代I期末
\chapter{线性代数I(H)期末历年卷试题集}
\input{./历年卷/2009-2010-1final.tex}
\input{./历年卷/2010-2011-1final.tex}
\input{./历年卷/2011-2012-1final.tex}
\input{./历年卷/2012-2013-1final.tex}
\input{./历年卷/2013-2014-1final.tex}
\input{./历年卷/2014-2015-1final.tex}
\input{./历年卷/2018-2019-1final.tex}
\input{./历年卷/2019-2020-1final.tex}
\input{./历年卷/2021-2022-1final.tex}
\input{./历年卷/2022-2023-1final.tex}

% 线代II期中/练习
\chapter{线性代数II(H)期中/小测历年卷试题集}
\input{./历年卷/2020-2021-2midlks.tex}
\input{./历年卷/2020-2021-2exlks.tex}
\input{./历年卷/2020-2021-2midtzy.tex}
\input{./历年卷/2022-2023-2midlks.tex}
\input{./历年卷/2022-2023-2midwzx.tex}

% 线代II期末
\chapter{线性代数II(H)期末历年卷试题集}
\input{./历年卷/2022-2023-2finalex.tex}
\input{./历年卷/2022-2023-2final.tex}

\backmatter

\end{document}
5 changes: 5 additions & 0 deletions 讲义/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FILENAME := 线性代数荣誉课辅学讲义
CPNAME := LALU

.PHONY: all-new

all-new: all
$(LATEXMK) $(LATEXMK_FLAGS) LALU-answers.tex

include ../latexmk.mk
74 changes: 74 additions & 0 deletions 讲义/专题/1 预备知识.tex
Original file line number Diff line number Diff line change
Expand Up @@ -397,18 +397,92 @@ \section{高斯消元法}
3x_1+x_2+5x_3+6x_4-7x_5=0
\end{cases}$的通解.

\begin{answer}
\begin{align*}
A ={} &
\begin{pmatrix}
1 & 1 & 1 & 4 & -3 \\
2 & 1 & 3 & 5 & -5 \\
1 & -1 & 3 & -2 & -1 \\
3 & 1 & 5 & 6 & -7
\end{pmatrix}
\rightarrow
\begin{pmatrix}
1 & 1 & 1 & 4 & -3 \\
0 & -1 & 1 & -3 & 1 \\
0 & -2 & 2 & -6 & 2 \\
0 & -2 & 2 & -6 & 2
\end{pmatrix} \rightarrow \\
&
\begin{pmatrix}
1 & 1 & 1 & 4 & -3 \\
0 & 1 & -1 & 3 & -1 \\
0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0
\end{pmatrix}
\rightarrow
\begin{pmatrix}
1 & 0 & 2 & 1 & -2 \\
0 & 1 & -1 & 3 & -1 \\
0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0
\end{pmatrix}.
\end{align*}
$ x_3 = k_1, x_4 = k_2, x_5 = k_3$,有 $x_1 = -2k_1 - k_2 + 2k_3,\enspace\allowbreak x_2 = k_1 - 3k_2 + k_3 $,则
\[ X = (x_1, x_2, x_3, x_4, x_5)^\mathrm{T} = k_1 \begin{pmatrix} -2 \\ 1 \\ 1 \\ 0 \\ 0 \end{pmatrix} + k_2 \begin{pmatrix} -1 \\ -3 \\ 0 \\ 1 \\ 0 \end{pmatrix} + k_3 \begin{pmatrix} 2 \\ 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} \qquad k_1, k_2, k_3 \in \mathbf{R} \]
\end{answer}

\item 求非齐次线性方程组$\begin{cases}
x_1-x_2+2x_3-2x_4+3x_5=1 \\
2x_1-x_2+5x_3-9x_4+8x_5=-1 \\
3x_1-2x_2+7x_3-11x_4+11x_5=0 \\
x_1-x_2+x_3-x_4+3x_5=3
\end{cases}$的通解.

\begin{answer}
\begin{align*}
\bar{A} ={} &
\begin{pmatrix}
1 & -1 & 2 & -2 & 3 & 1 \\
2 & -1 & 5 & -9 & 8 & -1 \\
3 & -2 & 7 & -11 & 11 & 0 \\
1 & -1 & 1 & -1 & 3 & 3
\end{pmatrix}
\rightarrow
\begin{pmatrix}
1 & -1 & 2 & -2 & 3 & 1 \\
0 & 1 & 1 & -5 & 2 & -3 \\
0 & 1 & 1 & -5 & 2 & -3 \\
0 & 0 & -1 & 1 & 0 & 2
\end{pmatrix} \rightarrow \\
&
\begin{pmatrix}
1 & -1 & 2 & -2 & 3 & 1 \\
0 & 1 & 1 & -5 & 2 & -3 \\
0 & 0 & -1 & 1 & 0 & 2 \\
0 & 0 & 0 & 0 & 0 & 0
\end{pmatrix}
\rightarrow
\begin{pmatrix}
1 & 0 & 0 & -4 & 5 & 4 \\
0 & 1 & 0 & -4 & 2 & -1 \\
0 & 0 & 1 & -1 & 0 & -2 \\
0 & 0 & 0 & 0 & 0 & 0
\end{pmatrix}.
\end{align*}
$ x_4 = k_1, x_5 = k_2 $,有 $x_1 = 4k_1 - 5k_2 + 4,\enspace\allowbreak x_2 = 4k_1 - 2k_2 - 1,\enspace\allowbreak x_3 = k_1 -2 $,则
\[ X = (x_1, x_2, x_3, x_4, x_5)^\mathrm{T} = k_1 \begin{pmatrix} 4 \\ 4 \\ 1 \\ 1 \\ 0 \end{pmatrix} + k_2 \begin{pmatrix} -5 \\ -2 \\ 0 \\ 0 \\ 1 \end{pmatrix} + \begin{pmatrix} 4 \\ -1 \\ -2 \\ 0 \\ 0 \end{pmatrix} \qquad k_1, k_2 \in \mathbf{R} \]
\end{answer}

\item 求解线性方程组$\begin{cases}
x_1+x_2+x_3=1 \\
x_1+2x_2-5x_3=2 \\
2x_1+3x_2-4x_3=5
\end{cases}$.

\begin{answer}
见教材P33例3. 无解.
\end{answer}
\end{exgroup}

\begin{exgroup}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ \subsection{走向无穷范畴:为什么我们需要套娃?}
\begin{exercise}
\exquote[——《收获与播种》,格罗滕迪克]{每一门科学,当我们不是将它作为能力和统治力的工具,而是作为我们人类世代以来努力追求的对知识的冒险历程,不是别的,就是这样一种和谐,从一个时期到另一个时期,或多或少,巨大而又丰富:在不同的时代和世纪中,对于依次出现的不同的主题,它展现给我们微妙而精细的对应,仿佛来自虚空。}

\begin{exgroup}* % no numbering
\begin{enumerate} % 若不需要编号,则直接使用 enumerate 环境
\item 证明以下两个态射的性质:
\begin{enumerate}
\item 如果 $A$$B$ 同构,那么 $A$$B$ 之间的同构映射是唯一的;
\item 函子保持态射的单、满性质.
\end{enumerate}
\end{exgroup}
\end{enumerate}
\end{exercise}
63 changes: 63 additions & 0 deletions 讲义/历年卷/2009-2010-1final.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
\phantomsection
\section*{2009-2010学年线性代数I(H)期末}
\addcontentsline{toc}{section}{2009-2010学年线性代数I(H)期末}

\begin{center}
任课老师:统一命卷\hspace{4em} 考试时长:120分钟
\end{center}

\begin{enumerate}
\item [一、](10分)记 $C([0,2\pi],\mathbf{R})$ 是区间 $[0,2\pi]$ 上全体连续函数作成的实线性空间,对 $f,g \in C([0,2\pi],\mathbf{R})$,用
\[(f,g) = \displaystyle\int_0^{2\pi}f(x)g(x)\mathrm{d}x\]
来定义内积. 如果
\[f,g:[0,2\pi] \to \mathbf{R},f(x)=x,g(x)=\sin x\]
$f$$g$ 的夹角 $\theta$.

\item[二、](10分)设 $V$ 是次数 $\leq 2$ 的实多项式线性空间,$T:V\to V$,
\[T(f(x)) = f(x) + xf'(x).\]
$T$ 的特征值. 对于每个特征值,求属于它的特征子空间.

\item[三、](10分)设 $B$$3\times 1$ 矩阵,$C$$1\times 3$ 矩阵,证明:$r(BC)\leq 1$;反之,若 $A$ 是秩为 1的 $3\times 3$ 矩阵,证明:存在 $3\times 1$ 矩阵 $B$$1\times 3$ 矩阵 $C$,使得 $A=BC$.

\item[四、](10分)设矩阵 $A=\begin{pmatrix}a & -1 & 1 \\ -1 & a & -1 \\ 1 & -1 & a\end{pmatrix},\beta =\begin{pmatrix}0 \\ 1 \\ 1\end{pmatrix}$. 假设线性方程组 $AX=\beta$ 有解但解不唯一.
\begin{enumerate}[label=(\arabic*)]
\item$a$ 的值;

\item 给出 $AX=\beta$ 的一般解.
\end{enumerate}

\item[五、](10分)设 $A$ 是可逆实矩阵.
\begin{enumerate}[label=(\arabic*)]
\item 证明 $A^{\mathrm{T}}A$ 是对称矩阵;

\item 证明 $A^{\mathrm{T}}A$ 是正定的.
\end{enumerate}

\item[六、](10分)令 $A = \begin{pmatrix}0 & 1 & 1 \\ 1 & -2 & 2 \\ 1 & 2 & -1 \end{pmatrix} \in M_{3\times 3}(\mathbf R)$.
\begin{enumerate}[label=(\arabic*)]
\item 求可逆矩阵 $Q\in M_{3\times 3}(\mathbf R)$ 使 $Q^{\mathrm{T}}AQ$ 是对角矩阵;

\item 给出 $A$ 的正惯性指数、负惯性指数,并确定 $A$ 的定性.
\end{enumerate}

\item[七、](10分)设 $\beta=\{v_1,v_2,\ldots,v_n\}$$V$ 的一组基,$T:V\to V$ 是线性变换,

$T(v_1)=v_2,T(v_2)=v_3,\ldots,T(v_{n-1})=v_n,T(v_n)=a_1v_1+a_2v_2+\cdots+a_nv_n$.

$T$ 关于 $\beta$ 的矩阵表示. 以及,在什么条件下 $T$ 是同构?

\item[八、](10分)设 $A\in M_{n\times n}(\mathbf{F})$ 有两个不同的特征值 $\lambda_1,\lambda_2$,且属于 $\lambda_1$ 的特征子空间的维数是$n-1$,证明:$A$ 是可对角化的.

\item[九、](20分)判断下面命题的真伪. 若它是真命题,给出一个简单证明;若它是伪命题,举一个具体的反例将它否定.
\begin{enumerate}[label=(\arabic*)]
\item 给定线性空间 $V$ 的非零向量 $v$ 和线性空间 $W$ 的向量 $w$,总存在线性映射 $T:V\to W$ 使得 $T(v)=w$.

\item 若线性方程组有 $m$ 个方程,$n$ 个变量,且 $m < n$,则这个方程组一定有非零解.

\item$n$ 阶方阵 $A$ 的秩是 $n$,则 $A$ 是可逆的.

\item 正交变换是可对角化的.
\end{enumerate}
\end{enumerate}

\clearpage
Loading

0 comments on commit 5d91cfe

Please sign in to comment.