Skip to main content
21 votes
Accepted

How does Sage order the elements of the symmetric group?

I disagree with the question, starting with the first sentence. In Sage, the symmetric group is not a list. In fact clearly it isn't, because I can ask it for ...
Sean Eberhard's user avatar
14 votes
Accepted

Genus of the graph $K_{4,2,2,2}$

I understand it's been years since this question was asked, but I figured I should give an answer for anyone still interested. From the Euler equation, if $K_{4,2,2,2}$ has genus 2, it would actually ...
Timothy Sun's user avatar
14 votes

Computation of a minimal polynomial

In Sage you can do something like: ...
Moritz Firsching's user avatar
13 votes

Number of collinear ways to fill a grid

By the method I used to solve Counting "connected" edge orderings (shellings) of the complete graph, I can show the following: $$ g(m,n) = (mn-1)!\,m!\,n!\sum \frac{b_1 b_2\cdots b_{m+n-...
Richard Stanley's user avatar
13 votes

Is there any fast implementation of four color theorem in Python?

If you have have some specific, moderately large graphs that you want to color with four colors, you could try using a SAT solver. For each vertex $v$ and each integer $i\in \{1,2,3,4\}$, let $x_{v,i}...
Timothy Chow's user avatar
  • 82.6k
12 votes
Accepted

Number of collinear ways to fill a grid

We managed to obtain a solution via Stanley's comment above and some manipulations of binomial coefficients. See https://arxiv.org/abs/1809.10263
Yibo Gao's user avatar
  • 356
11 votes

Is there any fast implementation of four color theorem in Python?

Robertson, Sanders, Seymour and Thomas, who produced a more streamlined proof of the 4-colour theorem, also addressed the algorithmic question in the paper https://dl.acm.org/doi/pdf/10.1145/237814....
Gordon Royle's user avatar
  • 12.7k
11 votes
Accepted

Discrepancy in Magma's calculation and Sage's of elliptic curve?

Well spotted. This is a problem. After quite a bit of fiddling I found that the error is in Denis Simon's script used by Sage. In fact, when executed with higher values of the parameters so that the ...
Chris Wuthrich's user avatar
10 votes
Accepted

Computer program for counting graph homomorphisms

EDIT: I have since found that the Digraphs package sometimes counts homomorphisms incorrectly. Perhaps this problem has been fixed in more recent versions though. I use Minion for counting ...
David Roberson's user avatar
10 votes
Accepted

Computation of a minimal polynomial

To compute the minimal polynomial of integer multiple of an algebraic integer is easy, so the only thing you need for linear combinations is the minimal polynomials of sums. Now, note that if $A$ is ...
Igor Rivin's user avatar
  • 96.4k
10 votes
Accepted

How to get the dimension of Atkin-Lehner eigenspace or do you have any data already obtained?

You can compute these dimensions using modular symbols (an auxiliary space which has the same Hecke action as modular forms, but is easier to compute). Here's a Sage example for weight 4 cusp forms of ...
David Loeffler's user avatar
9 votes

Computation of a minimal polynomial

Using resultants can greatly help. For example, knowing that $\sqrt[5]{2}$ is a zero of $P(x)=x^5-2$ and $1-\exp\frac{2\pi i}{5}$ is a zero of $Q(x)=(x-1)^5+1$, we conclude $\sqrt[5]{2}\cdot (1-\exp\...
Max Alekseyev's user avatar
9 votes

Why mpmath computes $\sum_{n=2}^\infty (-1)^n\log(n)=\log\left(\frac1 2 \sqrt{2} \sqrt{\pi}\right)$

A summation method for this... $$ F(s) = -\sum_{n=2}^\infty \frac{(-1)^n}{n^s} = -(2^{1-s}-1)\zeta(s) \qquad\text{for $s>0$} $$ Differentiate: $$ \sum_{n=2}^\infty \frac{(-1)^n\log n}{n^s} = F'(s) ...
Gerald Edgar's user avatar
  • 41.1k
8 votes
Accepted

How do computer algebra packages like Sagemath implement rank of a matrix

I don't know what algorithm Sage actually uses, but computing rank over the integers is fun and easy: Complexity of computing matrix rank over integers . It is NOT so easy if you want good running ...
Igor Rivin's user avatar
  • 96.4k
8 votes

How to get the dimension of Atkin-Lehner eigenspace or do you have any data already obtained?

Exact formulas for dimensions of Atkin-Lehner eigenspaces follow from trace formulas of Yamauchi and Skoruppa-Zagier. Skoruppa-Zagier corrected some clerical errors in Yamauchi's paper. See: Nils-...
Kimball's user avatar
  • 6,039
7 votes

Why mpmath computes $\sum_{n=2}^\infty (-1)^n\log(n)=\log\left(\frac1 2 \sqrt{2} \sqrt{\pi}\right)$

As shown in my previous answer, the value of the sum that you see is $$\lim_{t\uparrow1}\sum_{n=2}^\infty (-t)^n \ln n. $$ Here is a "manual" way to show this. Writing \begin{equation} \...
Iosif Pinelis's user avatar
7 votes
Accepted

Computations of half-integer forms in SAGE/Magma

This can be done using PARI/GP, which can deal with spaces of modular forms of half-integral weight. Given a modular form $f$ of weight $k$ (possibly half-integral), the command mfslashexpansion can ...
François Brunault's user avatar
6 votes

Sage: Evaluation precision for elliptic curves over p-adic fields

If you are willing to use another CAS system then PARI/GP can do the job: ...
Somos's user avatar
  • 2,784
6 votes

Is there any fast implementation of four color theorem in Python?

Here is a greedy algorithm by Febi Mudiyantoto solve the four-color problem in Python. And here is another Python algorithm that also uses Sage. If you wish to rely on a program with a more formal (...
Carlo Beenakker's user avatar
6 votes
Accepted

Construction of skew-Hadamard matrix of order 292

The skew Hadamard matrix of order 292 can be constructed from skew supplementary difference sets (kindly supplied to us by Prof. Djokovic). This same construction is used, for example, in Djokovic - ...
Matteo Cati's user avatar
5 votes
Accepted

GAP versus SageMath for branching to Lie subgroups

I don't know GAP but Sage has a nice tutorial for branching and is quite usable. It is however, slower than LiE which is on the other hand quite "basic" i.e. it requires you to write the branching ...
Vít Tuček's user avatar
  • 8,597
5 votes

Number of collinear ways to fill a grid

Let me give an alternative proof with only finitely many variables used. It also gives some formulae for the following numbers: "when the filling becomes not collinear for the first time, there ...
Fedor Petrov's user avatar
4 votes

Computation of a minimal polynomial

Although exact calculations are to be preferred where possible, if all you have is a high-accuracy numeric value of a number which you know to be algebraic then you can use an integer relation finding ...
Peter Taylor's user avatar
  • 7,226
4 votes

Existence of a non-Eulerian atomistic lattice with this property on the Möbius function

I found the following example with SageMath. Below is the Hasse diagram and verification in SageMath that the poset is a lattice which is not Eulerian (in fact not graded) that satisfies the desired ...
John Machacek's user avatar
4 votes

All rational periodic points

Your polynomial has good reduction outside of 2, so for all primes $p\ge3$, any rational preperiodic point will have period $n=m_p\cdot r_p\cdot p^{e_p}$, where $m_p$ is its period modulo $p$ and $r_p$...
Joe Silverman's user avatar
4 votes

Computer program for counting graph homomorphisms

In the past few months, we have been working towards a SageMath library for exact counting graph homomorphisms, based on the proof of Prop. 1.6 from "Homomorphisms Are a Good Basis for Counting ...
Jing Guo's user avatar
3 votes
Accepted

Branching to Levi subgroups in SAGE and the circle action

Branching to Levi subalgebras should really take into account the central part of the Levi subalgebra but it is not the case. The problem is that the ...
Vít Tuček's user avatar
  • 8,597
3 votes

GAP versus SageMath for branching to Lie subgroups

I recommend LiE, which is a specialized software for computations in finite dimensional representations of semisimple Lie algebras. There is an online interface. See http://www-math.univ-poitiers.fr/~...
Jeffrey Adams's user avatar
3 votes
Accepted

Mistake in SageMathCell code, finding integral points on elliptic curves

After about an hour and a half running SageMath 9.0.beta7 on my computer, I see this: ...
John Palmieri's user avatar
3 votes
Accepted

Software for $S$-unit equation

This SageMath implementation promises the full generality you are seeking: A robust implementation for solving the S-unit equation and several applications See also this Phys.Org announcement.
Carlo Beenakker's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible