Add verzweigungsvectoren
This commit is contained in:
parent
53f8c2034c
commit
4d67a5480f
1 changed files with 31 additions and 0 deletions
31
verzweigungsvectoren/main.py
Executable file
31
verzweigungsvectoren/main.py
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from numpy import roots,isreal
|
||||
from itertools import combinations_with_replacement
|
||||
|
||||
|
||||
solutions = []
|
||||
|
||||
s = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
for i in range(2, 7):
|
||||
|
||||
for j in combinations_with_replacement(s, i):
|
||||
|
||||
p = [-j.count(k) for k in range(max(j) + 1)]
|
||||
p[0] = 1
|
||||
|
||||
|
||||
r = [float(k) for k in roots(p) if isreal(k) and k > 0.0]
|
||||
# print(j, max(j), p, r)
|
||||
|
||||
solutions.append((j, r[0]))
|
||||
|
||||
|
||||
|
||||
solutions.sort(key=lambda e: e[1])
|
||||
|
||||
for s in solutions:
|
||||
|
||||
print(f"{s[1]}\t{s[0]}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue