Skip to content

docs(examples): add tutorial for extracting coordinates from multivectors#551

Merged
utensil merged 2 commits intopygae:masterfrom
utiberious:fix/issue-483-coords-example
Mar 31, 2026
Merged

docs(examples): add tutorial for extracting coordinates from multivectors#551
utensil merged 2 commits intopygae:masterfrom
utiberious:fix/issue-483-coords-example

Conversation

@utiberious
Copy link
Copy Markdown
Contributor

Summary

Adds a tutorial example showing the various ways to extract scalar coefficients from a multivector, addressing the question in issue 483.

Replaces the closed PR 547 which incorrectly added a new method shadowing the existing components().

Fixes #483

Methods demonstrated

  • blade_coefs(blade_list): get coefficients for specific basis blades (the primary tool for numeric work)
  • components(): split into single-blade Mv objects
  • get_coefs(grade): coefficients of all blades of a specific grade
  • scalar() / get_grade(r): extract specific grades
  • Symbolic coordinates with subs() and float() for numeric conversion

Changes

  • examples/Terminal/extracting_coords.py: New tutorial example

Test plan

  • python examples/Terminal/extracting_coords.py runs without errors
  • No code changes, example only

@utensil
Copy link
Copy Markdown
Member

utensil commented Mar 30, 2026

Thanks for this! Two things:

  1. The issue specifically asked for this to be in the tutorial docs (https://galgebra.readthedocs.io/en/latest/tutorials/algebra.html), not just a terminal example. Could you add it there instead?
  2. Line 76: [float(v) for v in vals] shadows the v multivector from earlier. Rename to x or val.

- Add 'Extracting coordinates' section after grade extraction in
  tutorial_algebra.ipynb covering blade_coefs(), components(),
  scalar(), and grade()
- Fix variable shadowing (v -> val) in terminal example
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@utiberious
Copy link
Copy Markdown
Contributor Author

Addressed both:

  1. Added an "Extracting coordinates" section to examples/ipython/tutorial_algebra.ipynb (the readthedocs tutorial). It covers:

    • blade_coefs([ex, ey, ez]) for specific basis blades
    • float() for numeric conversion
    • components() for single-blade decomposition
    • blade_coefs() (no args), scalar(), and grade(k) for general multivectors
  2. Fixed variable shadowing: float(v) -> float(val) in the terminal example.

All 24 notebook cells pass nbval. Pushed in 78976c3.

@utensil utensil merged commit a860be1 into pygae:master Mar 31, 2026
6 checks passed
@utensil utensil added component: docs Documentation state: needs changelog Needs a changelog entry before the next release. Remove this label when the changelog is done. labels Mar 31, 2026
@utensil utensil added this to the 0.6.0 milestone Mar 31, 2026
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).
utiberious added a commit to utiberious/galgebra that referenced this pull request Apr 1, 2026
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
* 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

component: docs Documentation state: needs changelog Needs a changelog entry before the next release. Remove this label when the changelog is done.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting coords of multivector

2 participants