This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hSepString :: HSep -> String | |
# hSepString hsep = case hsep of | |
# HSepEmpty -> "" | |
# HSepSpaces k -> replicate k ' ' | |
# HSepString s -> s | |
hSepString <- function(hsep) { | |
sep <- attr(hsep, "sep") | |
switch( | |
sep, | |
"empty" = "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- | Given the cardinalities of some finite sets, we list all possible | |
# -- Venn diagrams. | |
# -- | |
# -- Note: we don't include the empty zone in the tables, because it's always empty. | |
# -- | |
# -- Remark: if each sets is a singleton set, we get back set partitions: | |
# -- | |
# -- > > [ length $ enumerateVennDiagrams $ replicate k 1 | k<-[1..8] ] | |
# -- > [1,2,5,15,52,203,877,4140] | |
# -- > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rg <- function(a, b) { | |
if(a <= b) a:b else integer(0L) | |
} | |
KostkaNumber <- function(lambda, mu) { | |
lambda <- as.integer(lambda) | |
mu <- as.integer(mu) | |
wmu <- sum(mu) | |
wlam <- sum(lambda) | |
if(wlam == 0L) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insertWith <- function(f, mp, key, value) { | |
if(key %in% names(mp)) { | |
mp[[key]] <- f(value, mp[[key]]) | |
} else { | |
mp[[key]] <- value | |
} | |
mp | |
} | |
zip3 <- function(v1, v2, v3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insertWith <- function(f, mp, key, value) { | |
if(key %in% names(mp)) { | |
mp[[key]] <- f(value, mp[[key]]) | |
} else { | |
mp[[key]] <- value | |
} | |
mp | |
} | |
drop <- function(n, x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Weierstrass p-function and its first three derivatives. | |
Author: Stéphane Laurent. | |
Depends on math.js <https://mathjs.org/> | |
and jacobi.js <https://gist.github.com/stla/955af9c1c2713a47883bc927a759bdc7>. | |
*/ | |
var weierstrass = (function () { | |
const jtheta1 = jacobi.jtheta1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Carlson elliptic integrals and incomplete elliptic integrals. | |
Author: Stéphane Laurent. | |
Depends on math.js <https://mathjs.org/>. | |
*/ | |
var ellipticIntegrals = (function () { | |
let CarlsonRF = function(x, y, z, err) { | |
if(err <= 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Jacobi theta functions. | |
Author: Stéphane Laurent. | |
The functions jtheta1, jtheta2, jtheta3 and jtheta4 are the Jacobi theta | |
functions. The function jtheta1 is 1-antiperiodic, and the functions | |
jtheta2, jtheta3 and jtheta4 are 1-periodic. | |
The function jthetaAB is the Jacobi theta function with characteristics. | |
The function jtheta1Prime0 is the derivative at 0 of jtheta1. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Meshes | |
using MeshViz | |
using GLMakie | |
using Makie | |
using Printf | |
# vectors obtained by changing signs of the given vectors | |
function changesOfSigns(vecs) | |
N = length(vecs[1]) | |
signs = Iterators.product(ntuple(i -> (-1, 1), N)...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Meshes | |
using LinearAlgebra | |
using MeshViz | |
using GLMakie | |
using Makie | |
using Printf | |
# beta factor | |
function betaF(A, s) | |
1.0 / √(1 + LinearAlgebra.norm_sqr(A) / (s*s)) |
NewerOlder