Skip to content

Instantly share code, notes, and snippets.

View mark-osm-map.pl
#! /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,
View saisons.gnuplot
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
View mandelbrot-fourier.c
// 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
View three-circles-symmetric.sage
## 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:
View three-circles.sage
## 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:
View country-splitting-algorithm.pl
#! /usr/local/bin/perl -w
use strict;
use warnings;
# See <URL: https://twitter.com/gro_tsen/status/1530670251871899650 >
# for explanations as to what this does.
my $size = 64;
View 20220504-extended-dynkin-diagrams.tex
\documentclass[10pt,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}
View shape-of-c3.sage
C = CartanType("C3")
rk = C.rank()
detcmat = C.cartan_matrix().det()
invcmat = C.cartan_matrix().inverse()
WCR = WeylCharacterRing(C)
WR = WeightRing(WCR)
# Fundamental coweights:
fundcoweights = dict([(i+1, sum([invcmat[i][j]*WCR.simple_coroots()[j+1] for j in range(rk)])) for i in range(rk)])
# Coefficients of highest root:
hwcf = [WCR.highest_root().scalar(fundcoweights[j]) for j in range(1,rk+1)]
View OrbitControls.js
console.warn( "THREE.OrbitControls: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/index.html#manual/en/introduction/Import-via-modules." );
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
* @author ScieCode / http://github.com/sciecode
*/
View example.vote
A>B>C>D: 00.00%
A>B>D>C: 05.60%
A>C>B>D: 06.80%
A>C>D>B: 07.00%
A>D>B>C: 01.50%
A>D>C>B: 06.30%
B>A>C>D: 04.40%
B>A>D>C: 06.70%
B>C>A>D: 02.30%
B>C>D>A: 06.60%