Guest User

http://math.stackexchange.com/questions/1308395

a guest
Jun 1st, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.88 KB | None | 0 0
  1. s="(0,0,2),(0,0,-2),(2^*,1,1^*),(2^*,-1,-1^*),(0^*,1,-1^*),(0^*,-1,1^*),(0^*,-1,-1^*),(1,2^*,0^*),(-1,2^*,0^*),(1,0^*,-2^*),(-1,0^*,2^*),(1,0^*,0^*),(-1,0^*,0^*)"
  2. def dmul(x,y):
  3.     _x,_y=map(lambda x:int(x.rstrip("*")),[x,y])
  4.     if not x.endswith('*'):
  5.         if not y.endswith('*'):
  6.             return str(_x+_y)
  7.         else:
  8.             return str(_x+_y)+'*'
  9.     else:
  10.         if not y.endswith('*'):
  11.             return str(_x-_y)+'*'
  12.         else:
  13.             return str(_x-_y)
  14. l=[]
  15. even=[0,2,-2,4,-4]
  16. odd=[1,-1,3,-3]
  17. l+=[(str(a),str(b),str(c))
  18.     for a in even
  19.     for b in even
  20.     for c in even]
  21. l+=[(str(a)+'*',str(b),str(c)+'*')
  22.     for a in even
  23.     for b in odd
  24.     for c in even]
  25. l+=[(str(a),str(b)+'*',str(c)+'*')
  26.     for a in odd
  27.     for b in even
  28.     for c in even]
  29. l+=[(str(a)+'*',str(b)+'*',str(c))
  30.     for a in odd
  31.     for b in odd
  32.     for c in odd]
  33. d={}
  34. for x in l:
  35.     for y in l:
  36.         xy=tuple(map(dmul,x,y))
  37.         if not xy in d:
  38.             d[xy]=[x,y]
  39. s=map(lambda x:tuple(x.split(',')),s.replace('^*','*')[1:-1].split('),('))
  40. for x in s:
  41.     for y in s:
  42.         xy=tuple(map(dmul,x,y))
  43.         if xy in d:
  44.             print "(%s)(%s)\t=(%s)(%s)"%tuple(map(lambda s:','.join(s),[x,y,d[xy][0],d[xy][1]]))
  45.         else:
  46.             print "(%s)(%s)\t=(%s) is not EnEm"%tuple(map(lambda s:','.join(s),[x,y,xy]))
  47.  
  48. (0,0,2)(0,0,2)  =(0,0,0)(0,0,4)
  49. (0,0,2)(0,0,-2) =(0,0,0)(0,0,0)
  50. (0,0,2)(2*,1,1*)    =(1,0*,0*)(1*,-1*,-3)
  51. (0,0,2)(2*,-1,-1*)  =(1,0*,0*)(1*,1*,-1)
  52. (0,0,2)(0*,1,-1*)   =(1,0*,0*)(-1*,-1*,-1)
  53. (0,0,2)(0*,-1,1*)   =(1,0*,0*)(-1*,1*,-3)
  54. (0,0,2)(0*,-1,-1*)  =(1,0*,0*)(-1*,1*,-1)
  55. (0,0,2)(1,2*,0*)    =(0,0,0)(1,2*,2*)
  56. (0,0,2)(-1,2*,0*)   =(0,0,0)(-1,2*,2*)
  57. (0,0,2)(1,0*,-2*)   =(0,0,0)(1,0*,0*)
  58. (0,0,2)(-1,0*,2*)   =(0,0,0)(-1,0*,4*)
  59. (0,0,2)(1,0*,0*)    =(0,0,0)(1,0*,2*)
  60. (0,0,2)(-1,0*,0*)   =(0,0,0)(-1,0*,2*)
  61. (0,0,-2)(0,0,2) =(0,0,0)(0,0,0)
  62. (0,0,-2)(0,0,-2)    =(0,0,0)(0,0,-4)
  63. (0,0,-2)(2*,1,1*)   =(1,0*,0*)(1*,-1*,1)
  64. (0,0,-2)(2*,-1,-1*) =(1,0*,0*)(1*,1*,3)
  65. (0,0,-2)(0*,1,-1*)  =(1,0*,0*)(-1*,-1*,3)
  66. (0,0,-2)(0*,-1,1*)  =(1,0*,0*)(-1*,1*,1)
  67. (0,0,-2)(0*,-1,-1*) =(1,0*,0*)(-1*,1*,3)
  68. (0,0,-2)(1,2*,0*)   =(0,0,0)(1,2*,-2*)
  69. (0,0,-2)(-1,2*,0*)  =(0,0,0)(-1,2*,-2*)
  70. (0,0,-2)(1,0*,-2*)  =(0,0,0)(1,0*,-4*)
  71. (0,0,-2)(-1,0*,2*)  =(0,0,0)(-1,0*,0*)
  72. (0,0,-2)(1,0*,0*)   =(0,0,0)(1,0*,-2*)
  73. (0,0,-2)(-1,0*,0*)  =(0,0,0)(-1,0*,-2*)
  74. (2*,1,1*)(0,0,2)    =(1,0*,0*)(1*,-1*,1)
  75. (2*,1,1*)(0,0,-2)   =(1,0*,0*)(1*,-1*,-3)
  76. (2*,1,1*)(2*,1,1*)  =(0,0,0)(0,2,0)
  77. (2*,1,1*)(2*,-1,-1*)    =(0,0,0)(0,0,2)
  78. (2*,1,1*)(0*,1,-1*) =(0,0,0)(2,2,2)
  79. (2*,1,1*)(0*,-1,1*) =(0,0,0)(2,0,0)
  80. (2*,1,1*)(0*,-1,-1*)    =(0,0,0)(2,0,2)
  81. (2*,1,1*)(1,2*,0*)  =(0,0,0)(1*,3*,1)
  82. (2*,1,1*)(-1,2*,0*) =(0,0,0)(3*,3*,1)
  83. (2*,1,1*)(1,0*,-2*) =(0,0,0)(1*,1*,3)
  84. (2*,1,1*)(-1,0*,2*) =(0,0,0)(3*,1*,-1)
  85. (2*,1,1*)(1,0*,0*)  =(0,0,0)(1*,1*,1)
  86. (2*,1,1*)(-1,0*,0*) =(0,0,0)(3*,1*,1)
  87. (2*,-1,-1*)(0,0,2)  =(1,0*,0*)(1*,1*,3)
  88. (2*,-1,-1*)(0,0,-2) =(1,0*,0*)(1*,1*,-1)
  89. (2*,-1,-1*)(2*,1,1*)    =(0,0,0)(0,0,-2)
  90. (2*,-1,-1*)(2*,-1,-1*)  =(0,0,0)(0,-2,0)
  91. (2*,-1,-1*)(0*,1,-1*)   =(0,0,0)(2,0,0)
  92. (2*,-1,-1*)(0*,-1,1*)   =(0,0,0)(2,-2,-2)
  93. (2*,-1,-1*)(0*,-1,-1*)  =(0,0,0)(2,-2,0)
  94. (2*,-1,-1*)(1,2*,0*)    =(0,0,0)(1*,1*,-1)
  95. (2*,-1,-1*)(-1,2*,0*)   =(0,0,0)(3*,1*,-1)
  96. (2*,-1,-1*)(1,0*,-2*)   =(0,0,0)(1*,-1*,1)
  97. (2*,-1,-1*)(-1,0*,2*)   =(0,0,0)(3*,-1*,-3)
  98. (2*,-1,-1*)(1,0*,0*)    =(0,0,0)(1*,-1*,-1)
  99. (2*,-1,-1*)(-1,0*,0*)   =(0,0,0)(3*,-1*,-1)
  100. (0*,1,-1*)(0,0,2)   =(1,0*,0*)(-1*,-1*,3)
  101. (0*,1,-1*)(0,0,-2)  =(1,0*,0*)(-1*,-1*,-1)
  102. (0*,1,-1*)(2*,1,1*) =(0,0,0)(-2,2,-2)
  103. (0*,1,-1*)(2*,-1,-1*)   =(0,0,0)(-2,0,0)
  104. (0*,1,-1*)(0*,1,-1*)    =(0,0,0)(0,2,0)
  105. (0*,1,-1*)(0*,-1,1*)    =(0,0,0)(0,0,-2)
  106. (0*,1,-1*)(0*,-1,-1*)   =(0,0,0)(0,0,0)
  107. (0*,1,-1*)(1,2*,0*) =(0,0,0)(-1*,3*,-1)
  108. (0*,1,-1*)(-1,2*,0*)    =(0,0,0)(1*,3*,-1)
  109. (0*,1,-1*)(1,0*,-2*)    =(0,0,0)(-1*,1*,1)
  110. (0*,1,-1*)(-1,0*,2*)    =(0,0,0)(1*,1*,-3)
  111. (0*,1,-1*)(1,0*,0*) =(0,0,0)(-1*,1*,-1)
  112. (0*,1,-1*)(-1,0*,0*)    =(0,0,0)(1*,1*,-1)
  113. (0*,-1,1*)(0,0,2)   =(1,0*,0*)(-1*,1*,1)
  114. (0*,-1,1*)(0,0,-2)  =(1,0*,0*)(-1*,1*,-3)
  115. (0*,-1,1*)(2*,1,1*) =(0,0,0)(-2,0,0)
  116. (0*,-1,1*)(2*,-1,-1*)   =(0,0,0)(-2,-2,2)
  117. (0*,-1,1*)(0*,1,-1*)    =(0,0,0)(0,0,2)
  118. (0*,-1,1*)(0*,-1,1*)    =(0,0,0)(0,-2,0)
  119. (0*,-1,1*)(0*,-1,-1*)   =(0,0,0)(0,-2,2)
  120. (0*,-1,1*)(1,2*,0*) =(0,0,0)(-1*,1*,1)
  121. (0*,-1,1*)(-1,2*,0*)    =(0,0,0)(1*,1*,1)
  122. (0*,-1,1*)(1,0*,-2*)    =(0,0,0)(-1*,-1*,3)
  123. (0*,-1,1*)(-1,0*,2*)    =(0,0,0)(1*,-1*,-1)
  124. (0*,-1,1*)(1,0*,0*) =(0,0,0)(-1*,-1*,1)
  125. (0*,-1,1*)(-1,0*,0*)    =(0,0,0)(1*,-1*,1)
  126. (0*,-1,-1*)(0,0,2)  =(1,0*,0*)(-1*,1*,3)
  127. (0*,-1,-1*)(0,0,-2) =(1,0*,0*)(-1*,1*,-1)
  128. (0*,-1,-1*)(2*,1,1*)    =(0,0,0)(-2,0,-2)
  129. (0*,-1,-1*)(2*,-1,-1*)  =(0,0,0)(-2,-2,0)
  130. (0*,-1,-1*)(0*,1,-1*)   =(0,0,0)(0,0,0)
  131. (0*,-1,-1*)(0*,-1,1*)   =(0,0,0)(0,-2,-2)
  132. (0*,-1,-1*)(0*,-1,-1*)  =(0,0,0)(0,-2,0)
  133. (0*,-1,-1*)(1,2*,0*)    =(0,0,0)(-1*,1*,-1)
  134. (0*,-1,-1*)(-1,2*,0*)   =(0,0,0)(1*,1*,-1)
  135. (0*,-1,-1*)(1,0*,-2*)   =(0,0,0)(-1*,-1*,1)
  136. (0*,-1,-1*)(-1,0*,2*)   =(0,0,0)(1*,-1*,-3)
  137. (0*,-1,-1*)(1,0*,0*)    =(0,0,0)(-1*,-1*,-1)
  138. (0*,-1,-1*)(-1,0*,0*)   =(0,0,0)(1*,-1*,-1)
  139. (1,2*,0*)(0,0,2)    =(0,0,0)(1,2*,-2*)
  140. (1,2*,0*)(0,0,-2)   =(0,0,0)(1,2*,2*)
  141. (1,2*,0*)(2*,1,1*)  =(0,0,0)(3*,1*,-1)
  142. (1,2*,0*)(2*,-1,-1*)    =(0,0,0)(3*,3*,1)
  143. (1,2*,0*)(0*,1,-1*) =(0,0,0)(1*,1*,1)
  144. (1,2*,0*)(0*,-1,1*) =(0,0,0)(1*,3*,-1)
  145. (1,2*,0*)(0*,-1,-1*)    =(0,0,0)(1*,3*,1)
  146. (1,2*,0*)(1,2*,0*)  =(0,0,0)(2,0,0)
  147. (1,2*,0*)(-1,2*,0*) =(0,0,0)(0,0,0)
  148. (1,2*,0*)(1,0*,-2*) =(0,0,0)(2,2,2)
  149. (1,2*,0*)(-1,0*,2*) =(0,0,0)(0,2,-2)
  150. (1,2*,0*)(1,0*,0*)  =(0,0,0)(2,2,0)
  151. (1,2*,0*)(-1,0*,0*) =(0,0,0)(0,2,0)
  152. (-1,2*,0*)(0,0,2)   =(0,0,0)(-1,2*,-2*)
  153. (-1,2*,0*)(0,0,-2)  =(0,0,0)(-1,2*,2*)
  154. (-1,2*,0*)(2*,1,1*) =(0,0,0)(1*,1*,-1)
  155. (-1,2*,0*)(2*,-1,-1*)   =(0,0,0)(1*,3*,1)
  156. (-1,2*,0*)(0*,1,-1*)    =(0,0,0)(-1*,1*,1)
  157. (-1,2*,0*)(0*,-1,1*)    =(0,0,0)(-1*,3*,-1)
  158. (-1,2*,0*)(0*,-1,-1*)   =(0,0,0)(-1*,3*,1)
  159. (-1,2*,0*)(1,2*,0*) =(0,0,0)(0,0,0)
  160. (-1,2*,0*)(-1,2*,0*)    =(0,0,0)(-2,0,0)
  161. (-1,2*,0*)(1,0*,-2*)    =(0,0,0)(0,2,2)
  162. (-1,2*,0*)(-1,0*,2*)    =(0,0,0)(-2,2,-2)
  163. (-1,2*,0*)(1,0*,0*) =(0,0,0)(0,2,0)
  164. (-1,2*,0*)(-1,0*,0*)    =(0,0,0)(-2,2,0)
  165. (1,0*,-2*)(0,0,2)   =(0,0,0)(1,0*,-4*)
  166. (1,0*,-2*)(0,0,-2)  =(0,0,0)(1,0*,0*)
  167. (1,0*,-2*)(2*,1,1*) =(0,0,0)(3*,-1*,-3)
  168. (1,0*,-2*)(2*,-1,-1*)   =(0,0,0)(3*,1*,-1)
  169. (1,0*,-2*)(0*,1,-1*)    =(0,0,0)(1*,-1*,-1)
  170. (1,0*,-2*)(0*,-1,1*)    =(0,0,0)(1*,1*,-3)
  171. (1,0*,-2*)(0*,-1,-1*)   =(0,0,0)(1*,1*,-1)
  172. (1,0*,-2*)(1,2*,0*) =(0,0,0)(2,-2,-2)
  173. (1,0*,-2*)(-1,2*,0*)    =(0,0,0)(0,-2,-2)
  174. (1,0*,-2*)(1,0*,-2*)    =(0,0,0)(2,0,0)
  175. (1,0*,-2*)(-1,0*,2*)    =(0,0,0)(0,0,-4)
  176. (1,0*,-2*)(1,0*,0*) =(0,0,0)(2,0,-2)
  177. (1,0*,-2*)(-1,0*,0*)    =(0,0,0)(0,0,-2)
  178. (-1,0*,2*)(0,0,2)   =(0,0,0)(-1,0*,0*)
  179. (-1,0*,2*)(0,0,-2)  =(0,0,0)(-1,0*,4*)
  180. (-1,0*,2*)(2*,1,1*) =(0,0,0)(1*,-1*,1)
  181. (-1,0*,2*)(2*,-1,-1*)   =(0,0,0)(1*,1*,3)
  182. (-1,0*,2*)(0*,1,-1*)    =(0,0,0)(-1*,-1*,3)
  183. (-1,0*,2*)(0*,-1,1*)    =(0,0,0)(-1*,1*,1)
  184. (-1,0*,2*)(0*,-1,-1*)   =(0,0,0)(-1*,1*,3)
  185. (-1,0*,2*)(1,2*,0*) =(0,0,0)(0,-2,2)
  186. (-1,0*,2*)(-1,2*,0*)    =(0,0,0)(-2,-2,2)
  187. (-1,0*,2*)(1,0*,-2*)    =(0,0,0)(0,0,4)
  188. (-1,0*,2*)(-1,0*,2*)    =(0,0,0)(-2,0,0)
  189. (-1,0*,2*)(1,0*,0*) =(0,0,0)(0,0,2)
  190. (-1,0*,2*)(-1,0*,0*)    =(0,0,0)(-2,0,2)
  191. (1,0*,0*)(0,0,2)    =(0,0,0)(1,0*,-2*)
  192. (1,0*,0*)(0,0,-2)   =(0,0,0)(1,0*,2*)
  193. (1,0*,0*)(2*,1,1*)  =(0,0,0)(3*,-1*,-1)
  194. (1,0*,0*)(2*,-1,-1*)    =(0,0,0)(3*,1*,1)
  195. (1,0*,0*)(0*,1,-1*) =(0,0,0)(1*,-1*,1)
  196. (1,0*,0*)(0*,-1,1*) =(0,0,0)(1*,1*,-1)
  197. (1,0*,0*)(0*,-1,-1*)    =(0,0,0)(1*,1*,1)
  198. (1,0*,0*)(1,2*,0*)  =(0,0,0)(2,-2,0)
  199. (1,0*,0*)(-1,2*,0*) =(0,0,0)(0,-2,0)
  200. (1,0*,0*)(1,0*,-2*) =(0,0,0)(2,0,2)
  201. (1,0*,0*)(-1,0*,2*) =(0,0,0)(0,0,-2)
  202. (1,0*,0*)(1,0*,0*)  =(0,0,0)(2,0,0)
  203. (1,0*,0*)(-1,0*,0*) =(0,0,0)(0,0,0)
  204. (-1,0*,0*)(0,0,2)   =(0,0,0)(-1,0*,-2*)
  205. (-1,0*,0*)(0,0,-2)  =(0,0,0)(-1,0*,2*)
  206. (-1,0*,0*)(2*,1,1*) =(0,0,0)(1*,-1*,-1)
  207. (-1,0*,0*)(2*,-1,-1*)   =(0,0,0)(1*,1*,1)
  208. (-1,0*,0*)(0*,1,-1*)    =(0,0,0)(-1*,-1*,1)
  209. (-1,0*,0*)(0*,-1,1*)    =(0,0,0)(-1*,1*,-1)
  210. (-1,0*,0*)(0*,-1,-1*)   =(0,0,0)(-1*,1*,1)
  211. (-1,0*,0*)(1,2*,0*) =(0,0,0)(0,-2,0)
  212. (-1,0*,0*)(-1,2*,0*)    =(0,0,0)(-2,-2,0)
  213. (-1,0*,0*)(1,0*,-2*)    =(0,0,0)(0,0,2)
  214. (-1,0*,0*)(-1,0*,2*)    =(0,0,0)(-2,0,-2)
  215. (-1,0*,0*)(1,0*,0*) =(0,0,0)(0,0,0)
  216. (-1,0*,0*)(-1,0*,0*)    =(0,0,0)(-2,0,0)
Add Comment
Please, Sign In to add comment