Skip to content

Commit dae0014

Browse files
authored
Add Linear Algebra Documentation - Initial Vectors Section (#10)
* Add comprehensive Linear Algebra documentation Create LinearAlgebra documentation section with four foundational topics: - 01 Vectors.md: Operations, magnitude, dot product, orthogonality, span - 02 Lines.md: Parametric, implicit, explicit forms; conversions; intersections - 03 Linear Transformations.md: Matrix representation, rotation, scaling, reflection, projection - 04 Matrices.md: Operations, determinant, inverse, eigenvalues, decompositions All files follow established documentation patterns: - MathWorld links for mathematical terms - Proper LaTeX formatting for equations - Cross-references between related topics - Applications sections * Rename directory to "Basics" * Add Systems of Equations docs and expand Matrices content - Add 05 Systems of Equations.md covering algebraic methods (substitution, elimination), nonlinear systems, and solution types - Expand 04 Matrices.md with Cramer's rule example, matrix inverse method example, and detailed examples for infinitely many solutions and homogeneous systems - Update make.jl to include new Systems of Equations page - Minor updates to 01 Vectors.md * Expand Vectors documentation with notation and components sections - Reorder definitions (algebraic first, then geometric) - Add Vector Notation section (column/row vectors, boldface, hat notation) - Add Components and Dimensions section - Fix typo in R^2 definition * Rename notebook * Add starter basics notebook * add markdown lint ignore file * add modified copilot instructions * Add modified file name * Fix MathJax3 display math rendering and update documentation patterns - Add \[...\] delimiters to MathJax3 displayMath config (fixes literal \[ \] appearing) - Fix bullet points where LaTeX started immediately after dash (Unit Vectors, Polar Form, Key insights) - Update copilot-instructions.md with: - Enhanced bullet point rule with more examples - Absolute value notation (\lvert/\rvert) - Complete MathJax3 configuration section with migration instructions - Mark as canonical basis for other Julia Math repos * Add vector operations examples and generalize to R^n Vectors documentation: - Add section on generalizing vector operations to R^n - Include addition, scalar multiplication, subtraction formulas for n-dimensional vectors - Add notes on applications in data science and machine learning Basics notebook: - Add vector operation examples with production quantities - Add complex vector expression examples (v₁ - 4v₂ + 2v₃) * Add Basis Vectors section with simplified explanation - Define basis vectors without using 'vector space' or 'linearly independent' - Show standard basis for R^2 and R^3 with concrete examples - Note connection between basis vectors and unit vectors - Fix L2 norm formatting * Add 'define before use' principle and refine Vectors doc - Add documentation guideline: all terms must be defined before use - This principle drives document structure and section ordering - Refine 'Components and Dimensions' section to define space/R^n - Ensure logical progression throughout Vectors documentation * move dot product section back after definition of magnitide and direction * Add derivations and explanations for vector formulas - Add Pythagorean derivation for magnitude formula - Explain extension to R^n via recursive Pythagorean theorem - Add trigonometric derivation for polar form - Explain normalization formula (why dividing by magnitude works) - Extend basis vectors explanation to R^n with summation notation * Reorganize Vectors doc for logical flow and add notebook example - Rearrange sections to follow 'define before use' principle - Add example to Basics notebook * Add comprehensive Geometry documentation section - Add 10 new Geometry documents covering 2D/3D linear algebra: * Points and Coordinates (vectors, basis, barycentric coords) * Lines (parametric, implicit, explicit forms) * Dot Product and Orthogonality * Projections and Distance * Line Intersections * Transformations (rotation, reflection, projection, scaling) * Matrices and Maps (matrix-vector multiplication, determinants) * Linear Systems (Cramer's rule, Gaussian elimination) * Inverse and Kernel (invertibility, null space) * 3D Geometry (cross product, planes, 3D transformations) - Add 88 supporting images in Geometry/assets/ - Update make.jl with Geometry section in navigation - Add pagesonly=true to exclude source reference files - Update .gitignore to exclude Linear Algebra Capacities folder * Coordinate Basics and Geometry 01 documents Basics/01 Vectors: - Remove geometric concepts (magnitude, distance, basis vectors) - Keep algebraic definitions and properties - Add cross-references to Geometry section Geometry/01 Points and Coordinates: - Add position vector, free vector, displacement vector definitions - Add parallel vectors section - Add cross-reference to Basics for vector operations - Fix image paths * Coordinate Basics/01 and Geometry/01: separate algebraic vs geometric content - Remove geometric interpretations from Basics/01 Vectors.md (parallelogram rule, scaling, linear independence) - Add Linear Independence (Geometric View) section to Geometry/01 Points and Coordinates.md - Update all cross-references to include specific section anchors - Add bidirectional links between algebraic and geometric sections * Fix cross-document section links with proper anchor syntax - Use correct capitalization in section anchors (e.g., #Coordinate-Independent-Operations) - Add document context to cross-references (e.g., 'in the Points and Coordinates document') - Document cross-reference syntax in copilot-instructions.md for future reference - Spaces in file paths use actual spaces, spaces in anchors use hyphens * emove Basics/02 Lines.md and renumber remaining Basics docs - Delete Basics/02 Lines.md (content covered in Geometry section) - Add skew lines section to Geometry/10 3D Geometry.md - Renumber Basics files: 03→02, 04→03, 05→04 - Update make.jl pages array with new file names - Fix all cross-references to use updated file numbers * Prepare initial PR with Vectors documentation only - Update index.md with source references (Farin & Hansford text) - Comment out all pages except 01 Vectors in make.jl for initial deploy - Comment out cross-references in 01 Vectors.md to excluded pages - Enables incremental review: deploy Vectors first, add more as reviewed * Fix Julia 1.12 compatibility and update index.md Symbolics.jl fix: - Add fold=Val{true}() to substitute calls to force evaluation - Add Float64.() wrapper to ensure numeric matrix types - Fixes rtoldefault MethodError in isapprox comparisons - All 68 tests now pass on Julia 1.12 index.md updates: - Add detailed overview of package purpose and source materials - Document source books for Basics and Geometry sections - Minor grammar and clarity improvements
1 parent 6a1c8a0 commit dae0014

File tree

111 files changed

+5308
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+5308
-26
lines changed

.github/copilot-instructions.md

Lines changed: 139 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Copilot Instructions for Linear_Algebra
22

3-
## Project Architecture
3+
> **Note:** These instructions serve as the canonical basis for other repositories in the Julia Math study project. Documentation patterns, LaTeX conventions, and MathJax3 configuration documented here should be referenced by related repositories.
44
5-
This is a **Julia linear algebra computing project** using DrWatson for reproducibility, focused on geometric transformations and linear algebra operations with visualization capabilities. The codebase follows a **modular mathematical library pattern** with comprehensive testing and documentation.
5+
## Project Overview
6+
7+
This is a **Julia linear algebra project** using DrWatson for reproducibility, focused on geometric transformations and linear algebra operations with visualization capabilities. The codebase follows a **modular mathematical library pattern** with comprehensive testing and documentation.
68

79
### Core Components
810

@@ -14,7 +16,10 @@ This is a **Julia linear algebra computing project** using DrWatson for reproduc
1416

1517
## Critical Development Patterns
1618

17-
### Module Structure
19+
### Module Structure & Exports
20+
21+
All code uses `@reexport` pattern and exports both computational + plotting functions:
22+
1823
```julia
1924
# Main module uses @reexport for clean interface
2025
using Reexport
@@ -38,12 +43,17 @@ export distance_2_points, center_of_gravity, barycentric_coord, plot_param_line
3843
# ... matrix functions, line functions, etc.
3944
```
4045

41-
### Environment-Aware Module Loading
46+
### Automatic CI/Interactive Detection
47+
48+
Module auto-configures at load time - no manual intervention needed:
49+
4250
```julia
43-
# The module automatically detects CI vs interactive environments
51+
# src/Math_Foundations.jl - Runs on module load
4452
if haskey(ENV, "CI") || get(ENV, "GKSwstype", "") == "100"
4553
ENV["GKSwstype"] = "100" # Headless plotting
4654
gr(show=false)
55+
else
56+
gr() # Interactive plotting
4757
end
4858
```
4959

@@ -312,14 +322,131 @@ distance_to_implicit_line(a::Number, b::Number, c::Number, r::Point) -> Float64
312322
foot_of_line(P::Point, v::Vector, R::Point) -> Tuple(Point, Float64)
313323
```
314324
## Documentation Patterns
315-
- Use LaTex for all mathematical notation
316-
- Use Markdown for explanations
317-
- After creating or editing a markdown document always review and fix all linting issues, unless the document is a configuration file of some kind
325+
326+
### Structure for Mathematical Concept Documentation
327+
328+
Documentation in `docs/src/` explains general math concepts (not code). Follow these patterns:
329+
330+
**Document Organization:**
331+
- Start with concept overview and [MathWorld](https://mathworld.wolfram.com/) link in opening paragraph
332+
- Use hierarchical headings: `##` for major topics, `###` for subtopics
333+
- Group related concepts logically
334+
- Include real-world applications section
335+
336+
**Content Style:**
337+
- **Definitions first**: Clear, precise mathematical definitions with MathWorld links
338+
- **Define before use**: All terms must be defined before they are used elsewhere in the document. This principle drives the order and structure of sections—ensure logical progression where each concept builds only on previously defined terms.
339+
- **Build progressively**: Simple concepts → complex relationships → applications
340+
- **Multiple representations**: Equations, tables, visual aids (SVG diagrams when helpful)
341+
- **Context matters**: Explain _why_ concepts are important, not just _what_ they are
342+
- **Derivations**: Show mathematical reasoning step-by-step
343+
344+
**Mathematical Notation:**
345+
- Use LaTeX: `$$` for display equations, inline with `$...$`
346+
- **CRITICAL**: `$$` display blocks in Documenter.jl must have `$$` directly attached to content (no blank lines or return after opening or before closing)
347+
-**CORRECT** (multi-line aligned block):
348+
```
349+
$$\begin{aligned}
350+
b &= a\sqrt{1-e^2} \\
351+
c &= ae \\
352+
a^2 &= b^2 + c^2
353+
\end{aligned}$$
354+
```
355+
- ✅ **CORRECT** (single equation): `$$equation$$`
356+
- ❌ **WRONG** (blank lines or return between `$$` and content):
357+
```
358+
$$
359+
360+
content
361+
362+
$$
363+
```
364+
- **Bullet point style**: List items starting with `-` must begin with **text**, then LaTeX math. LaTeX commands immediately after `-` render incorrectly (misaligned or broken formatting)
365+
- ✅ **CORRECT**: `- The semi-major axis is $a$`
366+
- ✅ **CORRECT**: `- stretch the vector: $\lvert c \rvert \gt 1$`
367+
- ❌ **WRONG**: `- $a$ is the semi-major axis` (LaTeX immediately after dash)
368+
- ❌ **WRONG**: `- $\mathbf{e}_1 = \lbrack 1, 0 \rbrack$ (points along x-axis)` (LaTeX starts the line)
369+
- **Equation placement style**: Prefer inline equations with "where:" at end of sentence, followed by list
370+
- ✅ **CORRECT**: `For an ellipse: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where:`
371+
- ❌ **AVOID**: Blank line, then equation block, then blank line, then "where:"
372+
- LaTeX syntax for symbols: `^\circ` not `°`, `\frac{}{}` for fractions
373+
- Label variables clearly: "where: $r$ = radius, $θ$ = angle"
374+
- Use aligned equations: `\begin{aligned}...\end{aligned}` for multi-step derivations
375+
- **Square brackets in LaTeX math**: Use `\lbrack` and `\rbrack` instead of `[` and `]` inside math expressions to avoid markdown link interpretation errors
376+
- ✅ **CORRECT**: `$\mathbf{v} = \lbrack v_1, v_2 \rbrack$`
377+
- ❌ **WRONG**: `$\mathbf{v} = [v_1, v_2]$` (markdown interprets `[v_1, v_2]` as a link)
378+
- **Absolute value notation**: Use `\lvert` and `\rvert` instead of `|` to avoid markdown pipe interpretation
379+
- ✅ **CORRECT**: `$\lvert c \rvert > 1$`
380+
- ❌ **WRONG**: `$|c| > 1$` (pipe may be interpreted as table delimiter)
381+
382+
**MathJax3 Configuration (Linear_Algebra uses MathJax3 instead of default KaTeX):**
383+
384+
This project uses MathJax3 for math rendering. Key configuration in `docs/make.jl`:
385+
386+
```julia
387+
mathengine = Documenter.MathJax3(Dict(
388+
:loader => Dict("load" => ["[tex]/physics", "[tex]/ams"]),
389+
:tex => Dict(
390+
"packages" => ["base", "ams", "mathtools"],
391+
"inlineMath" => [["\$", "\$"]],
392+
"displayMath" => [["\$\$", "\$\$"], ["\\[", "\\]"]],
393+
),
394+
)),
395+
```
396+
397+
**Critical**: The `displayMath` array must include **both** `$$...$$` AND `\[...\]` delimiters because:
398+
- Markdown source uses `$$...$$` for display math
399+
- Documenter.jl converts some `$$` blocks to `\[...\]` in generated HTML (especially in list items or new paragraphs)
400+
- Without both delimiters, MathJax won't process `\[...\]` blocks and they render as literal text
401+
402+
**To switch from KaTeX to MathJax3:**
403+
1. Add `mathengine` parameter to `Documenter.HTML()` in `docs/make.jl`
404+
2. Include both delimiter styles in `displayMath`
405+
3. Load desired packages (ams, mathtools, physics) via `:loader` and `"packages"`
406+
4. Clean rebuild: `rm -rf docs/build && julia --project=. docs/make.jl`
407+
408+
**MathWorld Links:**
409+
- Link every new mathematical term on first mention
410+
- Format: `[Term](https://mathworld.wolfram.com/Term.html)`
411+
- Verify URLs before adding (use fetch_webpage)
412+
- Compare multiple URLs to choose most appropriate
413+
414+
**Visual Elements:**
415+
- SVG diagrams for geometric concepts
416+
- Tables for reference data (common values, conversions)
417+
- Consistent styling in diagrams (colors, labels, annotations)
418+
419+
**Markdown Conventions:**
420+
- _Underscore_ for emphasis (not asterisk)
421+
- **Bold** for important terms and section labels
422+
- Fix all linting issues after editing (except config files)
423+
- Code blocks with language tags: ````julia` for Julia examples
318424
- Follow the pattern of existing function documentation in src directory
319-
- When a new mathematical concept is introduced, add an external link to [MathWorld](https://mathworld.wolfram.com/) for that specific concept.
320-
- Compare multiple potential URLs to choose the most appropriate one
321-
- Avoid replacing working links with inferior alternatives
322-
- Always use fetch_webpage function to check the link is valid and points to the correct concept.
425+
426+
**Cross-Document Section Links (Documenter.jl):**
427+
428+
When linking to a specific section in another document, use standard markdown link syntax with the full file path and section anchor:
429+
430+
```markdown
431+
[Display Text](../Folder/Document Name.md#Section-Heading)
432+
```
433+
434+
**CRITICAL rules for section anchors:**
435+
- Section anchors must **exactly match** the heading text with proper capitalization
436+
- Spaces in **file names** remain as spaces (not `%20`)
437+
- Spaces in **section anchors** become hyphens (`-`)
438+
- Parentheses in section names are preserved in the anchor
439+
440+
**Examples:**
441+
-**CORRECT**: `[Coordinate Independent Operations](../Geometry/01 Points and Coordinates.md#Coordinate-Independent-Operations)`
442+
-**CORRECT**: `[Linear Independence (Geometric View)](../Geometry/01 Points and Coordinates.md#Linear-Independence-(Geometric-View))`
443+
-**WRONG**: `[Section](../Geometry/01%20Points%20and%20Coordinates.md#section)` (wrong: `%20` and lowercase)
444+
-**WRONG**: `[Section](@ref "Section Name")` (`@ref` is for docstrings, not cross-document links)
445+
446+
**Best practice for cross-references:**
447+
- Include context about which document contains the section: "see [Section Name](path#anchor) in Document Name"
448+
- Verify the section heading spelling and capitalization before creating the link
449+
- Test the link by building docs (`julia --project=. docs/make.jl`) and clicking in browser
323450

324451
## Communication Patterns
325452

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,7 @@ $RECYCLE.BIN/
417417
## Acknowledgements
418418
# Many thanks to `https://gitignore.io/`, written and maintained by Joe Blau, which contributed much material to this gitignore file.
419419

420-
/Manifest.toml
420+
/Manifest.toml
421+
docs/src/Linear\ Algebra\ Old/
422+
docs/src/Linear Algebra Capacities/
423+

.markdownlint-cli2.jsonc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ignores": [
3+
".github/copilot-instructions.md"
4+
]
5+
}

docs/make.jl

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,45 @@ using Linear_Algebra
66
makedocs(;
77
modules=[Linear_Algebra], # Specify your module here
88
sitename = "Linear_Algebra",
9+
# pagesonly=true excludes all markdown files not listed in pages (e.g., Linear Algebra Capacities/)
10+
pagesonly = true,
911
# This argument is only so that the sequence of pages in the sidebar is configured
10-
# By default all markdown files in `docs/src` are expanded and included.
11-
pages = ["index.md", "sites.md"],
12+
pages = [
13+
"index.md",
14+
"Basics" => [
15+
"Basics/01 Vectors.md",
16+
# "Basics/02 Linear Transformations.md",
17+
# "Basics/03 Matrices.md",
18+
# "Basics/04 Systems of Equations.md",
19+
],
20+
"Geometry" => [
21+
"Geometry/01 Points and Coordinates.md",
22+
# "Geometry/02 Lines.md",
23+
# "Geometry/03 Dot Product and Orthogonality.md",
24+
# "Geometry/04 Projections and Distance.md",
25+
# "Geometry/05 Line Intersections.md",
26+
# "Geometry/06 Transformations.md",
27+
# "Geometry/07 Matrices and Maps.md",
28+
# "Geometry/08 Linear Systems.md",
29+
# "Geometry/09 Inverse and Kernel.md",
30+
# "Geometry/10 3D Geometry.md",
31+
],
32+
"sites.md"
33+
],
1234
# Don't worry about what `CI` does in this line.
1335
format = Documenter.HTML(
1436
prettyurls = CI,
1537
edit_link = "main",
1638
assets = ["assets/custom.css"],
1739
inventory_version = "0.1.0",
40+
mathengine = Documenter.MathJax3(Dict(
41+
:loader => Dict("load" => ["[tex]/physics", "[tex]/ams"]),
42+
:tex => Dict(
43+
"packages" => ["base", "ams", "mathtools"],
44+
"inlineMath" => [["\$", "\$"]],
45+
"displayMath" => [["\$\$", "\$\$"], ["\\[", "\\]"]],
46+
),
47+
)),
1848
footer = "Powered by [Documenter.jl](https://documenter.jl) and the [Julia Programming Language](https://julialang.org) generated on $(Dates.format(Dates.now(), "yyyy-mm-dd HH:MM:ss"))"
1949
),
2050
)

0 commit comments

Comments
 (0)