Skip to content

feat(examples): validate galgebra against Goyder cheat sheet (#506)#557

Merged
utensil merged 3 commits intopygae:masterfrom
utiberious:feat/issue-506-cheatsheet-validation
Apr 1, 2026
Merged

feat(examples): validate galgebra against Goyder cheat sheet (#506)#557
utensil merged 3 commits intopygae:masterfrom
utiberious:feat/issue-506-cheatsheet-validation

Conversation

@utiberious
Copy link
Copy Markdown
Contributor

Closes #506

Adds examples/Terminal/cheatsheet_validation.py validating galgebra against Russell Goyder's geometric algebra cheat sheet, covering all 7 sections:

  1. geometric product decomposition: ab = a·b + a∧b, symmetric/antisymmetric parts
  2. vector-multivector grade raising/lowering: a*B = a<B + a∧B
  3. bivector identities: a·(b∧c) = (a·b)c - (a·c)b, (a∧b)·(c∧d) scalar formula
  4. commutator product: B×v = B·v, grade-preserving on bivectors, Jacobi identity
  5. pseudoscalar: I²=-1, centrality in 3D, dual via I⁻¹
  6. outermorphism: rotor normalization, rotation sandwich, det(rotation)=1
  7. adjoint: a·F̄(b) = F(a)·b, det(FG) = det(F)·det(G)

Adds examples/Terminal/cheatsheet_validation.py covering all 7 sections
of the geometric algebra cheat sheet by Russell Goyder:

1. geometric product decomposition (ab = a.b + a^b)
2. vector-multivector grade raising/lowering
3. bivector identities (a.(b^c), (a^b).(c^d))
4. commutator product (B x v = B.v, Jacobi identity)
5. pseudoscalar (I^2=-1, centrality in 3D, dual)
6. outermorphism (rotor normalization, rotation, det=1)
7. adjoint (a.F_bar(b) = F(a).b, det(FG) = det(F)det(G))
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.32%. Comparing base (a860be1) to head (69f21db).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #557      +/-   ##
==========================================
+ Coverage   73.11%   73.32%   +0.21%     
==========================================
  Files          22       22              
  Lines        4475     4458      -17     
==========================================
- Hits         3272     3269       -3     
+ Misses       1203     1189      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@utensil utensil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cheatsheet validation script. Math across all 7 sections checks out — geometric product decomposition, vector-multivector products, bivector contraction identities, commutator/Jacobi identity, pseudoscalar properties, rotation outermorphism, and adjoint definition all verify correctly in G(3,0).

One significant issue: examples/Terminal/cheatsheet_validation.py is not collected by pytest. The CI config (setup.cfg: python_files = test_*.py) only collects files matching test_*.py. The pytest invocation covers test/ and nbval on examples/ipython|primer/examples/Terminal/ is not included. The codecov/patch passes vacuously because --cov=galgebra only measures galgebra/ source coverage, and this PR doesn't touch any galgebra source. The script runs zero assertions during CI.

Targeted tests belong in test/. Please move this to test/test_cheatsheet.py so the assertions actually run in CI. Notebooks in examples/ are fine as examples that happen to improve coverage, but new targeted tests go in test/.

Minor: section 5 uses the Iinv+ dual convention (dual(A) = A * I^{-1}) computed manually via I.inv(). That's mathematically correct, but galgebra's built-in dual() defaults to I+ (dual(A) = I*A). Worth a comment so readers don't assume dual() behaves this way.

utiberious and others added 2 commits April 1, 2026 11:31
…ae#506)

Per review: examples/Terminal/ is not collected by CI (setup.cfg only
collects test_*.py). Move to test/test_cheatsheet.py so assertions
actually run in CI.

Also adds a comment in section 5 clarifying that the dual is computed
manually via I^{-1} (Iinv+ convention), which differs from galgebra's
built-in dual() that uses I+ by default.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@utensil utensil merged commit 54ea710 into pygae:master Apr 1, 2026
5 checks passed
utiberious added a commit to utiberious/galgebra that referenced this pull request Apr 1, 2026
Groups new entries by: features, bug fixes, examples/docs, tests/maintenance.

Features: Cl() kingdon interface (pygae#550, closes pygae#524), Mv.__rtruediv__
(pygae#543, closes pygae#512), shirokov_inverse/hitzer_inverse (pygae#530).

Bugs: interop dual mode contamination (pygae#556, closes pygae#555), norm() Abs
wrapping (pygae#554, closes pygae#522), is_versor() improvement (pygae#536, closes pygae#533).

Examples/docs: sundial + cheatsheet tests (pygae#549+pygae#557, closes pygae#506),
coords tutorial (pygae#551), README ops (pygae#548, closes pygae#523).

Tests/maintenance: lt.matrix() regression tests (pygae#558, closes pygae#461),
extra-cdot regression test (pygae#545), er_blade + ReciprocalFrame refactors
(pygae#552+pygae#553), CI fix (pygae#535).
utensil pushed a commit that referenced this pull request Apr 1, 2026
* docs: add 0.6.0 changelog entries

Groups new entries by: features, bug fixes, examples/docs, tests/maintenance.

Features: Cl() kingdon interface (#550, closes #524), Mv.__rtruediv__
(#543, closes #512), shirokov_inverse/hitzer_inverse (#530).

Bugs: interop dual mode contamination (#556, closes #555), norm() Abs
wrapping (#554, closes #522), is_versor() improvement (#536, closes #533).

Examples/docs: sundial + cheatsheet tests (#549+#557, closes #506),
coords tutorial (#551), README ops (#548, closes #523).

Tests/maintenance: lt.matrix() regression tests (#558, closes #461),
extra-cdot regression test (#545), er_blade + ReciprocalFrame refactors
(#552+#553), CI fix (#535).

* docs: add missing issue link for #551 entry

* docs: add changelog entry for #560 (Lt callable zero fix)

* docs: move Lt zero fix into bug group, use issue #540 as reference
utiberious added a commit to utiberious/galgebra that referenced this pull request Apr 2, 2026
…) (pygae#557)

* feat(examples): validate galgebra against Goyder cheatsheet (pygae#506)

Adds examples/Terminal/cheatsheet_validation.py covering all 7 sections
of the geometric algebra cheat sheet by Russell Goyder:

1. geometric product decomposition (ab = a.b + a^b)
2. vector-multivector grade raising/lowering
3. bivector identities (a.(b^c), (a^b).(c^d))
4. commutator product (B x v = B.v, Jacobi identity)
5. pseudoscalar (I^2=-1, centrality in 3D, dual)
6. outermorphism (rotor normalization, rotation, det=1)
7. adjoint (a.F_bar(b) = F(a).b, det(FG) = det(F)det(G))

* test(cheatsheet): move validation to test/ so pytest collects it (pygae#506)

Per review: examples/Terminal/ is not collected by CI (setup.cfg only
collects test_*.py). Move to test/test_cheatsheet.py so assertions
actually run in CI.

Also adds a comment in section 5 clarifying that the dual is computed
manually via I^{-1} (Iinv+ convention), which differs from galgebra's
built-in dual() that uses I+ by default.

* chore: remove unused Symbol and Matrix imports

Co-authored-by: utensil <utensilcandel@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
utiberious added a commit to utiberious/galgebra that referenced this pull request Apr 2, 2026
* docs: add 0.6.0 changelog entries

Groups new entries by: features, bug fixes, examples/docs, tests/maintenance.

Features: Cl() kingdon interface (pygae#550, closes pygae#524), Mv.__rtruediv__
(pygae#543, closes pygae#512), shirokov_inverse/hitzer_inverse (pygae#530).

Bugs: interop dual mode contamination (pygae#556, closes pygae#555), norm() Abs
wrapping (pygae#554, closes pygae#522), is_versor() improvement (pygae#536, closes pygae#533).

Examples/docs: sundial + cheatsheet tests (pygae#549+pygae#557, closes pygae#506),
coords tutorial (pygae#551), README ops (pygae#548, closes pygae#523).

Tests/maintenance: lt.matrix() regression tests (pygae#558, closes pygae#461),
extra-cdot regression test (pygae#545), er_blade + ReciprocalFrame refactors
(pygae#552+pygae#553), CI fix (pygae#535).

* docs: add missing issue link for pygae#551 entry

* docs: add changelog entry for pygae#560 (Lt callable zero fix)

* docs: move Lt zero fix into bug group, use issue pygae#540 as reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The sundial problem and a cheat sheet by Russell Goyder

2 participants