Dynamics with Surfaces
The surface-dynamics
package for SageMath
provides functionality related to interval exchange transformations,
translation surfaces, mapping classes and more. It is based on SageMath and
relies heavily on:
- GMP for arbitrary precision arithmetic
- PARI/GP for number field computations
- GAP for finite groups representation and permutation groups
- PPL (Parma Polyhedra Library) and LattE (Lattice point Enumeration) for polytope computations
Here is an example session showcasing some of the computations that are possible with surface-dynamics. For further examples, please consult our documentation.
sage: from surface_dynamics.all import *
sage: o = Origami('(1,2)', '(1,3)')
sage: o
(1,2)(3)
(1,3)(2)
sage: o.sum_of_lyapunov_exponents()
4/3
sage: o.lyapunov_exponents_approx() # abs tol 0.05
[0.33441823619678734]
sage: o.veech_group()
Arithmetic subgroup with permutations of right cosets
S2=(2,3)
S3=(1,2,3)
L=(1,2)
R=(1,3)
sage: q = QuadraticStratum(1, 1, 1, 1)
sage: q.orientation_cover()
H_5(2^4)
sage: q.components()
[Q_2(1^4)^hyp]
sage: c = q.components()[0]
sage: c
Q_2(1^4)^hyp
sage: c.orientation_cover_component()
H_5(2^4)^odd
sage: AbelianStrata(genus=3).list()
[H_3(4), H_3(3, 1), H_3(2^2), H_3(2, 1^2), H_3(1^4)]
sage: O = OrigamiDatabase()
sage: q = O.query(("stratum", "=", AbelianStratum(2)), ("nb_squares", "=", 5))
sage: q.number_of()
2
sage: for o in q:
....: print("%s\n- - - - - - - -" % o)
(1)(2)(3)(4,5)
(1,2,3,4)(5)
- - - - - - - -
(1)(2)(3,4,5)
(1,2,3)(4)(5)
- - - - - - - -
sage: Q12_reg = QuadraticStratum(12).regular_component()
sage: Q12_reg.lyapunov_exponents_H_plus(nb_iterations=2**20) # abs tol 0.05
[0.6634, 0.4496, 0.2305, 0.0871]
sage: Q12_reg.lyapunov_exponents_H_minus(nb_iterations=2**20) # abs tol 0.05
[1.0000, 0.3087, 0.1192]
The easiest and recommended way to install surface-dynamics is to install sage-flatsurf which includes surface-dynamics. Please follow the instructions for Linux and macOS or the instructions for Windows.
If you have a working copy of SageMath already you can also try to install
surface-dynamics from PyPI using pip
.
$ sage -pip install surface-dynamics
While surface-dynamics can be built and developed with pip
like any other
Python package, we strongly recommend that you install pixi
to get all the dependencies right.
Once you have cloned this source repository, you can use the following commands:
pixi run test
to build surface-dynamics and run its test suitespixi run sage
to build surface-dynamics and spawn SageMath with the local surface-dynamics availablepixi run doc
to build and preview the documentation
What is pixi?
pixi is a tool for developers based on conda & conda-forge so that we can all use the same workflows in the same defined environments.
pixi allows us to ship a very opinionated setup to developers, namely a number of opinionated scripts with corresponding tested (and opinionated) dependencies.
This makes the whole development experience much more reliable and reproducible, e.g., the CI on GitHub Pull Requests runs with the exact same setup, so if something fails there, you can just run the CI command to hopefully get exactly the same behavior locally.
How do I use pixi?
If you have not used pixi before, the most relevant pixi command is:
pixi run TASK
Run pixi task list
to see the available tasks.
All tasks are defined in the pyproject.toml
file and most are used somewhere in
our GitHub Continuous Integration setup, see .github/workflows/.
Why don't we add all these dependencies normally to pyproject.toml?
The dependency handling that Python provides when it comes to binary dependencies is not very robust. At the moment, pixi/conda solve this problem in a much better way.
Can I use pip and other tools with pixi?
More experienced developers may not want to use the provided tasks. You can also just use the curated list of dependencies that pixi provides and drop into a shell with these dependencies installed. For example, to run the doctests directly, you could:
pixi shell -e dev
pip install -e .
sage -tp surface_dynamics
If you have tried out surface-dynamics, we are thrilled to learn about your experiences. If you ran into any problems or have suggestions for improvement, please create an issue.
If you want to contribute to surface-dynamics, pull requests are always welcome ❤️
We are also happy to walk you through the process personally if you are unsure how to get started. Feel free to reach out in the #flatsurf stream on Zulip in any case.
See AUTHORS for a list of authors or visit our zenodo page.
surface-dynamics is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2.0 of the License, or (at your option) any later version. See https://www.gnu.org/licenses/.
If you have used this project to prepare a publication please cite us as described on our zenodo page.
The first release of surface-dynamics
as a SageMath SPKG happened on the
30th of July 2015. Refer to our Releases
Page for the latest
releases.
- Julian Rüth's contributions to this project have been supported by the Simons Foundation Investigator grant of Alex Eskin.