▤Study Index ← Overview

Stage Handouts

A textbook you can start working through directly · each stage = 36 hours = 1 week

How to use: each stage page holds the complete explanation, worked examples and homework for both the maths and the programming. There is no textbook to go and find — just read it and do the homework.

Every stage contains: concept explanation → worked examples (full steps) → common traps → homework (with checkboxes) → self-assessment questions
Plus three kinds of extra content:
· 🔧 Skill card — reading tracebacks, looking things up in docs, looping through a problem, debugging a function. The lifeblood of self-study, one per stage
· 🧠 Cognitive science link — how this material relates to your major
· ✅ Verifiable — code was actually run, numerical claims were recomputed; conceptual analogies that cannot be verified are explicitly flagged

Year 1 · Fall — all published

01
Functions & sequence limits · Python environment and basic types Chinese
Math: the three ingredients of a function, composite functions, the ε-N language, arithmetic of limits, convergence properties, monotone-bounded criterion, mathematical induction
Code: get Jupyter running, variables are labels, basic types, input returns a string, f-strings, floating-point precision, intro to numpy / matplotlib
Skill: reading error messages (where to start in a traceback, the full-width-punctuation trap)
→
02
Function limits & continuity · Operators and conditionals Chinese
Math: the ε-δ language, one-sided limits, the two important limits, equivalent infinitesimals, classifying discontinuities, intermediate value theorem / bisection
Code: floor division and modulo, comparison and logic, short-circuit evaluation, if / elif / else, boolean truthiness
Skill: help() / dir() — finding answers yourself
→
03
Derivatives & differentials (I) · Loops Chinese
Math: the definition of the derivative, geometric meaning, the basic derivative table, differentiable vs continuous, differential approximation
Code: for / while, range, break / continue, nested loops, how to escape an infinite loop
Skill: the four-step loop debugging method | truncation vs rounding error in numerical differentiation
→
04
Differentiation rules · Functions (I) Chinese
Math: the arithmetic rules, the chain rule ★★, inverse functions, implicit functions, higher derivatives, backpropagation = the chain rule
Code: defining and calling, return vs print ★, multiple return values, scope, docstrings, sympy
Skill: the three reasons a function returns None | assert
→
05
Mean value theorems & L'Hôpital · Functions (II) Chinese
Math: Rolle's theorem · Lagrange mean value theorem ★ · L'Hôpital's rule ★★ (including when it fails)
Code: default arguments, when defaults are evaluated, the mutable default argument trap ⚠️⚠️, None as a sentinel
Skill: writing test cases for your own functions | Link: mutable defaults ↔ order effects in experiments
→
06
Applications of derivatives (I) · Scope and parameter kinds Chinese
Math: the monotonicity test · Fermat's lemma · the two sufficient conditions for extrema · extrema on a closed interval · the four-step optimisation method
Code: LEGB scope · global / nonlocal · *args / **kwargs · positional-only / keyword-only
Skill: reading someone else's function signature | Link: inverted-U curves ↔ maxima, optimality assumptions
→
07
Concavity & curve sketching · Lists and mutability traps Chinese
Math: concavity (with a warning about the naming mess) · inflection points · the three kinds of asymptote · six steps to sketch a function
Code: slicing · list methods · aliasing vs copying ⚠️⚠️ · shallow vs deep copy · == vs is
Skill: drawing the memory diagram to understand mutability | Link: aliasing traps ↔ contaminating raw data
→
08
Determinants · Cramer's rule | Dicts and sets Chinese
Math: 2×2 / 3×3 determinants · Sarrus' rule · the nine properties of determinants · Cramer's rule and its three limitations
Code: dicts · get vs [] · hashability · sets and set operations · deduplication
Skill: how to choose a data structure (a three-way checklist) | Link: zero determinant ↔ multicollinearity (verified computationally)
→
09
Matrix operations · Inverses | Tuples and strings in depth Chinese
Math: matrix multiplication (AB≠BA) · transpose · identity matrix · the inverse ★★ · the adjugate method
Code: tuples (immutable, usable as keys) · unpacking and swapping · string slicing · split/join · f-string alignment
Skill: slicing and formatting strings | Link: the inverse covariance matrix ↔ the precision matrix (verified computationally)
→
10
Vector sets & linear systems | File I/O and exceptions Chinese
Math: linear dependence / independence · rank ★ · Gaussian elimination and rref · the structure of solutions ★★ · deciding between the three cases
Code: with open · three ways to read · "w" wipes the file ⚠️ · pathlib · try/except and common exceptions
Skill: file I/O and paths | Link: rank deficiency ↔ unidentifiable parameters (condition number computed: 2.5×10¹⁰)
→
11
Indefinite integrals (substitution / by parts) | Modules and comprehensions Chinese
Math: antiderivatives and +C · the basic integral table · substitution ★ · integration by parts ★★ · choosing u with LIATE
Code: splitting files into modules · four ways to import · __name__ == "__main__" · comprehensions · generator expressions
Skill: splitting code across files | Link: the expectation of a response-time distribution is an integral (three methods cross-checked)
→
12
Definite integrals & applications | Object orientation (I) Chinese
Math: Riemann sums · Newton–Leibniz ★★ · the fundamental theorem of calculus · area / volume / average · improper integrals
Code: why classes exist · __init__ and self · instance vs class attributes (mutable class attribute trap ⚠️) · methods
Skill: how classes and instances relate | Link: psychometric functions, signal detection d′ (closed-form check)
→
13
Vector spaces & eigenvalues (I) | Object orientation (II) · Git basics Chinese
Math: basis and dimension · eigenvalues and eigenvectors ★★ · characteristic polynomial · Σλ=tr(A), Πλ=det(A) · complex eigenvalues
Code: inheritance and super() · magic methods · @property · composition vs inheritance · Git's three areas · .gitignore
Skill: the basic Git workflow | Link: eigenvalues of the covariance matrix ↔ PCA (the first component explains 93%)
→
14
Calculus revision | Capstone mini-project Chinese
Math: a full knowledge map · master formula sheet · six question archetypes · 12 high-frequency mistakes · a mock paper with 18 problems + worked solutions
Code: the response-time analysis project (4 modules + self-check + README + .gitignore — runnable and reproducible) · cleaning rules · text report
Skill: getting a project running from scratch (five-step debugging) | Link: the spacing effect and retrieval practice (model simulation)
→
15
Eigenvalues (II) & diagonalisation | Advanced Git · Debugger Chinese
Math: similar matrices · diagonalisation A=PΛP⁻¹ ★★ · fast powers of A · Fibonacci and the golden ratio · orthogonal diagonalisation
Code: Git branches · merging and resolving conflicts · remote repositories · the danger levels of undo operations · breakpoint() and pdb
Skill: using a debugger to locate a bug | Link: a Markov chain's steady state = the eigenvector for eigenvalue 1 (two methods cross-checked)
→
16
Linear algebra revision · Intro to SVD | Environment management and wrap-up Chinese
Math: full linear algebra review · SVD ★ (A=UΣVᵀ) · singular values² = eigenvalues of AᵀA · Eckart–Young low-rank approximation · pseudoinverse
Code: venv / conda · requirements.txt · reproducing on a new machine · wrap-up of the 16 stages
Skill: reproducing an environment on a new computer | Link: RSA and MDS = SVD in action (distances recovered exactly, computed)
→

About these handouts

All 16 stages of Year 1 fall are published. Each handout is complete and studyable on its own: maths text + programming text + skill card + cognitive science link + homework + self-assessment.

Every piece of code and every mathematical result in these handouts was actually run and verified. Running ~/miniconda3/bin/python 验证.py re-checks all of it in one pass (code-block rendering, link reachability, no hard-coded paths, per-module self-checks, handout structure).

Mistakes that only running the code exposed (all fixed):
· Stage 1: the convergence rate of (1+1/n)ⁿ was initially wrong (at n=50 it is 2.69, not close to e)
· Stage 3: the claim that "the error grows when h is very small" does not hold at f(x₀)=0 — the precondition was missing
· Stage 6: pow was treated as positional-only; in fact it accepts keyword arguments
· Stage 3: "concave" was used for the f″<0 learning curve, contradicting the Tongji convention (f″<0 is convex) — reworded to describe the shape
· Stages 2, 5, 8: \|x\| rendered as a double bar ‖x‖ instead of the absolute value |x| — changed to \lvert x\rvert
· Stage 12: the comment on a.mean_rt is b.mean_rt was backwards — it is actually False (bound methods are recreated on every access)
· Stage 9: sympify("x**5") produced a symbol different from the declared one, so an integral check passed falsely — caught by actually running it