Releases: sagemath/sage
10.0
Release Notes
This release includes
- support for GCC 13; major package upgrades
- new optimization solvers via CVXpy, major new features in combinatorics and algebra
What's Changed
- Fix deployment of docs to netlify by @tobiasdiez in #34984
- Fix W391 linter issues by @tobiasdiez in #35109
tox.ini
(fedora-33): Do not setIGNORE_MISSING_SYSTEM_PACKAGES=no
by @mkoeppe in #35126- Mark unstable tests in
klyachko.py
due to #32773 by @tornaria in #35058 - ci-linux: Remove unmaintained local-conda runs by @mkoeppe in #35125
- Fix Cygwin CI after #32841 by @mkoeppe in #35052
- Add default devcontainer using conda by @tobiasdiez in #35072
- Improve camera positioning for threejs by @kwankyu in #34960
- Show explicit formulas in documentation of
WeierstrassIsomorphism
by @yyyyx4 in #34967 - Compute matrix kernels modulo composites by @yyyyx4 in #34968
- Cross-link matrix methods
image
andcolumn_space
by @Sandstorm831 in #34972 SignedPermutation
should allow iterables as input by @Sandstorm831 in #34974- Add
.torsion_basis()
method toEllipticCurve_finite_field
by @yyyyx4 in #34982 - Add construction of strongly regular digraph by @MatteoCati in #34986
- Trac role to GitHub by @roed314 in #35015
- Add doctest for #20847 by @mezzarobba in #34963
- Add
.twists()
toEllipticCurve_finite_field
by @yyyyx4 in #34981 - Add new skew Hadamard matrices by @MatteoCati in #34985
- Fix doctests to support numpy 1.24 by @tornaria in #34994
- Fix bug due to UB in conversion from python
int
toZZ
(python 3.11, 32 bit, gcc12) by @tornaria in #34997 - Enable dependabot for github action updates by @tobiasdiez in #34999
- Add doctest for #20846 by @mezzarobba in #35001
- Add doctest for #16031 by @mezzarobba in #35003
- Speed up some methods for quasimodular forms ring elements by @DavidAyotte in #35004
- Fix some "cannot" by @fchapoton in #35007
- Add doctest for #13569 by @mezzarobba in #35010
sage.{categories,matrix,structure}
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35012- Add
limit=
argument toInteger.prime_divisors()
by @yyyyx4 in #35019 - Use NTL's
MinPolyMod()
for more rings by @yyyyx4 in #34966 qqbar.clear_denominators
: crude but fast alternative algorithm by @mezzarobba in #34961- Support for tachyon >= 0.99.2 by @tornaria in #34995
- Implement check for Lorentzian polynomials #28252 by @fchapoton in #35021
- Remove upstream urls from
checksums.ini
that point to trac by @roed314 in #35023 - Fix usage of
verbose
with positional argument by @alexjbest in #35024 - Implement
__getitem__
and alias weight methods for quasimodular forms by @DavidAyotte in #35025 - gitignore another (temporary) autoconf file by @alexjbest in #35027
sage.schemes
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35033- Make
_multiple_x_*()
methods work for all n≠0 by @yyyyx4 in #35035 - Document argument
is_open
inManifoldSubset.complement
anddifference
by @egourgoulhon in #35040 - Add Hadamard matrices up to order 1000 by @MatteoCati in #35059
- A bijectionist's toolkit by @mantepse in #35060
- Add notes about recent changes on
KnotInfo
by @soehms in #35063 - Removing some unused imports by @fchapoton in #35064
- Upgrade eclib to 20221012 by @alexjbest in #35067
- Conform to doc requirements so that the docs look more beautiful by @alexjbest in #35069
- Document sage installation method with pip by @zovelsanj in #35070
- Combinatorial polyhedron: move list of pairs to dedicated class by @kliem in #35073
- Add ABCs
CommutativePolynomial
,MPolynomial_libsingular
,InfinitePolynomial
; deprecateis_Polynomial
,is_MPolynomial
by @mkoeppe in #35076 - Remove 'docker' from the names of the Docker images published on ghcr.io by @mkoeppe in #35079
- Add
is_supergreedy()
to linear extensions by @Sandstorm831 in #34970 - Deprecate constructing number-field fractional ideals via orders'
.ideal()
method by @yyyyx4 in #34979 is_prime
for ideals uses factorization, can be VERY slow by @yyyyx4 in #34980- Integer-valued polynomial ring by @fchapoton in #34988
- Drinfeld modules by @kryzar in #35026
- Fix the method
monomials_of_degree
by @DavidAyotte in #35043 - Convert result of multivariate polynomial evaluation into correct parent by @mezzarobba in #35045
sage.{coding,groups}
: Replace imports from sage.*.all for namespace packages by @mkoeppe in #35099- Remove direct use of
setup.py sdist
, add targetsmake SPKG-sdist
by @mkoeppe in #35104 sage.{functions,interfaces,symbolic}
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35105sage.{arith,crypto,databases,dynamics,lfunctions,quadratic_forms}
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35106sage.{finance,interacts,libs,numerical,stats,tests}
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35107- Deprecate
is_FiniteField
etc., makesage.rings.finite_rings
a namespace package by @mkoeppe in #35119 - Fix use of
sig_on()
/sig_off()
inCBF.integral()
by @mezzarobba in #35044 - Implementing q-commuting Laurent polynomials. by @tscrim in #35054
- Upgrade scipy to 1.10.1 by @mkoeppe in #35082
build/pkgs/pcre
: Remove by @mkoeppe in #35083- Upgrade polymake to 4.9 by @mkoeppe in #35085
- Move
single_valued
method of MZV to auxiliary F ring by @fchapoton in #35086 - Use enum for face iterator status by @kliem in #35087
sage.{algebras,combinat,matroids}
: Replace imports from sage.*.all for namespace packages by @mkoeppe in #35090- Fix and activate W391 in
pyx
files by @fchapoton in #35091 - Update GAP to 4.12.2 by @dimpase in #35093
- To determine
GAP_SO
,sage.env
looks forlibgap.so
but it should look forlibgap.so*
by @dimpase in #35094 - Simplicial set group by @miguelmarco in #35097
sage.{topology,homology}
: Replace imports fromsage.*.all
for namespace packages by @mkoeppe in #35098- New ABC
sage.structure.element.NumberFieldElement
,deprecate is_NumberFieldElement
by @mkoeppe in #35100 scip_backend
: Remove use of deprecatedsage.ext.memory_allocator
by @mkoeppe in #35101- Fix all pycodestyle E303 warnings in all folders
c*
by @fchapoton in #35151 - Update msolve to 0.4.9 by @dimpase in #35159
- Fix a slow doctest in
matrix_integer_dense_hnf.py
by @tornaria in #35162 - Fix the documentation for the so matrix Lie algebra by @tscrim in #35163
- Compute the matrix of an isogeny on a given n-torsion subgroup by @yyyyx4 in #35164
- Activate W293 and E714 in
pyx
files by @fchapoton in #35165 - Fix bug in
is_eulerian
by @dcoudert in #35170 - Speedup of Poset characteristic polynomial by @trevorkarn in #35173
- Cleaning and enhancement t...
9.8
Release Notes
Sage 9.8 was released on Feb 11, 2023 (changelog), 402 tickets/PRs merged. This is the first release after our move from Trac to GitHub and
- adds support for Python 3.11, removes support for GCC older than 8
- includes major new solvers, major package upgrades
What's Changed
Merged in sage-9.8.beta0:
#12696: Lorenz Panny: rename .rational_reconstruct() to .rational_reconstruction() for consistency [Reviewed by Kwankyu Lee]
#17965: Frédéric Chapoton: Uniformize the API to compute the inverse of an element [Reviewed by Travis Scrimshaw]
#20467: Frédéric Chapoton: stackoverflow in Maxima integral [Reviewed by Nils Bruin]
#29619: Matthias Koeppe: Matrix and Components should have a sparse iterator [Reviewed by Eric Gourgoulhon]
#30229: Matthias Koeppe: Submodules of TensorFreeModule defined by the symmetries of a Components object [Reviewed by Eric Gourgoulhon]
#30241: Matthias Koeppe: New implementation class FiniteRankDualFreeModule [Reviewed by Eric Gourgoulhon]
#32297: Linden Disney-Hogg: Abel-Jacobi map on Riemann surfaces [Reviewed by Nils Bruin, Travis Scrimshaw]
#32669: Dennis Jahn: Adding upper and lower Bruhat cones of M. Dyer to sage/combinat/root_system/reflection_group_real.py [Reviewed by Frédéric Chapoton, Travis Scrimshaw]
#32921: Gabriel F. Lipnik: k-recursive sequences with inhomogeneities [Reviewed by Clemens Heuberger]
#33002: Sébastien Labbé: Method tikz of polyhedron class can now return an object of type TikzPicture [Reviewed by Laith Rastanawi]
#33062: Matthias Koeppe: GH Actions (docker): Run a job for "make build-local" first, cache image for job "make build" [Reviewed by Dima Pasechnik]
#33093: John Palmieri: 5 doctests failing related to external program octave [Reviewed by Frédéric Chapoton]
#33431: Matthias Koeppe: Category of submodules of sage.modules.free_module.FreeModule_ambient_pid [Reviewed by Travis Scrimshaw]
#33613: Matthias Koeppe: Add pip packages to conda environments, add missing conda.txt files [Reviewed by Dima Pasechnik]
#33640: Frédéric Chapoton: sage fails to factor some easy expressions [Reviewed by David Lowry-Duda]
#33981: Matthias Koeppe: latte_int: ExponentialSubst.h:62:3: error: ISO C++17 does not allow dynamic exception specifications [Reviewed by John Palmieri]
#34118: Oscar Benjamin, Matthias Koeppe: Update sympy to 1.11.1 [Reviewed by Matthias Koeppe, Antonio Rojas, Eric Gourgoulhon]
#34195: Matthias Koeppe: sage.geometry.polyhedron: More # optional - sage.rings.number_field [Reviewed by Jonathan Kliem]
#34203: Matthias Koeppe: Find and uninstall broken installed SPKGs and wheels [Reviewed by John Palmieri]
#34228: Matthias Koeppe: tox -e docker-...-incremental [Reviewed by Dima Pasechnik]
#34235: Matthias Koeppe: Error in comparing two Symbolic Ring elements [Reviewed by Travis Scrimshaw]
#34242: Julian Rüth: Update docker build [Reviewed by MartinPepin]
#34266: Matthias Koeppe: Drop support for GCC < 8 in Sage 9.8 [Reviewed by Dima Pasechnik]
#34282: Sebastian Oehms, Kwankyu Lee: Make feature TeXFile check latex first [Reviewed by Kwankyu Lee, Sebastian Oehms]
#34287: Frédéric Chapoton: modernize super in crystals and asymptotics [Reviewed by Travis Scrimshaw]
#34290: Frédéric Chapoton: fix some W391 [Reviewed by Travis Scrimshaw]
#34313: David Coudert: pycodestyle cleanup in strongly_regular_db.pyx (part 3) [Reviewed by Kwankyu Lee]
#34320: Frédéric Chapoton: fix E251 in schemes [Reviewed by David Coudert]
#34323: Frédéric Chapoton: fix E251 in groups [Reviewed by David Coudert]
#34342: Frédéric Chapoton: fix various suggestions by lgtm [Reviewed by David Coudert]
#34345: Trevor K. Karn: Method to get cells in horizontal/vertical border strip [Reviewed by Travis Scrimshaw]
#34350: Travis Scrimshaw: speed up powers of lazy Taylor series [Reviewed by Martin Pepin]
#34379: Travis Scrimshaw: Implement a hook to access free (graded) resolutions [Reviewed by Kwankyu Lee]
#34393: Frédéric Chapoton: add method "tensor_factors" to tensor products [Reviewed by Matthias Koeppe, Travis Scrimshaw]
#34412: Travis Scrimshaw: q-commuting polynomials [Reviewed by Frédéric Chapoton]
#34427: Matthias Koeppe: TensorFreeModule.isomorphism_with_fixed_basis [Reviewed by Eric Gourgoulhon]
#34449: Matthias Koeppe: Add package pyproject_metadata [Reviewed by François Bissey]
#34451: Matthias Koeppe: sage.tensor: Canonicalize sym, antisym [Reviewed by Eric Gourgoulhon]
#34453: Travis Scrimshaw: Tensor products of commutative algebras do not know they are commutative rings [Reviewed by Frédéric Chapoton]
#34466: Lorenz Panny: fix various linter errors [Reviewed by Frédéric Chapoton]
#34467: Lorenz Panny: fix random doctest failure in EllipticCurveHom_velusqrt [Reviewed by Kwankyu Lee]
#34474: Eric Gourgoulhon: Make FiniteRankFreeModule.tensor_module(0, 1) return the dual [Reviewed by Matthias Koeppe]
#34478: Matthias Koeppe: pynormaliz: Add distros information for conda, arch [Reviewed by Isuru Fernando]
#34484: Matthias Koeppe: Methods quotient, quotient_module are not the same for some modules from sage.modules [Reviewed by John Palmieri, Travis Scrimshaw]
#34490: Thierry Monteil: sage --package clean
command to remove outdated source tarballs [Reviewed by David Coudert]
#34491: Matthias Koeppe: Upgrade igraph to 0.9.10 [Reviewed by David Coudert]
#34494: Frédéric Chapoton: better monomials in shuffle algebras [Reviewed by Travis Scrimshaw]
#34495: Matthias Koeppe: Construction for invariant/equivariant submodules [Reviewed by Travis Scrimshaw]
#34498: Matthias Koeppe: Update igraph, python_igraph to 0.10.x [Reviewed by David Coudert]
#34505: Frédéric Chapoton: using items in indexed_elements.pyx [Reviewed by Travis Scrimshaw]
#34509: Matthias Koeppe: Make IndexedFreeModuleElement compatible with collections.abc, change method support to return a SupportView [Reviewed by Travis Scrimshaw]
#34510: Trevor K. Karn: Add to check for fixed total/length in IntegerVector [Reviewed by Travis Scrimshaw]
#34514: David Roe: Incorrect decomposition type for relative number fields [Reviewed by Travis Scrimshaw]
#34519: Marc Mezzarobba: Fix + extend msolve interface [Reviewed by Matthias Koeppe]
#34527: Trevor K. Karn: Make Composition
s into a collections.abc.Sequence
[Reviewed by Travis Scrimshaw, Matthias Köppe]
#34535: Trevor K. Karn: Segfault when floor dividing in infinite polynomial ring [Reviewed by Travis Scrimshaw]
#34541: Frédéric Chapoton: enhance free dendriform algebras [Reviewed by Travis Scrimshaw]
#34561: Jan Groenewald: Documentation: There is no package in debian/ubuntu called openssh [Reviewed by Matthias Koeppe]
#34568: Frédéric Chapoton: rename example to QuaternionicProjectivePlane [Reviewed by John Palmieri]
Merged in sage-9.8.beta1:
#21129: Paul Fili, Holly Krieger, Jing Guo: Arakelov-Zhang pairing of rational maps [Reviewed by Alexander Galarraga]
#25046: Lorenz Panny: Add warning for is_prime(n) that produce correct but unexpected output [Reviewed by Kwankyu Lee]
#31664: Matthias Koeppe: Add package msolve 0.4.4 (multivariate polynomial system solver) [Reviewed by Marc Mezzarobba]
#32483: Matthias Koeppe: Remove workarounds for packages that use flit_core or poetry_core as build system [Reviewed by John Palmieri]
#33805: Dima Pasechnik: use Homebrew's primecount [Reviewed by Matthias Koeppe]
#33812: Matthias Koeppe: Refactor distributions sagemath-{objects,categories} through sagemath-{environment,repl} [Reviewed by Kwankyu Lee]
#33850: Sophia Elia: Unstable doctests in equivariant Ehrhart methods [Reviewed by Matthias Koeppe]
#33999: Xavier Caruso: Reduced charpoly for skew polynomials [Reviewed by Travis Scrimshaw, Frédéric Chapoton]
#34110: Matthias Koeppe: numpy 1.23.x [Reviewed by Dima Pasechnik, John Palmieri]
#34212: Jing Guo: log_embedding
for number field elements [Reviewed by Alexander Galarraga]
#34272: Matthias Koeppe: Update pip to 22.2.2 [Reviewed by Kwankyu Lee]
#34314: David Coudert: pycodestyle cleanup in strongly_regular_db.pyx (part 4) [Reviewed by Matthias Koeppe]
#34344: Matthias Koeppe: Update setuptools 63.4.3, setuptools_wheel 65.x, tomlkit 0.11.4, importlib_resources 5.9.0, importlib_metadata 4.12.0, distlib 0.3.6, hatchling 1.10.0, pathspec 0.10.1 [Reviewed by John Palmieri]
#34358: David Coudert: pycodestyle cleanup in src/sage/graphs/generic_graph.py (part 4) [Reviewed by Kwankyu Lee]
#34375: Travis Scrimshaw: Replace sage.algebras.yangian.GeneratorIndexingSet with cartesian_product [Reviewed by Matthias Koeppe]
#34383: Martin Rubey: revert for LazyTaylorSeries and LazySymmetricFunction is missing [Reviewed by Travis Scrimshaw]
#34392: David Coudert: pycodestyle cleanup in src/sage/graphs/generic_graph.py (part 5) [Reviewed by Matthias Koeppe]
#34409: Lorenz Panny: remove experimental warning for composite elliptic-curve isogenies [Reviewed by Kwankyu Lee]
#34413: Martin Rubey: implement derivatives of lazy series [Reviewed by Travis Scrimshaw]
#34422: Martin Rubey: implement functorial composition of lazy symmetric functions [Reviewed by Travis Scrimshaw]
#34423: Martin Rubey: implement arithmetic product of lazy symmetric functions [Reviewed by Travis Scrimshaw]
#34432: Samuel Lelièvre: Upgrade: jupyter-packaging 0.12.3 [Reviewed by Matthias Koeppe]
#34435: Trevor K. Karn: Add method to trim trailing zeros from IntegerVector [Reviewed by Travis Scrimshaw]
#34448: Matthias Koeppe: Put tensor modules of FiniteRankFreeModule in Modules().TensorProducts() [Reviewed by Eric Gourgoulhon]
#34454: Matthias Koeppe: sage --package create: Add option --source wheel [Reviewed by Kwankyu Lee]
#34462: Kwankyu Lee: Uniformize the headline: finite rings [Reviewed by Matthias Koeppe]
#34465: John Palmieri: Invalid escape sequence in special.py [Reviewed by Dima Pasechnik]
#34468: Frédéric C...
9.7
Release Notes
Sage 9.7 was released on Sep 19, 2022 (changelog), 549 tickets (PRs) merged, 92 contributors. This release
- removes support for GCC older than 6.3, removes support for Python 3.7
- adds new code in algebra, number theory, elliptic curves; major package upgrades; new developer tools
9.6
Release Tour
Sage 9.6 was released on May 15, 2022 (changelog), 497 tickets (PRs) merged. This release includes
- support for GCC 12; major package upgrades
- major improvements to user interface and graphics; new developer tools
A total of 83 people were involved as authors or reviewers of code contributions to Sage 9.6.
Here is an overview of some of the main changes in this version.
User interface, plotting and graphics
JupyterLab 3.3
JupyterLab, the latest web-based interactive development environment for notebooks, code, and data, is slated to replace the now-classic Jupyter notebook interface. The version of JupyterLab in the Sage distribution has been upgraded to the major new version 3.3. #32069, #33607
After ./sage -i jupyterlab_widgets
, you can run it using
./sage -n jupyterlab
Also two new interface variants are provided:
./sage -n nbclassic
and
./sage -n retrolab
LaTeX displays in JupyterLab
Users of Sage in JupyterLab got used to expressions displayed at center in the LaTeX display mode. For compatibility with displays in classic Jupyter, we decided to change the behavior so that now expressions are displayed aligned left by default.
If you belong to the minority preferring centered displays, you can set your preference by
dm = get_display_manager()
dm.preferences.align_latex = 'center' # or 'left'
in the ~/.sage/init.sage
script.
Interactive graph editing with phitigra
With the new optional package phitigra (use ./sage -i phitigra
to install), graphs can be edited by interactively placing vertices, edges, etc. This works both in the classic Jupyter notebook and in JupyterLab. It can also be used to make animations (see the demo notebook at https://github.com/jfraymond/phitigra for examples). Done in #30540 and #33639.
Hyperbolic plots
- Added the ability to choose the hyperbolic model for hyperbolic plots. #22081
Graphics with TikZ
The TikzPicture
module which was developed in the slabbe package for more than 5 years is now in Sage. This was done in ticket #20343. The module is within the new file sage/misc/latex_standalone.py
and its documentation in the reference manual is available here: https://doc.sagemath.org/html/en/reference/misc/sage/misc/latex_standalone.html. Below are some usage examples.
First example shows that it takes any tikz picture string as input:
sage: from sage.misc.latex_standalone import TikzPicture
sage: s = '\\begin{tikzpicture}\n\\draw[->,green,very thick](0,0) -- (1,1);\\end{tikzpicture}'
sage: t = TikzPicture(s)
sage: t # in Jupyter, rich representation will show the image instead
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[->,green,very thick](0,0) -- (1,1);\end{tikzpicture}
\end{document}
sage: path_to_file = t.pdf() # and opens the image in a viewer
Of course, conversion to pdf format necessitates pdflatex
or lualatex
. If lualatex
is available it uses it in preference to pdflatex
because it handles better the very big pictures in terms of memory limits.
One can provide a local filename to save to, or convert the image to other formats (using pdftocairo or imagemagick external packages):
sage: path_to_file = t.pdf('file.pdf') # when providing a filename, it just saves
# the file locally, does not open in a viewer
sage: path_to_file = t.png() # conversion to png
sage: path_to_file = t.svg() # to svg
sage: path_to_file = t.tex() # print the tex source to a file
Another example with graphs where additional usepackage are necessary to compile the image correctly:
sage: from sage.misc.latex_standalone import TikzPicture
sage: g = graphs.PetersenGraph()
sage: t = TikzPicture(latex(g), standalone_config=["border=4mm"], usepackage=['tkz-graph'])
sage: t # in Jupyter, rich representation will show the image instead
\documentclass[tikz]{standalone}
\standaloneconfig{border=4mm}
\usepackage{tkz-graph}
\begin{document}
\begin{tikzpicture}
\definecolor{cv0}{rgb}{0.0,0.0,0.0}
\definecolor{cfv0}{rgb}{1.0,1.0,1.0}
\definecolor{clv0}{rgb}{0.0,0.0,0.0}
\definecolor{cv1}{rgb}{0.0,0.0,0.0}
---
65 lines not printed (3695 characters in total).
Use print to see the full content.
---
\Edge[lw=0.1cm,style={color=cv6v8,},](v6)(v8)
\Edge[lw=0.1cm,style={color=cv6v9,},](v6)(v9)
\Edge[lw=0.1cm,style={color=cv7v9,},](v7)(v9)
%
\end{tikzpicture}
\end{document}
sage: _ = t.pdf() # or t.png() or t.svg()
sage: from sage.misc.latex_standalone import TikzPicture
sage: V = [[1,0,1],[1,0,0],[1,1,0],[0,0,-1],[0,1,0],[-1,0,0],[0,1,1],[0,0,1],[0,-1,0]]
sage: P = Polyhedron(vertices=V).polar()
sage: s = P.projection().tikz([674,108,-731],112)
sage: t = TikzPicture(s)
sage: _ = t.pdf() # or t.png() or t.svg()
The module also contains a class Standalone
, from which the class TikzPicture
inherits:
sage: from sage.misc.latex_standalone import Standalone
sage: s = Standalone('Hello World', usepackage=['amsmath'], standalone_config=['beamer=true','border=1mm'])
sage: s # in Jupyter, rich representation will show the image instead
\documentclass{standalone}
\standaloneconfig{beamer=true}
\standaloneconfig{border=1mm}
\usepackage{amsmath}
\begin{document}
Hello World
\end{document}
sage: _ = s.pdf() # or s.png() or s.svg()
Another example using Standalone
with a tableau:
sage: P = Permutations(10)
sage: p = P.random_element()
sage: p
[3, 10, 1, 9, 5, 6, 7, 2, 8, 4]
sage: t = p.to_tableau_by_shape([3,3,3,1])
sage: t
[[2, 8, 4], [5, 6, 7], [10, 1, 9], [3]]
sage: s = Standalone(latex(t), standalone_config=["border=1mm"])
sage: s
\documentclass{standalone}
\standaloneconfig{border=1mm}
\begin{document}
{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}} }
\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3}
\lr{2}&\lr{8}&\lr{4}\\\cline{1-3}
\lr{5}&\lr{6}&\lr{7}\\\cline{1-3}
\lr{10}&\lr{1}&\lr{9}\\\cline{1-3}
\lr{3}\\\cline{1-1}
\end{array}$}
}
\end{document}
sage: _ = s.pdf() # or s.png() or s.svg()
In a next step, a method tikz()
will be added to graphs, polytopes, posets, etc. to return an object of type TikzPicture
see #33002.
Complex plots
The complex plotting package phase_mag_plot has been incorporated into Sage. Now complex_plot
allows contouring, tiling, and matplotlib
-compatible colormaps. This was added in ticket #33416.
To use a colormap, one can pass in a string as in
sage: complex_plot((x - 5)*sqrt(x), (-10, 10), (-10, 10), cmap='twilight')
Contouring or tiling are enabled through keyword options. To look smooth, it's typically necessary to plot the function on additional points through the use of plot_points
. This looks like
sage: complex_plot((x - 5)*sqrt(x), (-10, 10), (-10, 10), cmap='twilight', plot_points=500, contoured=True)
sage: complex_plot((x - 5)*sqrt(x), (-10, 10), (-10, 10), cmap='twilight', plot_points=500, tiled=True)
Linear algebra
NumPy integration
The new classes Matrix_numpy_integer_dense
and Vector_numpy_integer_dense
implement matrices and vectors with 64-bit integer entries backed by numpy
arrays. #32465.
As a first application, several methods of GenericGraph
that return matrices, such as adjacency_matrix
, now accept keyword arguments that can select the matrix implementation. #33377, #33387, #33388, #33389
sage: graphs.PathGraph(5).adjacency_matrix(sparse=False, implementation='numpy')
[0 1 0 0 0]
[1 0 1 0 0]
[0 1 0 1 0]
[0 0 1 0 1]
[0 0 0 1 0]
sage: type(_)
<class 'sage.matrix.matrix_numpy_integer_dense.Matrix_numpy_integer_dense'>
CombinatorialFreeModule improvements
Performing sums and similar constructions for CombinatorialFreeModule
have been made faster. [#33267](https://github.com/sagemath/sage...
9.5
Release Tour
SageMath version 9.5 was released on Jan 30, 2022 (changelog), 663 tickets (PRs) merged, 94 contributors. This release includes
- support for Apple M1, Linux distributions using glibc ≥ 2.34, and system Python 3.10
- new code from 2021 Google Summer of Code projects in algebra and number theory
Symbolics
Changes to symbolic expressions
symbolic_expression
is now able to create vectors and matrices of symbolic expressions for more general inputs. #16761
For example, if the input is a list or tuple of lists/tuples/vectors:
sage: M = symbolic_expression([[1, x, x^2], (x, x^2, x^3), vector([x^2, x^3, x^4])]); M
[ 1 x x^2]
[ x x^2 x^3]
[x^2 x^3 x^4]
sage: M.parent()
Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring
- Symbolic expressions can no longer be called with positional arguments. #14270
This was deprecated since Sage 4.0, although a bug prevented the deprecation warning from being issued in Sage versions 8.4 to 9.3. #32319
Instead of (x+1)(2)
, write either (x+1)(x=2)
, or (x+1).subs(x=2)
, or ((x+1).function(x))(2)
.
Interface to Mathics, a free implementation of the Wolfram language
Sage now has an optional package providing Mathics, a free (open-source) general-purpose computer algebra system featuring Mathematica-compatible syntax and functions, and an interface to it.#31778
Linear Algebra
- The Cholesky decomposition for sparse RDF/CDF matrices now uses a specialized fast algorithm when cvxopt is available. #13674
- The
is_hermitian()
method for sparse RDF/CDF matrices now uses a small tolerance by default to mitigate numerical issues. This brings it to parity with its dense counterpart. #33031
Manifolds
The full list of changes is available in this changelog.
De Rham cohomology and characteristic classes
The de Rham cohomology has been made an algebra (#32270).
The method characteristic_class
for vector bundles is now outdated and replaced by the method characteristic_cohomology_class
. This change reflects the difference between characteristic classes, seen as natural transformations, and characteristic cohomology classes in a more rigorous way (see #29581). The previous usability and syntax remains intact. Among other things, the following has been changed:
- The performance of computing characteristic forms has been improved significantly by using a Faddeev-LeVerrier-like algorithm.
- The characteristic forms of Pontryagin/Chern/Euler classes w.r.t. to a given connection are cached in order to speed up computations of all characteristic forms w.r.t. the same connection.
Furthermore, new features have been added. For example, characteristic cohomology classes now form an algebra:
sage: M = Manifold(4, 'M')
sage: E = M.vector_bundle(2, 'E', field='complex')
sage: R = E.characteristic_cohomology_class_ring(); R
Algebra of characteristic cohomology classes of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M
sage: R.gens()
[Characteristic cohomology class (c_1)(E) of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M,
Characteristic cohomology class (c_2)(E) of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M]
sage: c_1, c_2 = R.gens()
Therefore, elements can be added and multiplied:
sage: c_1 + c_2
Characteristic cohomology class (c_1 + c_2)(E) of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M
sage: c_1 * c_1
Characteristic cohomology class (c_1^2)(E) of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M
Additive, multiplicative and Pfaffian cohomology classes are now related to the generators of the characteristic cohomology class ring via additive/multiplicative sequences:
sage: ch = E.characteristic_cohomology_class('ChernChar'); ch
Characteristic cohomology class ch(E) of the Differentiable complex vector bundle E -> M of rank 2 over the base space 4-dimensional differentiable manifold M
sage: ch == 2 + c_1 + c_1^2 / 2 - c_2 # additive sequence of exp(x)
True
As for the tangent bundle of a manifold, as long as an orientation and a metric is provided, the characteristic form of the Euler class (and therefore all Pfaffian classes) w.r.t. the Levi-Civita connection is now computed automatically (previously, a compatible curvature form matrix had to be provided by the user):
sage: M.<x,y> = manifolds.Sphere(2, coordinates='stereographic')
sage: g = M.metric()
sage: nab = g.connection()
sage: nab.set_immutable()
sage: TM = M.tangent_bundle()
sage: e = TM.characteristic_cohomology_class('Euler'); e
Characteristic cohomology class e(TS^2) of the Tangent bundle TS^2 over the 2-sphere S^2 of radius 1 smoothly embedded in the Euclidean space E^3
sage: e_form = e.get_form(nab)
sage: e_form
Mixed differential form e(TS^2, nabla_g) on the 2-sphere S^2 of radius 1 smoothly embedded in the Euclidean space E^3
sage: e_form.display_expansion()
e(TS^2, nabla_g) = 2/(pi + pi*x^4 + pi*y^4 + 2*pi*x^2 + 2*(pi + pi*x^2)*y^2) dx∧dy
Automatic coordinate change in curve plots
The method plot
of curves is now allowed to perform a coordinate change to make the plot in terms of the coordinates specified via the argument chart
, in case the curve is not known in these coordinates (#32578). For example, a cardioid is defined in terms of polar coordinates:
sage: E.<r, phi> = [[EuclideanSpace]](coordinates='polar')
sage: c = E.curve((1 + cos(phi), phi), (phi, 0, 2*pi))
sage: c.display()
(0, 2*pi) → E^2
phi ↦ (r, phi) = (cos(phi) + 1, phi)
and its plot in terms of Cartesian coordinates can now be obtained simply by
sage: c.plot(chart=E.cartesian_coordinates(), aspect_ratio=1)
The above command has triggered the computation of the curve's expression in terms of Cartesian coordinates:
sage: c.display()
(0, 2*pi) → E^2
phi ↦ (r, phi) = (cos(phi) + 1, phi)
phi ↦ (x, y) = (cos(phi)^2 + cos(phi), (cos(phi) + 1)*sin(phi))
Internal code improvements and bug fixes
Various improvements have been performed in the internal code, some of them in view of SageMath modularization:
- faster generation of non-redundant indices (#32318)
- unnecessary uses of symbolic functions removed from
sage.tensor.modules
(#32415) - doctests involving
SR
marked optional insage.tensor.modules
(#32712) sage.tensor.modules
made independent fromsage.manifolds
(#32708).
Some bugs have been fixed: #31781, #32457, #32355, #32929.
Number theory
Logarithms
- Logarithms modulo composite integers are now dramatically faster in some important cases (such as prime-power moduli). #32375
- Logarithms in binary finite fields now use index calculus instead of generic-group algorithms when appropriate (via PARI's fflog()). #32842
Binary quadratic forms
- Binary quadratic forms' .solve_integer() method now uses PARI's qfbsolve() instead of a brute-force search, which is often exponentially faster. #32782
Prime counting
- Prime counting and related functions, in particular prime_pi, are now implemented using external libraries, primecount and primesieve. This improved performance and fixed a long-standing bug #24960
Elliptic curves and isogenies
9.4
Release Tour
SageMath 9.4 was released on Aug 22, 2021 (changelog), 442 tickets (PRs) merged, 73 contributors. This release
- adds support for GCC 11, removes support for Python 3.6
- includes major advances in symbolics, convex and differential geometry, knot theory, coding theory
Symbolics
Extended interface with SymPy
The SymPy package has been updated to version 1.8.
SageMath has a bidirectional interface with SymPy. Symbolic expressions in Sage provide a _sympy_
method, which converts to SymPy; also, Sage attaches _sage_
methods to various SymPy classes, which provide the opposite conversion.
In Sage 9.4, several conversions have been added. Now there is a bidirectional interface as well for matrices and vectors. #31942
sage: M = matrix([[sin(x), cos(x)], [-cos(x), sin(x)]]); M
[ sin(x) cos(x)]
[-cos(x) sin(x)]
sage: sM = M._sympy_(); sM
Matrix([
[ sin(x), cos(x)],
[-cos(x), sin(x)]])
sage: sM.subs(x, pi/4) # computation in SymPy
Matrix([
[ sqrt(2)/2, sqrt(2)/2],
[-sqrt(2)/2, sqrt(2)/2]])
Work is underway to make SymPy's symbolic linear algebra methods available in Sage via this route.
Callable symbolic expressions, such as those created using the Sage preparser's f(...) = ...
syntax, now convert to a SymPy Lambda
. #32130
sage: f(x, y) = x^2 + y^2; f
(x, y) |--> x^2 + y^2
sage: f._sympy_()
Lambda((x, y), x**2 + y**2)
Sage has added a formal set membership function element_of for use in symbolic expressions; it converts to a SymPy's Contains
expression. #24171
Moreover, all sets and algebraic structures (Parent
s) of SageMath are now accessible to SymPy by way of a wrapper class SageSet
, which implements the SymPy Set API. #31938
sage: F = Family([2, 3, 5, 7]); F
Family (2, 3, 5, 7)
sage: sF = F._sympy_(); sF
SageSet(Family (2, 3, 5, 7)) # this is how the wrapper prints
sage: sF._sage_() is F
True # bidirectional
sage: bool(sF)
True
sage: len(sF)
4
sage: sF.is_finite_set # SymPy property
True
Finite or infinite, we can wrap it:
sage: W = WeylGroup(["A",1,1])
sage: sW = W._sympy_(); sW
SageSet(Weyl Group of type ['A', 1, 1] (as a matrix group acting on the root space))
sage: sW.is_finite_set
False
sage: sW.is_iterable
True
sage: sB3 = WeylGroup(["B", 3])._sympy_(); sB3
SageSet(Weyl Group of type ['B', 3] (as a matrix group acting on the ambient space))
sage: len(sB3)
48
Some parents or constructions have a more specific conversion to SymPy. #31931, #32015
sage: ZZ3 = cartesian_product([ZZ, ZZ, ZZ])
sage: sZZ3 = ZZ3._sympy_(); sZZ3
ProductSet(Integers, Integers, Integers)
sage: (1, 2, 3) in sZZ3
sage: NN = NonNegativeIntegers()
sage: NN._sympy_()
Naturals0
sage: (RealSet(1, 2).union(RealSet.closed(3, 4)))._sympy_()
Union(Interval.open(1, 2), Interval(3, 4))
sage: X = Set(QQ).difference(Set(ZZ)); X
Set-theoretic difference of
Set of elements of Rational Field and
Set of elements of Integer Ring
sage: X._sympy_()
Complement(Rationals, Integers)
sage: X = Set(ZZ).difference(Set(QQ)); X
Set-theoretic difference of
Set of elements of Integer Ring and
Set of elements of Rational Field
sage: X._sympy_()
EmptySet
See Meta-ticket #31926: Connect Sage sets to SymPy sets
ConditionSet
Sage 9.4 introduces a class ConditionSet for subsets of a parent (or another set) consisting of elements that satisfy the logical "and" of finitely many predicates. #32089
sage: in_small_oblong(x, y) = x^2 + 3 * y^2 <= 42
sage: SmallOblongUniverse = ConditionSet(QQ^2, in_small_oblong)
sage: SmallOblongUniverse
{ (x, y) ∈ Vector space of dimension 2 over Rational Field : x^2 + 3*y^2 <= 42 }
sage: parity_check(x, y) = abs(sin(pi/2*(x + y))) < 1/1000
sage: EvenUniverse = ConditionSet(ZZ^2, parity_check); EvenUniverse
{ (x, y) ∈ Ambient free module of rank 2 over the principal ideal
domain Integer Ring : abs(sin(1/2*pi*x + 1/2*pi*y)) < (1/1000) }
sage: SmallOblongUniverse & EvenUniverse
{ (x, y) ∈ Free module of degree 2 and rank 2 over Integer Ring
Echelon basis matrix:
[1 0]
[0 1] : x^2 + 3*y^2 <= 42, abs(sin(1/2*pi*x + 1/2*pi*y)) < (1/1000) }
The name ConditionSet
is borrowed from SymPy. In fact, if the given predicates (condition) are symbolic, a ConditionSet
can be converted to a SymPy ConditionSet
; the _sympy_
method falls back to creating a SageSet
wrapper otherwise.
symbolic_expression(lambda x, y: ...)
Sage 9.4 has added a new way to create callable symbolic expressions. #32103
The global function symbolic_expression
now accepts a callable such as those created by lambda
expressions. The result is a callable symbolic expression, in which the formal arguments of the callable are the symbolic arguments.
Example:
symbolic_expression(lambda x,y: x^2+y^2) == (SR.var("x")^2 + SR.var("y")^2).function(SR.var("x"), SR.var("y"))
This provides a convenient syntax in particular in connection to ConditionSet
.
Instead of
sage: predicate(x, y, z) = sqrt(x^2 + y^2 + z^2) < 12 # preparser syntax, creates globals
sage: ConditionSet(ZZ^3, predicate)
one is now able to write
sage: ConditionSet(ZZ^3, symbolic_expression(lambda x, y, z:
....: sqrt(x^2 + y^2 + z^2) < 12))
Convex geometry
ABC for convex sets
Sage 9.4 has added an abstract base class ConvexSet_base (as well as abstract subclasses ConvexSet_closed
, ConvexSet_compact
, ConvexSet_relatively_open
, ConvexSet_open
) for convex subsets of finite-dimensional real vector spaces. The abstract methods and default implementations of methods provide a unifying API to the existing classes Polyhedron_base
, ConvexRationalPolyhedralCone
, LatticePolytope
, and PolyhedronFace
. #31919, #31959, #31990, #31993
Several methods previously only available for Polyhedron_base
instances, are now available for all convex sets. The method an_affine_basis
returns a sequence of points that span by affine linear combinations the affine hull, i.e., the smallest affine subspace in which the convex set lies. The method affine_hull
returns the latter as a polyhedron. The method affine_hull_projection (renamed from affine_hull
in Sage 9.1) computes an affine linear transformation of the convex set to a new ambient vector space, in which the image is full-dimensional. The generalized method also provides additional data: the right inverse (section map) of the projection. #27366, #31963, #31993
As part of the ConvexSet_base
API, there are new methods for point-set topology such as is_open
, relative_interior
, and closure
. For example, taking the relative_interior
of a polyhedron constructs an instance of RelativeInterior, a simple object that provides a __contains__
method and all other methods of the ConvexSet_base
API. #31916
sage: P = Polyhedron(vertices=[(1,0), (-1,0)])
sage: ri_P = P.relative_interior(); ri_P
Relative interior of
a 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices
sage: (0, 0) in ri_P
True
sage: (1, 0) in ri_P
False
ConvexSet_base
is a subclass of the new abstract base class Set_base. #32013
This makes various methods that were previously only defined for sets constructed using the Set
constructor available for polyhedra and other convex sets. As an example, we can now do:
sage: polytopes.cube().un...
9.3
Release Tour
SageMath 9.3 was released on May 9, 2021 (changelog), 679 tickets (PRs) merged, 112 contributors. This release includes
- support for macOS 11 "Big Sur"
- major package upgrades
Linear and multilinear algebra
Bär--Faddeev--LeVerrier algorithm for the Pfaffian of skew-symmetric matrices
According to https://arxiv.org/abs/2008.04247, the Pfaffian of skew-symmetric matrices over commutative torsion-free rings can be computed with a Faddeev--LeVerrier-like algorithm. This algorithm is now implemented under the weaker assumption of the base ring's fraction field being a QQ
-algebra (#30681). It leads to a significant increase of computational speed in comparison to the definition involving perfect matchings, which has been the only algorithm available in Sage so far.
Using the definition of the Pfaffian:
sage: A = matrix([(0, 0, 1, 0, -1, -2, -1, 0, 2, 1),
(0, 0, 1, -3/2, 0, -1, 1/2, 3, 3/2, -1/2),
(-1, -1, 0, 2, 0, 5/2, 1, 0, -2, 1),
(0, 3/2, -2, 0, 5/2, -1, 2, 0, -1, -3/2),
(1, 0, 0, -5/2, 0, 0, -1, 1/2, 1, -1),
(2, 1, -5/2, 1, 0, 0, 2, 1, 2, 1),
(1, -1/2, -1, -2, 1, -2, 0, 0, -3, -1),
(0, -3, 0, 0, -1/2, -1, 0, 0, 1/2, 1/2),
(-2, -3/2, 2, 1, -1, -2, 3, -1/2, 0, 1),
(-1, 1/2, -1, 3/2, 1, -1, 1, -1/2, -1, 0)])
sage: %%time
....: A.pfaffian(algorithm='definition')
CPU times: user 18.7 ms, sys: 0 ns, total: 18.7 ms
Wall time: 18.6 ms
817/16
With Bär--Faddeev--LeVerrier:
sage: A = matrix([(0, 0, 1, 0, -1, -2, -1, 0, 2, 1),
(0, 0, 1, -3/2, 0, -1, 1/2, 3, 3/2, -1/2),
(-1, -1, 0, 2, 0, 5/2, 1, 0, -2, 1),
(0, 3/2, -2, 0, 5/2, -1, 2, 0, -1, -3/2),
(1, 0, 0, -5/2, 0, 0, -1, 1/2, 1, -1),
(2, 1, -5/2, 1, 0, 0, 2, 1, 2, 1),
(1, -1/2, -1, -2, 1, -2, 0, 0, -3, -1),
(0, -3, 0, 0, -1/2, -1, 0, 0, 1/2, 1/2),
(-2, -3/2, 2, 1, -1, -2, 3, -1/2, 0, 1),
(-1, 1/2, -1, 3/2, 1, -1, 1, -1/2, -1, 0)])
sage: %%time
....: A.pfaffian(algorithm='bfl')
CPU times: user 554 µs, sys: 41 µs, total: 595 µs
Wall time: 599 µs
817/16
Other improvements
- Speedup access items in gf2e dense matrices: 29853
- Speedup conjugation of double dense matrices: 31283
- New Bunch-Kaufman block_ldlt() factorization for possibly indefinite matrices: 10332
- New numerically stable is_positive_semidefinite() method for matrices: 10332
Polyhedral geometry
New features
The Schlegel diagrams are now repaired (they previously broke convexity). Now, one specifies which facet to use to do the projection 30015:
sage: fcube = polytopes.hypercube(4)
sage: tfcube = fcube.face_truncation(fcube.faces(0)[0])
sage: tfcube.facets()[-1]
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 8 vertices
sage: sp = tfcube.schlegel_projection(tfcube.facets()[-1])
sage: sp.plot() # The proper Schlegel diagram is shown
A different values of position
changes the projection:
sage: sp = tfcube.schlegel_projection(tfcube.facets()[4],1/2)
sage: sp.plot()
Graphics3d Object
sage: sp = tfcube.schlegel_projection(tfcube.facets()[4],4)
sage: sp.plot()
Graphics3d Object
New features:
- 30704: Upgrade to Normaliz 3.8.9 and PyNormaliz 2.13
- 30946: Add "minimal=True" option to affine_hull_projection
- 30954: Implement a proper equality check for polyhedron representation objects
Implementation improvements
The zonotope construction got improved:
Before:
sage: from itertools import combinations
sage: cu = polytopes.cube()
sage: sgmt = [p.vector()-q.vector() for p,q in combinations(cu.vertices(),2)]
sage: sgmt2 = set(tuple(x) for x in sgmt)
sage: # %time polytopes.zonotope(sgmt) # killed due to memory overflow
sage: %time polytopes.zonotope(sgmt2)
CPU times: user 2.06 s, sys: 23.9 ms, total: 2.09 s
Wall time: 2.09 s
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 96 vertices
With 31038:
sage: from itertools import combinations
sage: cu = polytopes.cube()
sage: sgmt = [p.vector()-q.vector() for p,q in combinations(cu.vertices(),2)]
sage: sgmt2 = set(tuple(x) for x in sgmt)
sage: %time polytopes.zonotope(sgmt)
CPU times: user 138 ms, sys: 0 ns, total: 138 ms
Wall time: 138 ms
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 96 vertices
sage: %time polytopes.zonotope(sgmt2)
CPU times: user 58 ms, sys: 0 ns, total: 58 ms
Wall time: 57.6 ms
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 96 vertices
Improvements:
- 30040: Improve face iterator for simple/simplicial polytopes
There are also some bug fixes and other improvements. For more details see the release notes for optimization and polyhedral geometry software interactions in Sage.
Graph theory {#graph_theory}
Major improvements in the backends:
- 30777: Deleting edges
- 30665: Edge iterator and copy
- 30776: Subgraph and equality check
- 30753: Obtaining subgraphs.
- 31117, 31154: Breadth First Search
- 31129: Depth first search
- 31197: Use binary matrix data structure for bitsets.
Algebra
Power Series Ring
- The method
set_default_prec
is now deprecated since it led to unwanted behavior (see #18416 for details). If another default precision is needed, a new power series ring must be created:
sage: R.<x> = [[PowerSeriesRing]](QQ, default_prec=10)
sage: sin(x)
x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 + O(x^10)
sage: R.<x> = [[PowerSeriesRing]](QQ, default_prec=15)
sage: sin(x)
x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 - 1/39916800*x^11 + 1/6227020800*x^13 + O(x^15)
This change does not affect the behavior of its ring elements. Code that relies on this method needs to be updated.
- Inversion of power series ring elements now provides the correct parent: #8972
Other additions, improvements, and key bug-fixes
- Implement the symplectic derivation Lie algebra following https://arxiv.org/abs/2006.06064:
sage: lie_algebras.SymplecticDerivation(QQ, 4)
Symplectic derivation Lie algebra of rank 4 over Rational Field
- Implement the *-insertion algorithm from https://arxiv.org/abs/1911.08732:
sage: from sage.combinat.rsk import [[RuleStar]]
sage: p,q = [[RuleStar]]().forward_rule([1,1,2,2,4,4], [1,3,2,4,2,4])
sage: ascii_art(p,...
9.2
Release Tour
SageMath 9.2 was released October 24, 2020 (changelog), 727 tickets (PRs) merged, 134 contributors. This release includes
- Python 3 support expanded to 3.6, 3.7, 3.8, 3.9; Python 2 support dropped
- major package upgrades
Python 3 transition completed
SageMath 9.0 was the first version of Sage running on Python 3 by default. SageMath 9.1 continued to support Python 2.
Support for Python 2 removed
Sage 9.2 has removed support for Python 2. The Sage library now makes use of Python language and library features that are only available in Python 3.6 or newer; and large amounts of compatibility code have been removed.
However, note that this is unrelated to the minimal requirements for a source installation of the Sage distribution: Sage 9.2 is still able to build on a system that only provides Python 2.x or Python 3.5 or older. In this case, the SageMath distribution builds its own copy of Python 3.
Support for Python 3.6, 3.8, and 3.9 added
Sage 9.2 has added support for Python 3.8 in #27754 and Python 3.9 in #30184.
Sage 9.2 has also added support for Python 3.6. This allows Sage to use the system Python on some older Linux distributions that are still in widespread use in scientific computing, including centos-8
and fedora-{26,27,28}
(although Python 3.7.x packages are also available for these). See #29033 for more details.
Hence, Sage 9.2 conforms to (and exceeds) NumPy Enhancement Proposal 29 regarding Python version support policies.
If no suitable system Python, versions 3.6.x, 3.7.x, 3.8.x, or 3.9.x is found, Sage installs its own copy of Python 3 from source. The version of Python shipped with the Sage distribution has been upgraded from 3.7.3 to 3.8.5.
For developers: Using Python 3.6+ features in sagelib
Meta-ticket #29756 provides a starting point for a discussion of new features of the Python language and standard library to bring them to systematic use in sagelib. All features provided by Python 3.6 can be used immediately; features introduced in Python 3.7 or later will require backporting or a decision to drop the goal of supporting Python 3.6.
More details
- Trac tickets with keyword/component python3 in milestone 9.2
- See Python3-Switch for more details.
Package upgrades
The removal of support for Python 2 has enabled major package upgrades.
Major user-visible package upgrades below...
matplotlib
Dropping Python 2 support allowed us to make a major jump from matplotlib 2.2.5 to 3.3.1. See matplotlib's release notes for 3.0, 3.1, 3.2,3.3. In addition to improved output, this update will likely enable Sage developers to implement new features for plotting and graphics.
rpy2 and R
The rpy2 Python package is the foundation for SageMath's interface to R. Dropping Python 2 support allowed us to make the major upgrade from 2.8.2 to 3.3.5 in #29441; see the release notes for details.
We only did a minor upgrade of R itself in the Sage distribution, to 3.6.3, the latest in the 3.6.x series. Of course, if R 4.0.x is installed in the system, Sage will use it instead of building its own copy.
The SageMath developers are eager to learn from users how they use the SageMath-R interface, and what needs to be added to it to become more powerful. Let us know at sage-devel.
sphinx
Sage uses Sphinx to build its documentation. Sage 9.2 has updated Sphinx from 1.8.5 to 3.1.2; see Sphinx release notes for more information.
SymPy
SymPy has been updated from 1.5 to 1.6.2 in #29730, #30425. See the Release notes.
IPython, Jupyter notebook, JupyterLab
Dropping support for Python 2 allowed us to upgrade IPython from 5.8.0 to 7.13.0 in #28197. See the release notes for the 6.x and 7.x series.
We have also upgraded the Jupyter notebook from 5.7.6 to 6.1.1 in #26919; see the notebook changelog for more information. Besides, the pdf export of Jupyter notebooks has been fixed, so that LaTeX-typeset outputs are now rendered in the pdf file (#23330).
JupyterLab is now fully supported as an optional, alternative interface #30246, including interacts. To use it, install it first, using the command sage -i jupyterlab_widgets
. Then you can start it using ./sage -n jupyterlab
.
Normaliz
The optional package Normaliz, a tool for computations in affine monoids, vector configurations, lattice polytopes, rational cones, and algebraic polyhedra has been upgraded from 3.7.2 to 3.8.8, and PyNormaliz to version 2.12.
The upgrade adds support for incremental ("dynamic") computations, the computation of automorphism groups and refined triangulations of cones and polyhedra, and limited support for semiopen cones and polyhedra.
To install Normaliz and PyNormaliz, use sage -i pynormaliz
.
SageTeX
Updated to version 3.5, improving Python 3 compatibility, also updated to version 3.5 on CTAN.
sws2rst + usage example
In ticket #28838, the command sage -sws2rst
was resurrected via a new pip-installable package sage-sws2rst. It can be installed in Sage 9.2 using sage -i sage_sws2rst
.
Below is an example of usage. First we download a sage worksheet (.sws
) prepared for Sage Days 20 at CIRM (Marseille, 2010):
$ wget http://slabbe.org/Sage/2010-perpignan/CIRM_Tutorial_1.sws
$ ls
CIRM_Tutorial_1.sws
We translate the sws worksheet into a ReStructuredText syntax file (.rst
) using sage -sws2rst
. This creates also a directory of images:
$ sage -sws2rst CIRM_Tutorial_1.sws
Processing CIRM_Tutorial_1.sws
File at CIRM_Tutorial_1.rst
Image directory at CIRM_Tutorial_1_media
$ ls
CIRM_Tutorial_1_media CIRM_Tutorial_1.rst CIRM_Tutorial_1.sws
Then, we can check that it works properly by looking at the generated rst file. Alternatively, we can translate it to a basic html file using rst2html
:
$ rst2html.py CIRM_Tutorial_1.rst CIRM_Tutorial_1.html
CIRM_Tutorial_1.rst:176: (WARNING/2) Explicit markup ends without a blank line; unexpected unindent.
CIRM_Tutorial_1.rst:334: (WARNING/2) Inline strong start-string without end-string.
As seen above, there are few warnings sometimes because the translation made by sws2rst
is not 100% perfect, but most of it is okay:
$ firefox CIRM_Tutorial_1.html
Moreover, one can use the sage -rst2ipynb
script to translate the rst file obtained above to a Jupyter notebook:
`...
9.1
Release Tour
SageMath 9.1 was released on May 21, 2020 (changelog), 551 tickets (PRs) merged, 106 contributors. This is the last release supporting both Python 2 and 3 and contains major portability improvements.
Python 3 transition
SageMath 9.0 was the first version of Sage running on Python 3 by default. Sage 9.1 continues to support both Python 2 and Python 3.
In Sage 9.1, we have made some further improvements regarding Python 3 support. In particular, SageMath now supports underscored numbers PEP 515 (py3); the fix was done in Trac #28490:
sage: 1_000_000 + 3_000
1003000
The next release, SageMath 9.2, will remove support for Python 2. See Python3-Switch for more details.
Portability improvements, increased use of system packages
The SageMath distribution continues to vendor versions of required software packages ("SPKGs") that work well together.
In order to reduce compilation times and the size of the Sage installation, a development effort ongoing since the 8.x release series has made it possible to use many system packages provided by the OS distribution (or by the Homebrew or conda-forge distributions) instead of building SageMath's own copies.
This so-called "spkg-configure" mechanism runs at the beginning of a build from source, during the ./configure
phase.
(See the sage-devel threads "Brainstorming about Sage dependencies from system packages" (May 2017) and "conditionalise installation of many spkg's?" (Nov 2017) for its origins and Trac #24919 for its initial implementation.)
Sage 9.1 is adding many packages to this mechanism, including openblas
, gsl
, r
, boost
, libatomic
, cddlib
, tachyon
, nauty
, sqlite
, planarity
, fplll
, brial
, flintqs
, ppl
, libbraiding
, cbc
, gfan
, and python3
. As to the latter, SageMath will now make use of a suitable installation of Python 3.7.x in your system by setting up a venv (Python 3 virtual environment).
New in Sage 9.1 is also a database of system packages equivalent to our SPKGs. At the end of a ./configure
run, you will see messages like the following:
configure: notice: the following SPKGs did not find equivalent system packages: arb boost boost_cropped bzip2 ... yasm zeromq zlib
checking for the package system in use... debian
configure: hint: installing the following system packages is recommended and may avoid building some of the above [[SPKGs]] from source:
configure: $ sudo apt-get install libflint-arb-dev ... yasm libzmq3-dev libz-dev
configure: After installation, re-run configure using:
configure: $ ./config.status --recheck && ./config.status
We also use the same database to update our installation manual automatically.
Status of Cygwin support
Thanks to the hard work of our Cygwin maintainers, in particular during the 8.x release cycles, building Sage on Windows using Cygwin64 is fully supported. Sage 9.1 reflects this by integrating the instructions for building from source on Cygwin into its documentation.
For developers
For developers who wish to help improve the portability of SageMath, there is a new power tool: A tox configuration that automatically builds and tests Sage within Docker containers running various Linux distributions (ubuntu-trusty
through -focal
, debian-jessie
through -sid
, linuxmint-17
through -19.3
, fedora-26
through -32
, centos-7
and -8
, archlinux
, slackware-14.2
), each in several configurations regarding what system packages are installed. Thus, it is no longer necessary for developers to have access to a machine running fedora-29
, say, to verify whether the Sage distribution works there; instead, you just type:
tox -e docker-fedora-29-standard -- build ptest
The Dockerfile
s are generated automatically on the fly using the same database of system packages that provides information to users. See the tutorial for developers: Portability testing of the Sage distribution using Docker and the Sage distro-package database from the [Global Virtual SageDays 109](https://researchseminars.org/seminar/SageDays109) and the new section on "testing on multiple platforms" in the Developer's Guide for details.
An entry point for developers who wish to improve the testing infrastructure is the Meta-Ticket #29060: Add Dockerfiles and CI scripts for integration testing. See also the broader Meta-Meta-Ticket #29133.
For packagers
Although we now have continuous integration environments for testing the interaction of the Sage distribution with most major Linux distributions, we are still missing a few. Adding them will enable all Sage developers to check that their changes do not break things on your distribution.
Package updates
We have only made minor updates to standard packages:
- dateutil -- 2.8.1 (from 2.5.3)
- fplll -- 5.3.2 (from 5.2.1)
- fpylll -- 0.5.1.dev (from 0.4.1dev)
- freetype -- 2.10.1
- m4ri -- 20200115
- m4rie -- 20200115
- matplotlib -- 2.2.5 (from 2.2.4)
- ntl -- 11.4.3 (from 11.3.2)
- numpy -- 1.16.6 (from 1.16.1)
- openblas -- 0.3.9
- pkgconfig -- 1.5.1 (from 1.4.0)
- pyzmq -- 19.0.0 (from 18.1)
- sage_brial -- 1.2.5 (this is the python module of the brial package)
- scipy -- 1.2.3 (from 1.2.0)
- sympy -- 1.5 (from 1.4)
- traitlets -- 4.3.3
We expect to make larger package updates in the 9.2 release.
For developers
Preparing and testing package updates has become easier. The new optional field upstream_url
in checksums.ini
holds an URL to the upstream package archive, see for example build/pkgs/numpy/checksums.ini. Note that, like the tarball
field, the upstream_url
is a template; the word VERSION
is substituted with the actual version. The package can be updated by simply typing ./sage -package update numpy 3.14.59
; this will automatically download the archive and update the build/pkgs/
information.
Developers who wish to test a package update from a Trac branch before the archive is available on a Sage mirror can do so by configuring their Sage tree using ./configure \--enable-download-from-upstream-url
.
Every Sage developer now has easy access to "their own" set of 20 (40 for GitHub Pro accounts) two-core virtual machines running Linux, macOS, and Windows through GitHub Actions. To automatically test a branch on a multitude of our supported platforms, it suffices to create a fork of the sagemath/sage repository on GitHub, enable GitHub Actions, add the repository as a remote, create a tag and push the tag to the remote. After ... a ... while, your test results will be available --- like the ones at sagemath/sage Actions. We hope that this new testing infrastructure will reduce the FUD in the process of upgrading packages.
Polyhedral geometry
There is now a catalog for common polyhedral cones, e.g.
sage: cones.nonnegative_orthant(5)
5-d cone in 5-d lattice N
New features for polyhedra:
sage: P = polytopes.cube(intervals='zero_one') # obtain others than the standard cube
sage: P = matrix([[0,1,0],[0,1,1],[1,0,0]])*P # linear transformations
sage: it = P.face_generator() # a (fast and efficient) face generator
sage: next(it)
A 3-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 8 vertices
sage: next(it)
A -1-dimensional face of a Polyhedron in ZZ^3
sage: f = next(it)
sage: f.normal_cone() # normal cone for faces
A 1-dimensional polyhedron in ZZ^3 defined as the convex hull of 1 vertex and 1 ray
sage: P.an_affine_basis() # an_affine_basis and a_maximal_chain
[A vertex at (0, 0, 0),
A vertex at (1, 1, 0),
A vertex at (0, 0, 1),
A vertex at (0, 1, 0)]
sage: P = polytopes.hypercube(4)
sage: P.flag_f_vector(0,3) # flag_f_vector is exposed
64
Regarding the optional package normaliz
there are some news as well:
sage: P = polytopes.cube(intervals=[[0,1],[0,2],[0,3]], backend='normaliz')
sage: save(P, '/tmp/this_takes_very_long_so_we_save_it') # saving works now
sage: sage: P.h_star_vector() # compute the h_star_vector with normaliz
[1, 20, 15]
There are also some bug fixes and ot...
9.0
Release Tour
Sage 9.0 was released on Jan 1, 2020 (changelog), 348 tickets (PRs) merged, 116 contributors.
Python 3 transition
Just in time for the new decade, this is the first version of Sage running on Python 3 by default.
See Python3-Switch for more details
Three.js is the new default 3D viewer
Three.js has become the default viewer for 3D plots, in replacement of Jmol. Note that Jmol is still available, via the option _viewer='jmol' _ in the plot functions.
New plotting capabilities
Polyhedral Geometry
Sage uses a new algorithm to obtain the f-vector for polyhedra. This is the only memory efficient implementation for the f-vector at the time of writing and it is as fast or faster as other implementations:
sage: P = polytopes.permutahedron(7)
sage: %time P.incidence_matrix()
CPU times: user 679 ms, sys: 4.01 ms, total: 683 ms
Wall time: 682 ms
5040 x 127 dense matrix over Integer Ring (use the '.str()' method to see the entries)
sage: %time P.f_vector()
CPU times: user 901 ms, sys: 16 ms, total: 917 ms
Wall time: 916 ms
(1, 5040, 15120, 16800, 8400, 1806, 126, 1)
There is ongoing work to improve this implementation. It is implemented in the combinatorial polyhedron of P
, which is newly exposed:
sage: P.combinatorial_polyhedron()
A 6-dimensional combinatorial polyhedron with 126 facets
Sage has the classical construction of the 120-cell of Coxeter from 1969. This construction is much faster than to realize it as generalized permutahedron so that even without the optional package normaliz
you won't waste much time:
sage: %time P = polytopes.one_hundred_twenty_cell(backend='normaliz')
CPU times: user 942 ms, sys: 81.8 ms, total: 1.02 s
Wall time: 457 ms
sage: %time P = polytopes.one_hundred_twenty_cell(backend='field')
CPU times: user 15.9 s, sys: 87.2 ms, total: 16 s
Wall time: 16 s
sage: %time P = polytopes.one_hundred_twenty_cell(backend='normaliz', construction='as_permutahedron')
CPU times: user 18.6 s, sys: 137 ms, total: 18.8 s
Wall time: 18 s
Ehrhart polynomials are computable for lattice polytopes defined with base ring QQ
:
sage: P = polytopes.cube()*1/1
sage: P.base_ring()
Rational Field
sage: P.ehrhart_polynomial()
8*t^3 + 12*t^2 + 6*t + 1
Note that this computation requires optional package latte_int
or normaliz
.
There is a new method to obtain the boundary of complex simplicial polytopes:
sage: oc = polytopes.octahedron()
sage: oc.boundary_complex()
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 8 facets
Hyperplane arrangements have a new method center
:
sage: H.<x,y> = HyperplaneArrangements(QQ)
sage: A = H()
sage: A.center()
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 lines
There are also some bug fixes and other improvements. For more details see the release notes for optimization and polyhedral geometry softwares interactions in Sage.
Group Theory
Cubic Braid Groups
Factor groups of the Artin braid groups such that their generators have order three can easily be declared, now. They show a lot of their known properties:
sage: C4 = CubicBraidGroup(4)
sage: C4Cl = C4.as_classical_group(); C4Cl
Subgroup with 3 generators (
[ E(3)^2 0 0] [ 1 -E(12)^7 0]
[-E(12)^7 1 0] [ 0 E(3)^2 0]
[ 0 0 1], [ 0 -E(12)^7 1],
[ 1 0 0]
[ 0 1 -E(12)^7]
[ 0 0 E(3)^2]
) of General Unitary Group of degree 3 over Universal Cyclotomic Field with respect to positive definite hermitian form
[-E(12)^7 + E(12)^11 -1 0]
[ -1 -E(12)^7 + E(12)^11 -1]
[ 0 -1 -E(12)^7 + E(12)^11]
See also the reference manual.
Manifolds
The main novelty is the introduction of vector bundles (ticket #28159). For instance:
sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart()
sage: TM = M.tangent_bundle(); TM
Tangent bundle TM over the 2-dimensional differentiable manifold M
sage: v = TM.section([-y, x], name='v'); v
Vector field v on the 2-dimensional differentiable manifold M
sage: v.display()
v = -y d/dx + x d/dy
sage: p = M((2,3), name='p'); p
Point p on the 2-dimensional differentiable manifold M
sage: TM.fiber(p)
Tangent space at Point p on the 2-dimensional differentiable manifold M
sage: v.at(p) in TM.fiber(p)
True
sage: v.at(p).display()
v = -3 d/dx + 2 d/dy
Other new features are
- characteristic classes (ticket #27784)
- the construction of a vector frame from a family of predefined vector fields (ticket #28716)
- the handling of multiple symmetries and multiple contractions with index notation (ticket #28784)
- more control on the numerical ODE solver for integrated curves and geodesics (ticket #28707)
See the full changelog for details, as well as the list of improvements and bug fixes in this release.
EdgesView for graphs
An EdgesView
is a read-only iterable container of edges enabling operations like for e in E
and e in E
. An EdgesView
can be iterated multiple times, and checking membership is done in constant time. It avoids the construction of edge lists and so consumes little memory. It is updated as the graph is updated. Hence, the graph should not be updated while iterating through an EdgesView
.
sage: G = Graph([(0, 1, 'C'), (0, 2, 'A'), (1, 2, 'B')])
sage: E = G.edges()
sage: E
[(0, 1, 'C'), (0, 2, 'A'), (1, 2, 'B')]
sage: type(E)
<class 'sage.graphs.views.EdgesView'>
sage: (0, 2) in E
False
sage: (0, 2, 'A') in E
True
sage: (2, 0, 'A') in E
True
sage: for e in E:
....: for ee in E:
....: print(e, ee)
....:
(0, 1, 'C') (0, 1, 'C')
(0, 1, 'C') (0, 2, 'A')
(0, 1, 'C') (1, 2, 'B')
(0, 2, 'A') (0, 1, 'C')
(0, 2, 'A') (0, 2, 'A')
(0, 2, 'A') (1, 2, 'B')
(1, 2, 'B') (0, 1, 'C')
(1, 2, 'B') (0, 2, 'A')
(1, 2, 'B') (1, 2, 'B')
See http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/views.html for more details.
Availability of Sage 9.0 and installation help
- Release announcements: See sage-release, sage-announce
- Availability in distributions: see repology.org: sagemath
- sagemath.org download page
Installation FAQ
- See sage-support, sage-devel.
- Debian/Ubuntu: Installation prerequisites, Recommended installation
- Sage 9.0 (and earlier) does not support compilation within a conda environment. Deactivate conda before building Sage.
- Sage 9.0 (and earlier) may not compile from source on some cutting edge Linux distributions such as Ubuntu 20.04 LTS (workaround) and Fedora 32. Use either a distribution package of Sage if that is available in your distribution, a binary distribution of 9.0, or compile a development version of Sage leading to the Sage 9.1 release.
Full Changelog: 8.9...9.0