@ilyxa/

1365 dichotomy combinations

by Andrew Joynton

Files
• main.py
main.py
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
```
```#Harmony Calcuation for dichotomy level reinin structures

#Cell Index for excel
#Input needs to be in a single column, in the order:
#E, N, T, P, EN, ET, EP, NT, NP, TP, ENT, ENP, ETP, NTP, ENTP

#Starting cell E
startColumn = 'F'
startRow = 2

#Assign variables to excel input cells, in vector numerical order
P=   startColumn+str(startRow+ 3) #0001
T=   startColumn+str(startRow+ 2) #0010
TP=  startColumn+str(startRow+ 9) #0011
N=   startColumn+str(startRow+ 1) #0100
NP=  startColumn+str(startRow+ 8) #0101
NT=  startColumn+str(startRow+ 7) #0110
NTP= startColumn+str(startRow+13) #0111
E=   startColumn+str(startRow+ 0) #1000
EP=  startColumn+str(startRow+ 6) #1001
ET=  startColumn+str(startRow+ 5) #1010
ETP= startColumn+str(startRow+12) #1011
EN=  startColumn+str(startRow+ 4) #1100
ENP= startColumn+str(startRow+11) #1101
ENT= startColumn+str(startRow+10) #1110
ENTP=startColumn+str(startRow+14) #1111

#Dichotomy vectors put in list in numerical order
cellList = ['IDENTITY',P,T,TP,N,NP,NT,NTP,E,EP,ET,ETP,EN,ENP,ENT,ENTP]

#Dichotomy variable from index number
nameList = ['IDENTITY','P','T','TP','N','NP','NT','NTP','E','EP','ET','ETP','EN','ENP','ENT','ENTP']

#List Index
list1=    [''] #0000
listP=    [''] #0001
listT=    [''] #0010
listTP=   [''] #0011
listN=    [''] #0100
listNP=   [''] #0101
listNT=   [''] #0110
listNTP=  [''] #0111
listE=    [''] #1000
listEP=   [''] #1001
listET=   [''] #1010
listETP=  [''] #1011
listEN=   [''] #1100
listENP=  [''] #1101
listENT=  [''] #1110
listENTP= [''] #1111

listList = [list1,listP,listT,listTP,listN,listNP,listNT,listNTP,listE,listEP,listET,listETP,listEN,listENP,listENT,listENTP]

#FUNCTIONS
#Print list items with line space at end
def printList(arg1):
i = 0
loop=len(arg1)
while (i < loop):
print(arg1[i])
i = i + 1
print ("")

#Add new item to bottom of list
list.insert(len(list),item)

#vector addition for two dichotomy vectors strings
v1=str(v1)
v2=str(v2)
a=( int(v1[0]) + int(v2[0]) )%2 #Mod 2 addition, 1+0=1  1+1=0
b=( int(v1[1]) + int(v2[1]) )%2
c=( int(v1[2]) + int(v2[2]) )%2
d=( int(v1[3]) + int(v2[3]) )%2
v3=str(a)+str(b)+str(c)+str(d)  #Recontructs output vector string
return(v3)

#Converts boolean vector to decimal equivelent to use with list indexing
def vectorToInt (vector):
vector=str(vector)
a=int(vector[0])*8+int(vector[1])*4+int(vector[2])*2+int(vector[3])
return a

#Converts a number 0-15 into a vector string
def intToVector (integer):
integer = ''.join(str(1 & int(integer) >> i) for i in range(4)[::-1])
return integer

#Adds two integers as if they were vectors and returns an integer
int1 = intToVector(int1)
int2 = intToVector(int2)
int3 = vectorToInt(int3)
return int3

#PROGRAM

#Small group level constructions, 7 for each dichotomy
w=1
while (w<16):
vw=intToVector(w) #w as a vector

x=w+1
while (x<16):
vx=intToVector(x) #x as a vector

if vw!=vx:
formula = '='+cellList[w]+'*'+cellList[x]

x=x+1
w=w+1

#Dyad level constructions, 28 for each dichotomy
w=1
while (w<16):
vw=intToVector(w) #w as a vector
x=w+1
while (x<16):
vx=intToVector(x) #x as a vector

if w!=x:
y=x+1
while (y<16):
vy=intToVector(y) #y as a vector
formula = '='+cellList[w]+'*'+cellList[x]+'*'+cellList[y]
y=y+1
x=x+1
w=w+1

#Type level constructions, 56 for each dichotomy
w=1
while (w<16):
vw=intToVector(w) #w as a vector
x=w+1
while (x<16):
vx=intToVector(x) #x as a vector

if w!=x:
y=x+1
while (y<16):
vy=intToVector(y) #y as a vector
if vectorAdd(vw,vx)!=vy and vw!=vy and vx!=vy:
z=y+1
while (z<16):
vv1=vw
vv2=vx
vv3=vy
vz=intToVector(z) #z as a vector
if (vz!=vv1) and (vz!=vv2) and (vz!=vv3) and (vz!=vv4) and (vz!=vv5) and (vz!=vv6) and (vz!=vv7):
formula = '='+cellList[w]+'*'+cellList[x]+'*'+cellList[y]+'*'+cellList[z]
z=z+1
y=y+1
x=x+1
w=w+1

#PRINT RESULTS
#In vector numerical order, to be copied into Excel
i=1
while i<16:
vectorNum = i

print(nameList[vectorNum])
printList(listList[vectorNum])
print('--------------------')
print('')

i=i+1

#END PROGRAM
```