Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Gro-Tsen / ellipse-conformal-map.sage
Created December 15, 2022 16:34
Graphical representation of the Riemann mapping theorem for a square (inside and out) and an ellipse (inside and out)
# Square of eccentricity (but not that of the drawn ellipse):
modparm = 3/4
# The size of the drawn ellipse (semimajor and semiminor) is computed
# below.
### Mapping the inside of the disk to the inside of the ellipse:
prescale = N(modparm^(-1/4))
postscale = N(pi/(2*elliptic_kc(modparm)))
#### Plot of cumulative precipitations in France
## Input data: /tmp/precs.csv is expected to contain a list of daily
## precipitations in France (first column = date (unused), second
## column = precipiptations in mm/day). It can be produced from the
## data source described in <URL:
## https://twitter.com/gro_tsen/status/1620435663844970497 > by the
## following command line:
# perl -ne 'next if /^\#/; die unless /^([0-9]{8})\s+(\-?[0-9]+\.[0-9]+(?:[Ee](?:[+-]?[0-9]+))?)\s*$/; printf "%s,%.4f\n", $1,($2+0)' /data/meteo/climexp/iera5_prcp_daily_eu_France_metropolitan.dat > /tmp/precs.csv
19500101 0.0501
19500102 0.4288
19500103 4.4788
19500104 3.0397
19500105 1.0753
19500106 0.7376
19500107 0.0551
19500108 0.0924
19500109 1.5346
19500110 0.3256
#### Some statistical analysis of daily mean temperatures in France
#### See: <URL: https://twitter.com/gro_tsen/status/1620488744867598337 >
## Input data: /tmp/temps.csv is expected to contain a list of daily
## average temperatures in France (first column = date (unused),
## second column = temperature in Celsius), over a whole number of
## calendar years. It can be produced from the data source described
## in <URL: https://twitter.com/gro_tsen/status/1620435663844970497 >
## by the following command line:
#### Start gap with enough memory (e.g., "gap -o 8g" for 8GB) to run this.
## The MOG cells are labeled top to bottom and left to right:
## so the leftmost column is 1,2,3,4 and the rightmost is 21,22,23,24,
## whereas the top line is 1,5,9,13,17,21.
## Generators of the Mathieu group M_24:
rotate_blocks := (1,9,17)(2,10,18)(3,11,19)(4,12,20)(5,13,21)(6,14,22)(7,15,23)(8,16,24);
flip_blocks12 := (1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16);
omega_cols := (2,3,4)(6,7,8)(10,11,12)(14,15,16)(18,19,20)(22,23,24);
19500101 0.7202
19500102 0.6790
19500103 5.4118
19500104 6.8020
19500105 6.4501
19500106 5.4249
19500107 5.0415
19500108 4.9504
19500109 6.3907
19500110 6.5916
1502820 U+0020 SPACE
988864 U+0065 LATIN SMALL LETTER E
659884 U+0074 LATIN SMALL LETTER T
553846 U+0073 LATIN SMALL LETTER S
545625 U+0061 LATIN SMALL LETTER A
542018 U+0069 LATIN SMALL LETTER I
519547 U+006E LATIN SMALL LETTER N
488674 U+006F LATIN SMALL LETTER O
452589 U+0072 LATIN SMALL LETTER R
354148 U+0075 LATIN SMALL LETTER U
/* Compute digits of the (pq)-adic idempotent - David A. Madore, 2014-02-03 */
#include <stdio.h>
#include <string.h>
#include <gmp.h>
#ifndef DIGITS
#define DIGITS 10000000
#endif
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1)]).transpose()
## Base échelonnée des solutions entières:
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1),(-45,1,1,1,1,1,1,1,1,1)]).transpose()
## Base échelonnée des solutions entières: