Skip to content

Instantly share code, notes, and snippets.

## 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:
@Gro-Tsen
Gro-Tsen / gettweet.pl
Created January 3, 2023 11:41
Twitter Perl scripts
#! /usr/local/bin/perl -w
# gettweet.pl: Retrieve the content of tweets by id.
# Usage: getweet.pl -i <comma-separated-list>
# saves each in a file called <fulldate>-<id>.txt
# Requires API keys to be stored in ~/.twitterkeys (or $TWITTERKEYS)
# syntax being four lines starting "API-Key: ", "API-Key-Secret: ",
# "Access-Token: " and "Access-Token-Secret: " each followed by their value.
// Compute the coefficients of the Jungreis function, i.e., the
// Fourier coefficients of the harmonic parametrization of the
// boundary of the Mandelbrot set, using the formulae given in
// following paper: John H. Ewing & Glenn Schober, "The area of the
// Mandelbrot set", Numer. Math. 61 (1992) 59-72 (esp. formulae (7)
// and (9)). (Note that their numerical values in table 1 give the
// coefficients of the inverse series.)
// The coefficients betatab[m+1][0] are the b_m such that
// z + sum(b_m*z^-m) defines a biholomorphic bijection from the
@Gro-Tsen
Gro-Tsen / 20221214-secretary-game.tex
Created December 16, 2022 16:07
A problem in probability
\documentclass[12pt,a4paper]{article} % -*- coding: utf-8 -*-
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
@Gro-Tsen
Gro-Tsen / singular-cubic-surfaces-eqn.txt
Created December 13, 2022 18:02
Equation of the locus of singular cubic surfaces
a030^2*a201^3*a111^4*a021*a102^2
- a120*a030*a201^2*a111^5*a021*a102^2
+ a210*a030*a201*a111^6*a021*a102^2
- a300*a030*a111^7*a021*a102^2
- 8*a030^2*a201^4*a111^2*a021^2*a102^2
+ 8*a120*a030*a201^3*a111^3*a021^2*a102^2
+ a120^2*a201^2*a111^4*a021^2*a102^2
- 10*a210*a030*a201^2*a111^4*a021^2*a102^2
- a210*a120*a201*a111^5*a021^2*a102^2
+ 11*a300*a030*a201*a111^5*a021^2*a102^2
#! /usr/local/bin/perl -w
# A simple Perl program to plot a bunch of points (specified by
# latitude and longitude) on an OpenStreetMap base map.
# This takes a list of points (one per line, latitude and longitude
# separated by whitespace or '/' or ',') and plots them as thick
# points on an OpenStreetMap background, saving the resulting map as a
# PNG file (by default "map.png"). The list of points to plot is read
# from the files passed on the command line or, if there are none,
set terminal pngcairo size 800,600
set output "/tmp/temps.png"
stats "time_era5_t2m_France_metropolitan_mon12_ave3_dump0.txt" using ($3+$4/12-2000):($2) name "st0"
w0(x)=st0_intercept+st0_slope*x
title0=sprintf("hiver (régr. %.2f°+%.4f×(Y−2000))", st0_intercept, st0_slope)
stats "time_era5_t2m_France_metropolitan_mon3_ave3_dump0.txt" using ($3+$4/12-2000):($2) name "st1"
w1(x)=st1_intercept+st1_slope*x
title1=sprintf("printemps (régr. %.2f°+%.4f×(Y−2000))", st1_intercept, st1_slope)
stats "time_era5_t2m_France_metropolitan_mon6_ave3_dump0.txt" using ($3+$4/12-2000):($2) name "st2"
w2(x)=st2_intercept+st2_slope*x
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE _sync_state (_id INTEGER PRIMARY KEY,account_name TEXT NOT NULL,account_type TEXT NOT NULL,data TEXT,UNIQUE(account_name, account_type));
CREATE TABLE _sync_state_metadata (version INTEGER);
CREATE TABLE contacts (_id INTEGER PRIMARY KEY AUTOINCREMENT,name_raw_contact_id INTEGER REFERENCES raw_contacts(_id),photo_id INTEGER REFERENCES data(_id),photo_file_id INTEGER REFERENCES photo_files(_id),custom_ringtone TEXT,send_to_voicemail INTEGER NOT NULL DEFAULT 0,times_contacted INTEGER NOT NULL DEFAULT 0,last_time_contacted INTEGER,starred INTEGER NOT NULL DEFAULT 0,has_phone_number INTEGER NOT NULL DEFAULT 0,lookup TEXT,status_update_id INTEGER REFERENCES data(_id), contact_last_updated_timestamp INTEGER, pinned INTEGER NOT NULL DEFAULT 2147483647);
CREATE INDEX contacts_has_phone_index ON contacts (has_phone_number);
CREATE INDEX contacts_name_raw_contact_id_index ON contacts (name_raw_contact_id);
CREATE TABLE stream_items (_id INTEGER PRIMARY KEY AUTOI
## FIRST SESSION: Find equation of circle through three points:
R.<x,y,x1,y1,x2,y2,x3,y3,u,v,w> = PolynomialRing(QQ,11)
eqn = x^2 + y^2 + u*x + v*y + w
eqn1 = eqn.subs({x:x1,y:y1})
eqn2 = eqn.subs({x:x2,y:y2})
eqn3 = eqn.subs({x:x3,y:y3})
M = Matrix(R,3,3,[[x1,x2,x3],[y1,y2,y3],[1,1,1]])
(R^3)((u,v,w)) * M + (R^3)((x1^2+y1^2, x2^2+y2^2, x3^2+y3^2)) == (R^3)((eqn1,eqn2,eqn3))
(ufrac,vfrac,wfrac) = - (R^3)((x1^2+y1^2, x2^2+y2^2, x3^2+y3^2)) * M.inverse()
## Results:
## FIRST SESSION: Find equation of circle through three points:
R.<x,y,x1,y1,x2,y2,x3,y3,u,v,w> = PolynomialRing(QQ,11)
eqn = x^2 + y^2 + u*x + v*y + w
eqn1 = eqn.subs({x:x1,y:y1})
eqn2 = eqn.subs({x:x2,y:y2})
eqn3 = eqn.subs({x:x3,y:y3})
M = Matrix(R,3,3,[[x1,x2,x3],[y1,y2,y3],[1,1,1]])
(R^3)((u,v,w)) * M + (R^3)((x1^2+y1^2, x2^2+y2^2, x3^2+y3^2)) == (R^3)((eqn1,eqn2,eqn3))
(ufrac,vfrac,wfrac) = - (R^3)((x1^2+y1^2, x2^2+y2^2, x3^2+y3^2)) * M.inverse()
## Results: