Sage Days 96

August 13-16 2018

Sage days 96 to be held at the Fields Institute for the program Teichmüller Theory and its Connections to Geometry, Topology and Dynamics. The schedule is available on the Fields website. This wiki page will be updated with all documents relative to the workshop (worksheets, tutorials, demos, nice pictures, etc).

In order to assist to the workshop you are asked to come with your laptop (though you are also welcome without laptop). It would also be great if you could make sure that Sage is installed on it (see "Sage Installation" below).

Workshop dinner on thursday (Sky Dragon on Dundas and Spadina).

Worksheets

Participant projects

Projects for the week

Projects that were done during the week:

Sage Installation

The installation procedure depends on your operating system:

Installing flipper, snappy, flatsurf and surface_dynamics

We will be interested in these Sage days to four Python-Sage modules that provide many tools to work with surfaces and 3-dimensional manifolds

These packages are installed through pip. Depending how you did install Sage you might run in different kind of complications.

Generic Installation

This installation would work in most situations. Though if you happen to be in one of the specific situations listed below, just jump to that section.

Mac OS X specifics

If you are using the binaries for Mac OS X, the computer might complain with could not fetch URL .... In that situation, you can try the two following solutions

  1. You do have Xcode installed with the command line tools. In this case you can recompile the Python shipped with Sage with SSL support with
     $ sage -i openssl
     $ sage -f python2 
    Then go back to the instructions "Installing flipper, snappy, flatsurf and surface_dynamics".
  2. The alternative to option 1 is to download each package independently: and then install them via
     $ sage -pip install flipper-0.12.3.tar.gz
     $ sage -pip install surface_dynamics-0.4.0.tar.gz
     $ sage -pip install snappy-2.6.tar.gz
     $ sage -pip master.zip

Ubuntu 16.04 with ppa

If you run Ubuntu 16.04 and you install Sage with the ppa then do

$ sage -sh
(sage-sh)$ pip install flipper --user
(sage-sh)$ pip install surface_dynamics --user
(sage-sh)$ pip install snappy --user
(sage-sh)$ exit

(The sage -sh command brings you to a special environment where you have access to Sage Python)

Ubuntu >= 18.04 and Debian >= 8.0 packages

If you happen to have installed the packages sagemath and sagemath-jupyter from your package manager in Debian/Ubuntu then you would need to do

$ source /usr/share/sagemath/bin/sage-env
$ pip install flipper --user
$ pip install surface_dynamics --user
$ pip install snappy --user

For the installation of flatsurf, follows the instruction at https://github.com/videlec/sage-flatsurf and replace any instance of sage -pip by pip.

Archlinux

Do

$ sage -sh
(sage-sh)$ pip2 install flipper --user
(sage-sh)$ pip2 install surface_dynamics --user
(sage-sh)$ pip2 install snappy --user
(sage-sh)$ exit
$

For the installation of flatsurf, follows the instruction at https://github.com/videlec/sage-flatsurf and replace any instance of sage -pip by pip.

Windows

Before following the generic instruction do

(sage-sh) $ apt-cyg install libcrypt-devel
(sage-sh) $ apt-cyg install liblapack-devel

Organizers and participants

See the Fields Institute webpage.

Questions and answers

Saul: Why does snake_case have that name?
Vincent: See the discussion here - https://en.wikipedia.org/wiki/Snake_case.

