Public
Edited
Jan 14, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
types = ['ILE', 'SEI', 'ESE', 'LII', 'EIE', 'LSI', 'SLE', 'IEI', 'LIE', 'ESI', 'SEE', 'ILI', 'IEE', 'SLI', 'LSE', 'EII']
Insert cell
basis = [ // extravert, carefree, democrat, merry, 1-alpha
{vector:[0,0,0,0,1], charge:[0,1,0,1, 0,1,0,1, 0,1,0,1, 0,1,0,1]},
{vector:[0,0,0,1,0], charge:[0,0,1,1, 0,0,1,1, 0,0,1,1, 0,0,1,1]},
{vector:[0,0,1,0,0], charge:[0,0,0,0, 1,1,1,1, 0,0,0,0, 1,1,1,1]},
{vector:[0,1,0,0,0], charge:[0,0,0,0, 0,0,0,0, 1,1,1,1, 1,1,1,1]},
// {vector:[1,0,0,0,0], charge:[0,0,0,0, 0,0,1,1, 1,1,1,1, 0,0,1,1]}
]
Insert cell
add = (v1, v2) => {
let v3 = {vector: new Array(5).fill(0), charge: new Array(16).fill(0)}
for(let i=0; i<5; i++){ v3.vector[i] = (v1.vector[i]+v2.vector[i]) % 2 }
for(let i=0; i<16; i++){ v3.charge[i] = (v1.charge[i]+v2.charge[i]) % 2 }
return v3
}
Insert cell
dichotomies = {
let n = basis.length
let m = 1
// zero
let list = [ {vector: new Array(5).fill(0), charge: new Array(16).fill(0)} ]

// 31 non trivial dichotomies
for(let i=0; i<n; i++){
for(let j=0; j<m; j++){
list.push( add( basis[i], list[j] ) )
}
m = list.length
}
return list
}
Insert cell
intersect = (v1, v2) => {
let charge
let smallGroup = [ {}, {}, {}, {} ]
for(let i=0; i<2; i++){
for(let j=0; j<2; j++){
smallGroup[i+2*j].index = ''
smallGroup[i+2*j].size = 0
smallGroup[i+2*j].charge = new Array(16).fill(0)
for(let k=0; k<16; k++){
if(v1.charge[k] == i && v2.charge[k] == j){
charge = 0
smallGroup[i+2*j].size ++
}else{
charge = 1
}
smallGroup[i+2*j].charge[k] = charge
smallGroup[i+2*j].index += charge
}
}
}

return smallGroup
}
Insert cell
smallGroups = {
let n = dichotomies.length
let list = []
let sg
for(let i=1; i<n; i++){
for(let j=i+1; j<n; j++){
sg = intersect( dichotomies[i], dichotomies[j] )
for(let k=0; k<4; k++){
if(
(sg[k].size == 4 || check.length == 1 && ( sg[k].size == 2 || sg[k].size == 6 ) ) &&
list.filter(obj => obj.index == sg[k].index) == 0
){
list.push(sg[k])
}
}
}
}
list.sort((a, b) => parseFloat(a.index) - parseFloat(b.index))
return list
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more