Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add graphical output to operation tables #8598

Closed
rbeezer mannequin opened this issue Mar 24, 2010 · 50 comments
Closed

Add graphical output to operation tables #8598

rbeezer mannequin opened this issue Mar 24, 2010 · 50 comments

Comments

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented Mar 24, 2010

Operation tables can be output as grids with color or grayscale squares representing the different elements of the algebraic structure. Adding these into sage.matrix.operation_table.OperationTable would be a nice self-contained project for someone looking for a project involving plotting and graphics. Despite the localized nature of the project, it would see wide applicability throughout Sage. Look for stubs in the source code,

I'm pretty sure Mathematica does this for groups (Cayley table), but I can't get Wolfram Alpha or MathWorld to cough it up again for me now that I want it.

Component: graphics

Keywords: plotting, cayley table

Author: Bruno Edwards

Branch/Commit: da8a8f5

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/8598

@rbeezer rbeezer mannequin added c: graphics labels Mar 24, 2010
@rbeezer rbeezer mannequin assigned williamstein Mar 24, 2010
@DaveWitteMorris
Copy link
Member

comment:1

The basic functionality can be obtained from matplotlib by using matrix_plot:

sage: def color_table(OT, cmap):
....:     return matrix_plot(matrix(OT._table), cmap=cmap)

sage: import matplotlib.cm
sage: from sage.matrix.operation_table import OperationTable
sage: OT = OperationTable(SymmetricGroup(3), operation=operator.mul)
sage: color_table(OT, matplotlib.cm.gist_rainbow)
Launched png viewer for Graphics object consisting of 1 graphics primitive

However, this picture has an unwanted border with tick marks, and the names of group elements should (optionally) be put in the boxes. See the multiplication tables created by Group Explorer for what the output should look like.

As in Group Explorer, there should be an option to organize the elements of the group by the cosets of a subgroup H (and use the same color for all elements of each coset), but that could be moved to a separate ticket if it turns out to be difficult.

This project will require an understanding of matplotlib and basic abstract algebra (groups, subgroups, and cosets). It will only be useful for fairly small groups, so there should not be any need for clever optimizations. The source code for OperationTable has stubs for color_table() and gray_table(), but only the color_table method is needed, because gray-scale output can be obtained by choosing a grayscale colormap.

@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 13, 2021

comment:4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 1, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 24, 2022

comment:9

I've just opened a PR here #109

Haven't contributed to sage before so please let me know if I've done anything wrong / need to do anything else!

@Bruno-TT Bruno-TT mannequin added the s: needs review label Oct 24, 2022
@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 24, 2022

comment:11

Replying to Dave Morris:

The basic functionality can be obtained from matplotlib by using matrix_plot:

sage: def color_table(OT, cmap):
....:     return matrix_plot(matrix(OT._table), cmap=cmap)

sage: import matplotlib.cm
sage: from sage.matrix.operation_table import OperationTable
sage: OT = OperationTable(SymmetricGroup(3), operation=operator.mul)
sage: color_table(OT, matplotlib.cm.gist_rainbow)
Launched png viewer for Graphics object consisting of 1 graphics primitive

However, this picture has an unwanted border with tick marks, and the names of group elements should (optionally) be put in the boxes. See the multiplication tables created by Group Explorer for what the output should look like.

As in Group Explorer, there should be an option to organize the elements of the group by the cosets of a subgroup H (and use the same color for all elements of each coset), but that could be moved to a separate ticket if it turns out to be difficult.

This project will require an understanding of matplotlib and basic abstract algebra (groups, subgroups, and cosets). It will only be useful for fairly small groups, so there should not be any need for clever optimizations. The source code for OperationTable has stubs for color_table() and gray_table(), but only the color_table method is needed, because gray-scale output can be obtained by choosing a grayscale colormap.

There's no immediately obvious way to implement coset functionality here, since the OperationTable type supports all magmas rather than just groups - I think we should have a separate ticket for this.

@dimpase
Copy link
Member

dimpase commented Oct 25, 2022

comment:12

Replying to @Bruno-TT:

I've just opened a PR here #109

Haven't contributed to sage before so please let me know if I've done anything wrong / need to do anything else!

Could you please add a branch here? We don't take PRs on github yet.

To do so, upload a public ssh key from an ssh keypair to your github account, then
you can push your branch, whose name should have the correct prefix, u/gh-Bruno-TT/...

$ git remote add trac git@trac.sagemath.org:sage.git
$ git checkout -b u/gh-Bruno-TT/ticket_8598 # or something like this
$ git puch trac HEAD

and add the branch name, i.e. u/gh-Bruno-TT/ticket_8598 into Branch: field.

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 31, 2022

Author: gh-Bruno-TT

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 31, 2022

Commit: d1e138e

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 31, 2022

Branch: u/gh-Bruno-TT/ticket_8598

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Oct 31, 2022

Dependencies: Matrix, matrix_plot, sage.plot.text

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

1f20e6aRevert "improve imports + doc tweaks"

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Changed commit from 16b368e to 1f20e6a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Changed commit from 1f20e6a to 99bbbf2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

99bbbf2fix docstring formatting

@dimpase
Copy link
Member

dimpase commented Dec 19, 2022

comment:30

OK, looks good enough now. I took out the documentation hack - now it looks not necessary, in fact (no idea why)

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Dec 19, 2022