Derrick: If I'm running Sage on a Windows installation, how to I make Jupyter launch in the correct directory?
Derrick: [question 41348 on ask](https://ask.sagemath.org/question/41348/sagemath-windows-81-launching-jupyter-from-another-directory-or-drive/)

Aaron: Does Python have a built-in way to iterate over the product of two iterators that don't necessarily terminate?
Vincent: No, but Sage does have a [cantor_product](https://doc.sagemath.org/html/en/reference/misc/sage/misc/mrange.html). Example:

   1 P = sage.misc.mrange.cantor_product(NN, repeat=2)
   2 for _ in range(10):
   3     print(next(P))

produces (0, 0), (1, 0), (0, 1), (2, 0), (1, 1), (0, 2)... Although the feature isn't documented, iterating up to (0, n) only requires n calls to NN.next().

Rex: Let L be a list. To get a new list K with the elements of L in reverse order, we can write K = L[::-1] What is each the colons and the -1 telling Sage to do exactly?
Vincent: These are [Python slices](https://docs.python.org/2.3/whatsnew/section-slices.html)

Aaron: How do we specify a quadratic differential?
Vincent: triangulated surface, where the lengths live in some arithmetic. (Floating point numbers are not numbers!)

Saul: is there a way to start with floating point surface, and quickly rule out "small" components (eg no short cylinders)?

Rex: I'm running something that's printing a list of integers as it runs. Is there any way to tell Sage to truncate the old output (I'm only interested in seeing how far it has gone along)?
Vincent: If you do

from IPython.display import clear_output

then you can use the function clear_output() to remove everything in the output. Though this slows down a lot the computation.

The following previous answer does not work (in Jupyter)

from sys import stdout
from time import sleep
stdout.write('hello\r')
sleep(1)   # wait for 1 sec
stdout.write('bouh \r')
sleep(1)   # wait for 1 sec
stdout.write('next \r')

The character '\r' means carriage return and go back the the begining of the line so that you can erase what you just wrote. But with this method, it only works with one line being updated.

Rex: Do different packages ever have any dependencies such that uninstalling one package causes problems for others? For example, if I uninstall flipper at some later point in time (say to reinstall an updated version), could this cause issues with other packages that might rely on flipper?
Saul: Yes, this could happen. Package management is tricky.

Rex: Also, is there a simpler way to update a package than uninstalling and reinstalling it?
Saul:Something like

pip install <PACKAGE> --user --upgrade 

Troubles and bug reports

SageMath documentation on archlinux

operating system: archlinux sage version: 8.2 installation: from the package manager pacman problem: the documentation with the question mark is not working properly in the console. This has been reported to https://bbs.archlinux.org/viewtopic.php?id=239525

Archlinux pip installation problem

The local installation (done via "pip install X --user") are different within Sage and within Python Namely

$ pip2 install X --user
$ sage -sh -c "pip2 install X --user"

The reason is that PYTHONUSERBASE is set by sage-env before Sage is launched. A patch has been sent to Antonio Rojas (who is the maintainer). And it is now solved!

Misleading comment in cygwin version

Reported at https://groups.google.com/forum/#!topic/sage-devel/wdjj8ur5m9c

Numbering mismatch in surface_dynamics

Rex: the labeling of the square tiles in an origami is mismatched with the labelings of the vertices in its associated graph. The squares start with 1,2,3,... but the graph vertices begin with 0,1,2,...

Documentation requests

The example for Graph.vertex_cover makes it look like the method outputs a plot of the graph with the vertex cover colored. https://doc.sagemath.org/html/en/reference/graphs/sage/graphs/graph.html#sage.graphs.graph.Graph.vertex_cover

There's no unambiguous description of what the EllipticCurve constructor does. https://doc.sagemath.org/html/en/constructions/elliptic_curves.html

The documentation for installing Sage packages under Windows is very misleading. The page

opens with the sentence, "The major known caveat to the current version of the SageMath Windows install is that it is not currently possible to install Sage optional packages," with no indication that it is possible to install Sage pip packages. The Windows Sage shell has a similarly misleading warning: "Do not use this for installing Sage packages using 'sage -i' ", with no indication that sage pip is usable.

The documentation for flatsurf.TranslationSurface.delaunay_single_join is somewhat lacking.

We used to coordinate using a pad on https://mensuel.framapad.org/ that is now closed.

days96 (last edited 2018-10-29 18:04:33 by vdelecroix)