You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @jstac
I was reading through the linear_algebra lecture with codex and noted a few points for potential updates.
I’d be grateful if you could take a look when you have time.
Style consistency
Here are some comments related to the style guide violations.
[qe-link-002] At line 68, replace the direct URL referring to the whole NumPy lecture with a cross-series {doc} reference.
Use cross-series {ref} references for links to specific sections of the NumPy lecture: “NumPy arrays” at line 206, “Shape and dimension” at line 610, “Creating arrays” at line 616, and “Matrix multiplication” at lines 634 and 1379.
[qe-fig-001: Do not set figure size unless necessary.] Explicit figure sizes appear at lines 104, 174, 298, 695, and 951.
[qe-fig-007: Keep figure box and spines.] The plotting code hides the top and right spines at lines 108–109, 178–179, 701–702, and 955–956.
[qe-writing-006] Apply sentence case to subsection headings at lines 124, 220, 391, 426, 486, 637, 656, 755, 778, 814, 849, 879, 916, 1035, 1051, 1056, 1067, 1085, 1104, 1122, 1141, and 1162, according to the style guide.
[qe-math-002] Use \top consistently for transposes at lines 231, 239, 478, 847, 913, 1131–1132, 1154–1158, and throughout the exercise and solution at lines 1181–1373. Retain the introduction of both $A'$ and $A^\top$ at line 476, but write the symmetry condition at line 478 as $A=A^\top$.
[qe-writing-008] Remove the extra spaces in “consists of” at line 352 and “equals the” at line 1006.
[qe-writing-001, qe-writing-008] Separate the sentences at line 1146 by starting “Let” in a new paragraph, and at line 1217 by starting “You can verify…” in a new paragraph within the note. These changes also remove the double spaces between sentences. At line 1381, split the four sentences in footnote cfn into separate paragraphs, preserving the indentation needed to keep them within the footnote.
Vectors and matrices
At lines 349–350, qualify the single vector as nonzero before describing its span as a unique line through the origin. The span of the zero vector is ${0}$. The opening could read: “If $A$ contains only one nonzero vector $a_1\in\mathbb R^2$, then…”
At lines 421, 434, and 440, add the missing + after \cdots in the linear combinations. These should read $\beta_1a_1+\cdots+\beta_ka_k$ and, in the corresponding expression, $\gamma_1a_1+\cdots+\gamma_ka_k$.
At line 480, “the $i$ elements” should refer to the $n$ diagonal entries. Suggested wording: “For an $n\times n$ matrix $A$, the $n$ entries $a_{11},\ldots,a_{nn}$ form the principal diagonal.”
At line 585, correct the index entry from single: Matrix; Numpy to single: Matrix; NumPy.
Linear systems and eigenvectors
At line 858, change “the columns of $A$ consists of 3 vectors” to “the columns of $A$ consist of 3 vectors.”
At line 909, remove the duplicated preposition in “by either via,” leaving “either via.”
At line 911, revise the explanation for preferring solve(A, y). Both routines use LU-based methods for general matrices, so the current wording incorrectly presents LU decomposition as the distinguishing feature. Suggested replacement:
To solve $Ax=y$, we generally prefer solve(A, y) because it avoids the unnecessary step of computing the inverse of $A$.
At lines 1031–1033, change “any scalar multiple of an eigenvector” to “any nonzero scalar multiple of an eigenvector.” Multiplication by zero produces the zero vector, which is excluded from the definition of an eigenvector.
Further reading
At lines 1166–1167, change “contains” to “contain,” use the book’s full title, and update the author-page URL. Suggested wording:
The assumptions at lines 1192–1194 allow $P$ and $Q$ to be positive semidefinite, which does not guarantee that the inverse used at lines 1211–1212 exists. For example, the scalar choices $P=1$, $Q=0$, and $B=0$ give $Q+B^\top PB=0$. Add the assumption that $H:=Q+B^\top PB$ is positive definite, and carry it into the repeated setup at lines 1241–1246. A simpler sufficient alternative is to assume $Q$ is positive definite while retaining positive semidefiniteness of $P$.
At lines 1241–1246, make the primitive descriptions grammatical and consistent: use “$P$ is…,” “$Q$ is…,” “$A$ is…,” and “$B$ is…,” with the definiteness wording matching the corrected assumptions.
In Step 2 at line 1277, the first occurrence of $-B^\top\lambda$ should be $+B^\top\lambda$, since the Lagrangian contains $+\lambda^\top Bu$. The subsequent equality already has the correct sign. The derivative should read:
Hi @jstac
I was reading through the
linear_algebralecture with codex and noted a few points for potential updates.I’d be grateful if you could take a look when you have time.
Style consistency
Here are some comments related to the style guide violations.
[qe-link-002] At line 68, replace the direct URL referring to the whole NumPy lecture with a cross-series
{doc}reference.Use cross-series
{ref}references for links to specific sections of the NumPy lecture: “NumPy arrays” at line 206, “Shape and dimension” at line 610, “Creating arrays” at line 616, and “Matrix multiplication” at lines 634 and 1379.[qe-fig-001: Do not set figure size unless necessary.] Explicit figure sizes appear at lines 104, 174, 298, 695, and 951.
[qe-fig-007: Keep figure box and spines.] The plotting code hides the top and right spines at lines 108–109, 178–179, 701–702, and 955–956.
[qe-writing-006] Apply sentence case to subsection headings at lines 124, 220, 391, 426, 486, 637, 656, 755, 778, 814, 849, 879, 916, 1035, 1051, 1056, 1067, 1085, 1104, 1122, 1141, and 1162, according to the style guide.
[qe-math-002] Use$A=A^\top$ .
\topconsistently for transposes at lines 231, 239, 478, 847, 913, 1131–1132, 1154–1158, and throughout the exercise and solution at lines 1181–1373. Retain the introduction of both$A'$and$A^\top$at line 476, but write the symmetry condition at line 478 as[qe-writing-008] Remove the extra spaces in “consists of” at line 352 and “equals the” at line 1006.
[qe-writing-001, qe-writing-008] Separate the sentences at line 1146 by starting “Let” in a new paragraph, and at line 1217 by starting “You can verify…” in a new paragraph within the note. These changes also remove the double spaces between sentences. At line 1381, split the four sentences in footnote
cfninto separate paragraphs, preserving the indentation needed to keep them within the footnote.Vectors and matrices
At lines 349–350, qualify the single vector as nonzero before describing its span as a unique line through the origin. The span of the zero vector is${0}$ . The opening could read: “If $A$ contains only one nonzero vector $a_1\in\mathbb R^2$ , then…”
At lines 421, 434, and 440, add the missing$\beta_1a_1+\cdots+\beta_ka_k$ and, in the corresponding expression, $\gamma_1a_1+\cdots+\gamma_ka_k$ .
+after\cdotsin the linear combinations. These should readAt line 480, “the$i$ elements” should refer to the $n$ diagonal entries. Suggested wording: “For an $n\times n$ matrix $A$ , the $n$ entries $a_{11},\ldots,a_{nn}$ form the principal diagonal.”
At line 585, correct the index entry from
single: Matrix; Numpytosingle: Matrix; NumPy.Linear systems and eigenvectors
At line 858, change “the columns of$A$ consists of 3 vectors” to “the columns of $A$ consist of 3 vectors.”
At line 909, remove the duplicated preposition in “by either via,” leaving “either via.”
At line 911, revise the explanation for preferring solve(A, y). Both routines use LU-based methods for general matrices, so the current wording incorrectly presents LU decomposition as the distinguishing feature. Suggested replacement:
Further reading
At lines 1166–1167, change “contains” to “contain,” use the book’s full title, and update the author-page URL. Suggested wording:
Exercise and solution
The assumptions at lines 1192–1194 allow$P$ and $Q$ to be positive semidefinite, which does not guarantee that the inverse used at lines 1211–1212 exists. For example, the scalar choices $P=1$ , $Q=0$ , and $B=0$ give $Q+B^\top PB=0$ . Add the assumption that $H:=Q+B^\top PB$ is positive definite, and carry it into the repeated setup at lines 1241–1246. A simpler sufficient alternative is to assume $Q$ is positive definite while retaining positive semidefiniteness of $P$ .
At lines 1241–1246, make the primitive descriptions grammatical and consistent: use “$P$ is…,” “$Q$ is…,” “$A$ is…,” and “$B$ is…,” with the definiteness wording matching the corrected assumptions.
In Step 2 at line 1277, the first occurrence of$-B^\top\lambda$ should be $+B^\top\lambda$ , since the Lagrangian contains $+\lambda^\top Bu$ . The subsequent equality already has the correct sign. The derivative should read:
At lines 1286–1287, change “into above equation” to “into the above equation.”
At line 1321, typeset “with” as text within the displayed equation. Replace the raw word and repeated
\,spacing with\quad \text{with} \quad.At line 1335, replace “For simplicity, denote by …, then …” with:
In Step 3 at line 1341, substituting$u=-Sx$ should produce a positive sign on the right-hand side:
The following line, 1342, already has the correct positive sign.
Happy to put up a PR.
Best,
Longye