Changed commit from 99bbbf2 to 29db1b4

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Dec 19, 2022

New commits:

29db1b4doc tweaks

@Bruno-TT
Copy link
Mannequin

Bruno-TT mannequin commented Dec 19, 2022

Changed branch from u/dimpase/ticket_8598 to public/ticket_8598

@dimpase
Copy link
Member

dimpase commented Dec 19, 2022

comment:32

OK, fine, thanks.

@vbraun
Copy link
Member

vbraun commented Jan 5, 2023

comment:33

Merge failure on top of:

c729945 Trac #34891: fixing some E502 in tensor, dynamics, modules, plot, numerical

bc832cb Trac #34889: Installation guide: On WSL, clear /mnt/c stuff from PATH

3570a9a Trac #34881: allow to remove no constraints

0ceb103 Trac #34878: MixedIntegerLinearProgram.add_constraint: Option to return row indices, fix handling of empty constraints

df74efb Trac #34859: sagelib: Remove unnecessary import of typing_extensions

b6a76d7 Trac #34857: bump giac's GIAC_MIN_VERSION to 1.9

6a8155e Trac #34854: molien_series() should not use GAP's VirtualCharacter

dddf3ca Trac #34853: sage-env: Fix misconfiguration of pip

6f63102 Trac #34847: modernize some for loops in cython files

9ffabc7 Trac #34844: removal of some unused imports about string conversion

4b50bc2 Trac #34843: pep8 cleanup in ore_polynomial_element.pyx

bdd14ce Trac #34837: fix E502 in some pyx files

172ad73 Trac #34836: fix E271 and E272 in rings/ and schemes/

3d86126 Trac #34749: Packages dsdp, scip_sdp

64d232b Trac #31329: Update scipoptsuite to 8.0.2 (now open source!), rename to scip

2dcafb3 Trac #34839: Support tox 4

ad68f15 Trac #34648: Developer's guide: warn the transition to GitHub and add links to the transition guide

acebbc1 Trac #34824: do not include parent in hash of parking functions

9a7b631 Trac #34818: Error when defining differentials over GCA's with relations.

bb63c58 Trac #34807: Add Construction of Hadamard matrices up to order 664

8a0b16d Trac #34804: Deprecate sage.interfaces is_...Element functions

80f8f95 Trac #34793: clean 3 files inside modular

b0cc282 Trac #34547: Interfaces: use more lazy imports, restore top-level functions maxima_console etc.

5905da7 Trac #33915: inseparable elliptic-curve isogenies

98b22eb Trac #32826: scalar-multiplication endomorphisms of elliptic curves

4f11a75 Trac #8744: Improve add_edge in BipartiteGraph to make it independent from the current coloring

08aa2f8 Trac #33842: Upgrade python to 3.11

75bedf9 Trac #34783: various details in combinat/

33fa871 Trac #34742: Optional package soplex (dependency of scip)

f84915f Trac #34726: Optional package papilo (dependency of scip)

e5cf1c0 Trac #34694: Bug in ExteriorAlgebra interior product

ebb9b61 Trac #34416: Manage pexpect logs created during doctesting

962177a Trac #33907: interfaces/expect.py random test failure

6640924 Trac #16522: lazy_import doesn't resolve properly when indirectly imported

2114066 Updated SageMath version to 9.8.beta6

invalid dependency: Matrix

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 6, 2023

Changed commit from 29db1b4 to da8a8f5

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 6, 2023

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

ce4e9affailling doctest fix
b6accf1docstring fix proof-of-concept
66ea558remove todo
d85cf19improve imports + doc tweaks
4acfcdbdoc plot attempt
5dae2e2fix for PLOT - just call sphinx_plot
26e12bdpleasing linters, removing sage.all
ed974b6Revert "improve imports + doc tweaks"
7ed7e6cfix docstring formatting
da8a8f5doc tweaks

@dimpase
Copy link
Member

dimpase commented Jan 6, 2023

comment:35

rebased over beta6. Looks OK now.

@vbraun
Copy link
Member

vbraun commented Jan 14, 2023

comment:36

The merge script doesn't understand the Dependencies: Matrix, matrix_plot, sage.plot.text. You can only depend on other ticket numbers, meaning that that ticket needs to be closed (merged succesfully).

@dimpase
Copy link
Member

dimpase commented Jan 14, 2023

Changed dependencies from Matrix, matrix_plot, sage.plot.text to none

@dimpase
Copy link
Member

dimpase commented Jan 14, 2023

comment:37

OK, that's just a misunderstanding by the ticket author (1st ticket). I overlooked that this field was filled. There are no deps in our sense here.

@vbraun
Copy link
Member

vbraun commented Jan 29, 2023

Changed branch from public/ticket_8598 to da8a8f5

@vbraun vbraun closed this as completed in fa77574 Jan 29, 2023
vbraun pushed a commit that referenced this issue Mar 26, 2023
…e fixes

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
We remove the module-level dependency of `sage.matrix.operation_table`
on `matplotlib` and `sage.plot` and fix some code style issues.
<!-- Why is this change required? What problem does it solve? -->
It fixes a modularization regression introduced in #8598.
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes #1337" -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [ ] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: #35153
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik, Travis Scrimshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants