From dc79323588c0f7da9984b218338db84aa56c7787 Mon Sep 17 00:00:00 2001 From: EmmiRiv <73808999+EmmiRiv@users.noreply.github.com> Date: Tue, 3 Aug 2021 15:08:06 -0500 Subject: [PATCH] Add files via upload --- .../mcmullen_stuff/dodecanode.py | 84 +++ .../mcmullen_stuff/dodecatree.py | 563 ++++++++++++++++++ fractal_dimension/mcmullen_stuff/icosanode.py | 84 +++ fractal_dimension/mcmullen_stuff/icosatree.py | 492 +++++++++++++++ 4 files changed, 1223 insertions(+) create mode 100644 fractal_dimension/mcmullen_stuff/dodecanode.py create mode 100644 fractal_dimension/mcmullen_stuff/dodecatree.py create mode 100644 fractal_dimension/mcmullen_stuff/icosanode.py create mode 100644 fractal_dimension/mcmullen_stuff/icosatree.py diff --git a/fractal_dimension/mcmullen_stuff/dodecanode.py b/fractal_dimension/mcmullen_stuff/dodecanode.py new file mode 100644 index 0000000..2fce236 --- /dev/null +++ b/fractal_dimension/mcmullen_stuff/dodecanode.py @@ -0,0 +1,84 @@ +import numpy as np +import math +from random import sample + +class Node: + def __init__(self, tuple, word, words, infertile): + self.tuple = tuple + self.children = [] + self.word = word + self.infertile = infertile + words[str(word)] = self + + def dc_not_too_big(self, g, generator, dual_curvature): + temp = np.matmul(generator, self.tuple) + if g == 0: + temp = [temp[i] for i in (0,1,16,12,17)] + elif g == 1: + temp = [temp[i] for i in (0,1,13,12,14)] + elif g == 2: + temp = [temp[i] for i in (9,11,19,8,15)] + elif g == 3: + temp = [temp[i] for i in (3,7,19,17,12)] + elif g == 4: + temp = [temp[i] for i in (2,13,4,8,15)] + elif g == 5: + temp = [temp[i] for i in (4,13,1,16,18)] + elif g == 6: + temp = [temp[i] for i in (7,11,9,5,19)] + elif g == 7: + temp = [temp[i] for i in (3,7,11,10,6)] + elif g == 8: + temp = [temp[i] for i in (0,14,5,19,17)] + elif g == 9: + temp = [temp[i] for i in (3,6,18,16,12)] + elif g == 10: + temp = [temp[i] for i in (2,14,5,9,15)] + elif g == 11: + temp = [temp[i] for i in (4,8,10,6,18)] + if temp[0] < 0: + return math.sqrt(-((temp[0]*temp[1]*temp[2] + temp[0]*temp[1]*temp[3] + temp[0]*temp[2]*temp[3] - temp[1]*temp[2]*temp[3] + temp[0]*temp[1]*temp[4] + + temp[0]*temp[2]*temp[4] - temp[1]*temp[2]*temp[4] + temp[0]*temp[3]*temp[4] - temp[1]*temp[3]*temp[4] - temp[2]*temp[3]*temp[4] - + math.sqrt(-4*temp[0]*temp[1]*temp[2]*temp[3]*(temp[0] - temp[1] - temp[2] - temp[3] - temp[4])*temp[4] + (temp[2]*temp[3]*temp[4] + + temp[1]*(temp[3]*temp[4] + temp[2]*(temp[3] + temp[4])) - + temp[0]*(temp[3]*temp[4] + temp[2]*(temp[3] + temp[4]) + temp[1]*(temp[2] + temp[3] + temp[4])))**2))/(-temp[0] + temp[1] + + temp[2] + temp[3] + temp[4])))/math.sqrt(2) < dual_curvature + else: + return (1/math.sqrt(2))*(math.sqrt(temp[0]*temp[1] + temp[0]*temp[2] + temp[1]*temp[2] + temp[0]*temp[3] + temp[1]*temp[3] + temp[2]*temp[3] + + temp[0]*temp[4] + temp[1]*temp[4] + temp[2]*temp[4] + temp[3]*temp[4] - + math.sqrt(-4*temp[0]*temp[1]*temp[2]*temp[3] - 4*temp[0]*temp[1]*temp[2]*temp[4] - 4*temp[0]*temp[1]*temp[3]*temp[4] - + 4*temp[0]*temp[2]*temp[3]*temp[4] - + 4*temp[1]*temp[2]*temp[3]*temp[4] + (temp[2]*temp[3] + temp[2]*temp[4] + temp[3]*temp[4] + temp[1]*(temp[2] + temp[3] + temp[4]) + + temp[0]*(temp[1] + temp[2] + temp[3] + temp[4]))**2))) < dual_curvature + + def next_generation(self, words, dual_curvature, generators): + if self.infertile: + return [self] + if self.children == []: + for g,generator in enumerate(generators): + if len(self.word) == 0 or g != self.word[-1]: + if self.word + [g] == [1, 8, 15, 8, 0] or self.word + [g] == [8, 15, 8, 0]: + print(self.tuple) + self.children.append(Node(np.matmul(generator,self.tuple), self.word[:] + [g], words, not self.dc_not_too_big(g, generator, dual_curvature))) + if self.children == []: + return [self] + else: + return self.children + + def next(self): + if self.children == []: + return [self] + else: + return self.children + + def leaves(self): + current_leaves = [self] + while True: + new_leaves = [] + for leaf in current_leaves: + new_leaves += leaf.next() + if current_leaves == new_leaves: + break + else: + current_leaves = new_leaves + return current_leaves \ No newline at end of file diff --git a/fractal_dimension/mcmullen_stuff/dodecatree.py b/fractal_dimension/mcmullen_stuff/dodecatree.py new file mode 100644 index 0000000..0b8e102 --- /dev/null +++ b/fractal_dimension/mcmullen_stuff/dodecatree.py @@ -0,0 +1,563 @@ +from dodecanode import Node +import math +import numpy as np +import time +from scipy.sparse import csr_matrix +from scipy.sparse.linalg import eigs + +def functions(n, z): + if n == 0: + return -1*np.conj(z) + duals = [[], [2/(-1 + math.sqrt(5)) - 1j, + 2/(-1 + math.sqrt(5))], [1/4*(-1 + math.sqrt(5)) + 1/22*(-1 + 3*math.sqrt(5))*1j, + 1/(9 + 5*math.sqrt(5))], [2/(5 *(1 + math.sqrt(5))) + 1j/math.sqrt(5), 2/( + 5 *(1 + math.sqrt(5)))], [1/22*(1 + 3*math.sqrt(5)) + 1/11*(-3 + 2*math.sqrt(5))*1j, + 2/(13 + 5*math.sqrt(5))], [1/(2 + 2*math.sqrt(5)), 1/( + 2 + 2*math.sqrt(5))], [1/4*(-1 + math.sqrt(5)) + 1/2*(3 - math.sqrt(5))*1j, 1/( + 7 + 3*math.sqrt(5))], [1/22*(7 - math.sqrt(5)) + 1/11*(10 - 3*math.sqrt(5))*1j, 2/( + 19 + 9*math.sqrt(5))], [2/(1 + math.sqrt(5)) + 1j, 2/( + 1 + math.sqrt(5))], [2/(11 + 5*math.sqrt(5)) + (-2 + math.sqrt(5))*1j, 2/( + 11 + 5*math.sqrt(5))], [1/38*(11 + 3*math.sqrt(5)) + 1/19*(1 + 2*math.sqrt(5))*1j, + 2/(7 + 5*math.sqrt(5))], [1/58*(11 + math.sqrt(5)) + 1/29*(-10 + 7*math.sqrt(5))*1j, + 2/(17 + 9*math.sqrt(5))]] + return duals[n][0] + np.conj((duals[n][1])**2 / (z-duals[n][0])) + +def derivatives(n, z): + if n == 0: + return 1 + duals = [[], [2/(-1 + math.sqrt(5)) - 1j, + 2/(-1 + math.sqrt(5))], [1/4*(-1 + math.sqrt(5)) + 1/22*(-1 + 3*math.sqrt(5))*1j, + 1/(9 + 5*math.sqrt(5))], [2/(5 *(1 + math.sqrt(5))) + 1j/math.sqrt(5), 2/( + 5 *(1 + math.sqrt(5)))], [1/22*(1 + 3*math.sqrt(5)) + 1/11*(-3 + 2*math.sqrt(5))*1j, + 2/(13 + 5*math.sqrt(5))], [1/(2 + 2*math.sqrt(5)), 1/( + 2 + 2*math.sqrt(5))], [1/4*(-1 + math.sqrt(5)) + 1/2*(3 - math.sqrt(5))*1j, 1/( + 7 + 3*math.sqrt(5))], [1/22*(7 - math.sqrt(5)) + 1/11*(10 - 3*math.sqrt(5))*1j, 2/( + 19 + 9*math.sqrt(5))], [2/(1 + math.sqrt(5)) + 1j, 2/( + 1 + math.sqrt(5))], [2/(11 + 5*math.sqrt(5)) + (-2 + math.sqrt(5))*1j, 2/( + 11 + 5*math.sqrt(5))], [1/38*(11 + 3*math.sqrt(5)) + 1/19*(1 + 2*math.sqrt(5))*1j, + 2/(7 + 5*math.sqrt(5))], [1/58*(11 + math.sqrt(5)) + 1/29*(-10 + 7*math.sqrt(5))*1j, + 2/(17 + 9*math.sqrt(5))]] + return abs(-1*((z-duals[n][0])**2) / ((duals[n][1])**2)) + +def samplePoint(word): + points = [-(1/2), 1/5 + 1/math.sqrt(5) - (2j)/5, +1/4*(-1 + math.sqrt(5)) + 1/22*(-1 + 3*math.sqrt(5))*1j, 2/( + 5*(1 + math.sqrt(5))) + 1j/math.sqrt(5), +1/22*(1 + 3*math.sqrt(5)) + 1/11*(-3 + 2*math.sqrt(5))*1j, 1/(2 + 2*math.sqrt(5)), +1/4*(-1 + math.sqrt(5)) + 1/2*(3 - math.sqrt(5))*1j, +1/22*(7 - math.sqrt(5)) + 1/11*(10 - 3*math.sqrt(5))*1j, +2/5*(-1 + math.sqrt(5)) + (4j)/5, 2/(11 + 5*math.sqrt(5)) + (-2 + math.sqrt(5))*1j, +1/38*(11 + 3*math.sqrt(5)) + 1/19*(1 + 2*math.sqrt(5))*1j, +1/58*(11 + math.sqrt(5)) + 1/29*(-10 + 7*math.sqrt(5))*1j] + p = points[word[-1]] + for letter in word[-2::-1]: + p = functions(letter, p) + return p + +def sampleValue(word): + return derivatives(word[0], samplePoint(word)) + +def generateTree(words, dc): + tt = time.time() + generators = [np.array([[0, 2/(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -(2/(1 + math.sqrt(5))), 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3 + math.sqrt(5), 0, 0, -1, + 0, 0, 0, 0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, + 1/2*(1 + math.sqrt(5)), 0, 0], [0, math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, + 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1/2*(3 - math.sqrt(5)), 0, 0], [0, + 3 + math.sqrt(5), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1 + math.sqrt(5), 0, 0, 0, 0, + 0, 0, 0], [0, 2 + math.sqrt(5), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, + 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 1/2*(3 + math.sqrt(5)), 0, 0], [0, + 2 + math.sqrt(5), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 2 + math.sqrt(5), 0, 0, 0, 0, + 0, 0, 0], [0, 1/2*(5 + math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, + 1 + math.sqrt(5), 0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0], [0, + 3 + 2*math.sqrt(5), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, + 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 1, 0, 0], [0, 1/2*(7 + 3*math.sqrt(5)), 0, + 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, + 0, 0, 0, 1/2*(3 + math.sqrt(5)), 0, 0], [0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 3 + math.sqrt(5), 0, 0, 0, 0, 1, + 0, 0], [0, 2*(1 + math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 2, 0, 0], [0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1/2*(1 + 3*math.sqrt(5)), + 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 1/2*(5 - math.sqrt(5)), 0, + 0, 0, 0, 1/2*(3 - math.sqrt(5)), 0, 0], [0, 1 + math.sqrt(5), 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 1/2*(3 - math.sqrt(5)), 0, 0, 0, + 0, 2, 0, 0], [0, 3 + 2*math.sqrt(5), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, + 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 2, 0, 0], [0, 2/(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0], [0, 1 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, + 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0], [0, math.sqrt(5), + 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 1/2*(5 - math.sqrt(5)), 0, + 0, 0, 0, 2, 0, 0]]), np.array([[1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [1/2*(-1 - math.sqrt(5)), 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0], [1/2*(-5 - 3*math.sqrt(5)), + 1/2*(11 + 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3/2*(3 + math.sqrt(5)), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0], [-(3/2)*(1 + math.sqrt(5)), 4 + math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2 + math.sqrt(5), 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0], [-math.sqrt(5), + 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 + math.sqrt(5), + 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0], [-3 - 2*math.sqrt(5), + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2*(2 + math.sqrt(5)), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0], [1/2*(-5 - 3*math.sqrt(5)), 2*(3 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2*(2 + math.sqrt(5)), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0], [1/2*(-7 - 3*math.sqrt(5)), 2*(2 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, -1, 0], [-3 - math.sqrt(5), + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, -1, 0], [-2*(2 + math.sqrt(5)), + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5 + 2*math.sqrt(5), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0], [-3 - 2*math.sqrt(5), + 1/2*(11 + 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5 + 2*math.sqrt(5), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0], [1/2*(-3 - math.sqrt(5)), 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2 + math.sqrt(5), 0, 0, 0, -1, 0], [1/2*(-1 - math.sqrt(5)), + 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0], [-(3/2)*(1 + math.sqrt(5)), 3 + math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3 + math.sqrt(5), 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0], [-math.sqrt(5), + 3 + math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(3 + math.sqrt(5)), + 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0], [1/2*(1 - math.sqrt(5)), + 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(3 + math.sqrt(5)), 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0], [-3 - math.sqrt(5), + 2*(2 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 + math.sqrt(5), + 0, 0, 0, -1, 0], [1/2*(-3 - math.sqrt(5)), 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 + math.sqrt(5), 0, 0, 0, -1, 0]]), np.array([[0, 0, + 0, 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 2*(3 + math.sqrt(5)), 7 + 3*math.sqrt(5), + 0, 0, 0, 0, 0, 1/2*(-9 - 5*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, + 0, 0, 1/2*(-3 - math.sqrt(5)), 1/2*(11 + 5*math.sqrt(5)), 5/2*(3 + math.sqrt(5)), + 0, 0, 0, 0, 0, 1/2*(-9 - 5*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, + 0, 0, -1, 1/2*(5 + math.sqrt(5)), 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, + 0, -math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 2*(2 + math.sqrt(5)), 1/2*(9 + 5*math.sqrt(5)), 0, 0, 0, 0, + 0, -5 - 2*math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, + 3 + math.sqrt(5), 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, + 1/2*(5 + math.sqrt(5)), 4 + math.sqrt(5), 0, 0, 0, 0, 0, + 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, + 4 + math.sqrt(5), 4 + math.sqrt(5), 0, 0, 0, 0, 0, -2*(1 + math.sqrt(5)), 0, 0, 0, + 0], [0, 0, 0, 0, 0, 0, 0, -1, 3 + math.sqrt(5), 5 + math.sqrt(5), 0, 0, 0, + 0, 0, -2*(1 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(1 + math.sqrt(5)), 1, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, + 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 1/2*(13 + 5*math.sqrt(5)), 8 + 3*math.sqrt(5), 0, 0, 0, + 0, 0, -3*(2 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 1/2*(7 + 3*math.sqrt(5)), 3 + 2*math.sqrt(5), 0, 0, 0, 0, + 0, -3 - math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 1/2*(5 + 3*math.sqrt(5)), 2*(2 + math.sqrt(5)), 0, 0, 0, + 0, 0, -3 - math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 1/2*(13 + 5*math.sqrt(5)), 7 + 3*math.sqrt(5), 0, 0, 0, + 0, 0, -5 - 3*math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 1/2*(11 + 5*math.sqrt(5)), 8 + 3*math.sqrt(5), 0, 0, 0, + 0, 0, -5 - 3*math.sqrt(5), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 2*(2 + math.sqrt(5)), 2*(2 + math.sqrt(5)), 0, 0, 0, 0, + 0, -(3/2)*(3 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 1/2*(7 + 3*math.sqrt(5)), 1/2*(9 + 5*math.sqrt(5)), 0, 0, + 0, 0, 0, -(3/2)*(3 + math.sqrt(5)), 0, 0, 0, 0]]), np.array([[0, 0, 0, 0, 0, -1, + 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1/2*(3 - math.sqrt(5)), 0, + 1/2*(5 + math.sqrt(5))], [0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 2 + math.sqrt(5), 0, 0, 0, 0, -1, 0, 1/2*(5 + 3*math.sqrt(5))], [0, 0, + 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 4 + math.sqrt(5), 0, 0, + 0, 0, -1 - math.sqrt(5), 0, 1/2*(11 + 5*math.sqrt(5))], [0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0, 1], [0, 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 3/2*(3 + math.sqrt(5)), 0, 0, 0, 0, -(3/2)*(1 + math.sqrt(5)), 0, + 1/2*(11 + 5*math.sqrt(5))], [0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 1 - math.sqrt(5), 0, 3 + math.sqrt(5)], [0, 0, 0, 0, 0, -1, 0, 0, 0, + 0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 1/2*(-1 - 3*math.sqrt(5)), 0, + 3 + math.sqrt(5)], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 1/2*(1 + math.sqrt(5))], [0, 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 3/2*(3 + math.sqrt(5)), 0, 0, 0, + 0, 1/2*(-5 - 3*math.sqrt(5)), 0, 1/2*(13 + 5*math.sqrt(5))], [0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 2 + math.sqrt(5), 0, 0, 0, 0, + 1/2*(-5 - math.sqrt(5)), 0, 2*(2 + math.sqrt(5))], [0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, + 0, -3 - math.sqrt(5), 0, 2*(2 + math.sqrt(5))], [0, 0, 0, 0, 0, -1, 0, 0, 0, + 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 1/2*(-1 - 3*math.sqrt(5)), 0, + 4 + math.sqrt(5)], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0], [0, 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, -1 - math.sqrt(5), 0, + 2*(3 + math.sqrt(5))], [0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 1 + math.sqrt(5), 0, 0, 0, 0, -1, 0, 1/2*(7 + 3*math.sqrt(5))], [0, 0, + 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), + 0, 0, 0, 0, -(3/2)*(1 + math.sqrt(5)), 0, 1/2*(13 + 5*math.sqrt(5))], [0, 0, + 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, + 1 - math.sqrt(5), 0, 1/2*(5 + math.sqrt(5))], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0, 0, 0, 0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, 0, + 1/2*(-5 - math.sqrt(5)), 0, 1/2*(7 + 3*math.sqrt(5))], [0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]), np.array([[0, 0, -1, 0, 0, 0, 0, 0, + 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 2 + math.sqrt(5), 0, + 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1 - math.sqrt(5), 0, 0, 0, 0, + 0, 0, -1, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 1/2*(5 + math.sqrt(5)), 0, 0, + 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 1/2*(-5 - 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 3/2*(3 + math.sqrt(5)), 0, + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 1, 0, 0, 0, 0], [0, + 0, -1, 0, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 1 + math.sqrt(5), + 0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, -3 - math.sqrt(5), 0, 0, 0, + 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, + 2*(2 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, -(3/2)*(1 + math.sqrt(5)), 0, 0, 0, + 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0], [0, + 0, 1 - math.sqrt(5), 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 2, 0, 3 + math.sqrt(5), + 0, 0, 0, 0], [0, 0, 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, -1, 0, + 0, 0, 1/2*(5 + math.sqrt(5)), 0, 4 + math.sqrt(5), 0, 0, 0, 0], [0, 0, + 1/2*(-5 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, + 2 + math.sqrt(5), 0, 2*(2 + math.sqrt(5)), 0, 0, 0, 0], [0, + 0, -(3/2)*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, + 0, 0, 3/2*(3 + math.sqrt(5)), 0, 1/2*(11 + 5*math.sqrt(5)), 0, 0, 0, 0], [0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, + 1/2*(3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 2, 0, + 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1/2*(-5 - math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, -1 - math.sqrt(5), 0, 0, 0, 0, + 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, + 2*(3 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, + 0, 0, 0, -1, 0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, 3 + math.sqrt(5), 0, 0, 0, + 0], [0, 0, -1 - math.sqrt(5), 0, 0, 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, + 0, 0, 4 + math.sqrt(5), 0, 1/2*(11 + 5*math.sqrt(5)), 0, 0, 0, 0]]), np.array([[0, 0, + 0, 0, 1/2*(-5 - 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 4 + math.sqrt(5), 0, + 0, 0, 1/2*(1 - math.sqrt(5)), 3 + math.sqrt(5), 0], [0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, + 0, 0, 0, 1, 0], [0, 0, 0, 0, -1 - math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, + 3 + math.sqrt(5), 0, 0, 0, 1/2*(1 - math.sqrt(5)), 1/2*(5 + math.sqrt(5)), 0], [0, + 0, 0, 0, 1/2*(-7 - 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, -1, 2*(2 + math.sqrt(5)), 0], [0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, + 1/2*(-9 - 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(13 + 5*math.sqrt(5)), + 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 1/2*(11 + 5*math.sqrt(5)), 0], [0, 0, 0, + 0, -1 - math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 0, + 0, 1/2*(1 - math.sqrt(5)), 3 + math.sqrt(5), 0], [0, 0, 0, 0, + 1/2*(-9 - 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(11 + 5*math.sqrt(5)), + 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 1/2*(13 + 5*math.sqrt(5)), 0], [0, 0, 0, + 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), + 0, 0, 0, 1/2*(1 - math.sqrt(5)), 1/2*(5 + math.sqrt(5)), 0], [0, 0, 0, + 0, -2*(2 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(11 + 5*math.sqrt(5)), + 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 2*(3 + math.sqrt(5)), 0], [0, 0, 0, + 0, -2 - math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, 0, + 0, -1, 1/2*(7 + 3*math.sqrt(5)), 0], [0, 0, 0, 0, -2*(2 + math.sqrt(5)), 0, + 0, 0, 0, 0, 0, 0, 0, 2*(3 + math.sqrt(5)), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 1/2*(11 + 5*math.sqrt(5)), 0], [0, 0, 0, 0, 1/2*(-5 - 3*math.sqrt(5)), 0, 0, + 0, 0, 0, 0, 0, 0, 3 + math.sqrt(5), 0, 0, 0, 1/2*(1 - math.sqrt(5)), + 4 + math.sqrt(5), 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(-7 - 3*math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0, 0, 2*(2 + math.sqrt(5)), 0, 0, 0, -1, 1/2*(7 + 3*math.sqrt(5)), 0], [0, 0, + 0, 0, -2 - math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), + 0, 0, 0, -1, 1/2*(5 + 3*math.sqrt(5)), 0], [0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 1/2*(1 + math.sqrt(5)), 0], [0, 0, 0, 0, -2*(2 + math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 0, 0, 2*(2 + math.sqrt(5)), 0, 0, 0, -1, 2*(2 + math.sqrt(5)), 0], [0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, + 0, 1/2*(-11 - 5*math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 1/2*(13 + 5*math.sqrt(5)), 0]]), np.array([[0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), + 1 + math.sqrt(5), 0, 1 + math.sqrt(5), 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 1/2*(5 + math.sqrt(5)), 0, 3 + math.sqrt(5), + 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, + 1/2*(1 - math.sqrt(5)), math.sqrt(5), 0, 1/2*(3 + math.sqrt(5)), 0, 1 + math.sqrt(5), + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), + 3 - math.sqrt(5), 0, 1 + math.sqrt(5), 0, 1/2*(5 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 2, 0, 3 + math.sqrt(5), 0, 3 + math.sqrt(5), + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), + 1/2*(-1 + math.sqrt(5)), 0, 2 + math.sqrt(5), 0, 1 + math.sqrt(5), 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0], [0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), 1/2*(-1 + math.sqrt(5)), 0, + 1 + math.sqrt(5), 0, 2 + math.sqrt(5), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 2 - math.sqrt(5), 0, 1/2*(3 + math.sqrt(5)), 0, 3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, + 1/2*(-1 + math.sqrt(5)), 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, + 0, 1/2*(1 - math.sqrt(5)), math.sqrt(5), 0, 2 + math.sqrt(5), 0, + 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, + 3, 0, 3/2*(1 + math.sqrt(5)), 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0], [0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 1/2*(7 - math.sqrt(5)), 0, + 1/2*(1 + math.sqrt(5)), 0, 1/2*(5 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 3 - math.sqrt(5), 0, + 1/2*(1 + math.sqrt(5)), 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, + 0, -1, 3, 0, 1/2*(5 + 3*math.sqrt(5)), 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), + 1/2*(7 - math.sqrt(5)), 0, 1/2*(3 + math.sqrt(5)), 0, 1/2*(3 - math.sqrt(5)), 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 2, 0, + 1/2*(5 + 3*math.sqrt(5)), 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0], [0, 0, 0, 0, 0, 1, 0, 1/2*(-1 + math.sqrt(5)), 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]), np.array([[0, 0, 0, 1, 0, + 0, 4 + math.sqrt(5), 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, + 1/2*(7 + 3*math.sqrt(5)), 4 + math.sqrt(5), 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), + 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, + 3/2*(3 + math.sqrt(5)), 3/2*(3 + math.sqrt(5)), 0, 0, 0, 0, + 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, + 1/2*(5 + 3*math.sqrt(5)), 2 + math.sqrt(5), 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, 2 + math.sqrt(5), + 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, -math.sqrt(5), 0, 0, 1/2*(7 + math.sqrt(5)), 1/2*(5 + math.sqrt(5)), + 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -math.sqrt(5), 0, 0, + 1/2*(5 + math.sqrt(5)), 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, -1, 0, 0, 0, 0, + 0, 0, 0], [0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 1/2*(1 + math.sqrt(5)), 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1/2*(-1 - math.sqrt(5)), + 0, 0, 1, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 3/2*(3 + math.sqrt(5)), + 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0], [0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 1/2*(7 + 3*math.sqrt(5)), + 3/2*(3 + math.sqrt(5)), 0, 0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0], [0, 0, 0, 1/2*(-3 - math.sqrt(5)), 0, 0, 1/2*(5 + 3*math.sqrt(5)), + 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 0], [0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 2 + math.sqrt(5), + 1 + math.sqrt(5), 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0], [0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 1 + math.sqrt(5), 2 + math.sqrt(5), 0, + 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, + 1/2*(3 - math.sqrt(5)), 0, 0, 1/2*(5 + math.sqrt(5)), 2, 0, 0, 0, 0, -1, 0, + 0, 0, 0, 0, 0, 0], [0, 0, 0, 1/2*(3 - math.sqrt(5)), 0, 0, 2, + 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0]]), np.array([[0, 0, + 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 1/2*(-1 + math.sqrt(5)), 0, 0], [0, 0, 0, 0, 0, 1/2*(7 - 3*math.sqrt(5)), 0, + 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 5 - math.sqrt(5), 0, 0, + 2*(-1 + math.sqrt(5)), 0, 0], [0, 0, 0, 0, 0, -(3/2)*(-3 + math.sqrt(5)), 0, + 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 5 - math.sqrt(5), 0, + 0, -3 + 2*math.sqrt(5), 0, 0], [0, 0, 0, 0, 0, 1/2*(-1 + 3*math.sqrt(5)), 0, + 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, -1 + math.sqrt(5), 0, 0, 4, 0, + 0], [0, 0, 0, 0, 0, 3, 0, 0, -1, 0, 0, 0, 0, 0, 1/2*(7 + math.sqrt(5)), + 0, 0, 3/2*(1 + math.sqrt(5)), 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 4, 0, 0, -1, 0, 0, 0, + 0, 0, 3, 0, 0, 1 + 2*math.sqrt(5), 0, 0], [0, 0, 0, 0, 0, 5 - math.sqrt(5), + 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 1/2*(7 - 3*math.sqrt(5)), 0, 0, + 2*(-1 + math.sqrt(5)), 0, 0], [0, 0, 0, 0, 0, 4, 0, 0, -1, 0, 0, 0, 0, + 0, 4, 0, 0, 2*math.sqrt(5), 0, 0], [0, 0, 0, 0, 0, 5 - math.sqrt(5), 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, -(3/2)*(-3 + math.sqrt(5)), 0, + 0, -3 + 2*math.sqrt(5), 0, 0], [0, 0, 0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, + 0, -1, 0, 0, 0, 0, 0, 3, 0, 0, 3/2*(1 + math.sqrt(5)), 0, 0], [0, 0, 0, + 0, 0, 1/2*(1 + 3*math.sqrt(5)), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, + 0, -1 + math.sqrt(5), 0, 0, 3, 0, 0], [0, 0, 0, 0, + 0, -(3/2)*(-3 + math.sqrt(5)), 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, + 0, -(3/2)*(-3 + math.sqrt(5)), 0, 0, 5/2*(-1 + math.sqrt(5)), 0, 0], [0, 0, + 0, 0, 0, -1 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(1 + 3*math.sqrt(5)), 0, 0, 3, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, + 1/2*(-1 + 3*math.sqrt(5)), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-1 + 3*math.sqrt(5)), 0, 0, 1/2*(7 - math.sqrt(5)), 0, 0], [0, 0, 0, 0, + 0, -1 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-1 + 3*math.sqrt(5)), 0, 0, 4, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 3, 0, 0, -1, 0, + 0, 0, 0, 0, 4, 0, 0, 1 + 2*math.sqrt(5), 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 1/2*(-1 + math.sqrt(5)), 0, + 0]]), np.array([[0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1 + math.sqrt(5), 0, -1 + math.sqrt(5), + 0], [0, 0, 0, 3/2*(-1 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(7 - math.sqrt(5)), + 0, -(3/2)*(-3 + math.sqrt(5)), 0], [0, 0, 0, 1 + 2*math.sqrt(5), 0, 0, 0, 0, + 0, -1, 0, 0, 0, 0, 0, 0, 3, 0, 4, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3/2*(-1 + math.sqrt(5)), 0, + 0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 3 - math.sqrt(5), 0, + 5 - math.sqrt(5), 0], [0, 0, 0, 2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, -1, 0, + 0, 0, 0, 0, 0, 3, 0, 3, 0], [0, 0, 0, 2/(1 + math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -(2/(1 + math.sqrt(5))), 0, 1, 0], [0, 0, + 0, -1 + 2*math.sqrt(5), 0, 0, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 3 - math.sqrt(5), 0, -(3/2)*(-3 + math.sqrt(5)), 0], [0, 0, 0, + 1/2*(5 + math.sqrt(5)), 0, 0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 1/2*(-1 + math.sqrt(5)), 0, 1/2*(1 + 3*math.sqrt(5)), 0], [0, 0, 0, + 2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, 4, + 0], [0, 0, 0, 1/2*(-1 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 2 - math.sqrt(5), 0, 5 - math.sqrt(5), + 0], [0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 0, 1/2*(1 - math.sqrt(5)), + 0, 0, 0, 0, 0, 0, 1/2*(-1 + math.sqrt(5)), 0, 1/2*(-1 + 3*math.sqrt(5)), + 0], [0, 0, 0, 2/(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1/2*(1 - math.sqrt(5)), 0], [0, 0, 0, 3, 0, 0, 0, 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, math.sqrt(5), 0, + 1/2*(-1 + 3*math.sqrt(5)), 0], [0, 0, 0, 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, + 0, 0, -1, 0, 0, 0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, 3, 0], [0, 0, 0, + 1/2*(5 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, + 1/2*(7 + math.sqrt(5)), 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0], [0, 0, 0, 1/2*(-1 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 0, 0, 0, 0, 1/2*(7 - math.sqrt(5)), 0, + 1/2*(7 - 3*math.sqrt(5)), 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0], [0, 0, 0, 1/2*(7 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, math.sqrt(5), 0, -1 + math.sqrt(5), + 0]]), np.array([[0, 0, 5, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 2 + math.sqrt(5), 0, 0, 0, 0, + 0, 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 2*(1 + math.sqrt(5)), 0, 0, + 0, 1/2*(1 - math.sqrt(5)), 0, 0, 3 + math.sqrt(5), 0, 0, 0, 0, 0, + 1/2*(-5 - math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 3/2*(3 + math.sqrt(5)), 0, 0, 0, -1, + 0, 0, 5 + 2*math.sqrt(5), 0, 0, 0, 0, 0, -(3/2)*(1 + math.sqrt(5)), 0, 0, 0, + 0], [0, 0, 3/2*(1 + math.sqrt(5)), 0, 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, + 2 + math.sqrt(5), 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, + 0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, + 0], [0, 0, 5 + math.sqrt(5), 0, 0, 0, -1, 0, 0, 2*(2 + math.sqrt(5)), 0, 0, + 0, 0, 0, -1 - math.sqrt(5), 0, 0, 0, 0], [0, 0, 3/2*(1 + math.sqrt(5)), 0, 0, + 0, 1/2*(1 - math.sqrt(5)), 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(-5 - math.sqrt(5)), 0, 0, 0, 0], [0, 0, 1/2*(7 - math.sqrt(5)), 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 1/2*(3 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1/2*(3 - math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1/2*(1 + 3*math.sqrt(5)), 0, 0, 0, + 1/2*(1 - math.sqrt(5)), 0, 0, 3 + math.sqrt(5), 0, 0, 0, 0, 0, -1, 0, 0, 0, + 0], [0, 0, 1/2*(7 - math.sqrt(5)), 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, + 2 + math.sqrt(5), 0, 0, 0, 0, 0, 1 - math.sqrt(5), 0, 0, 0, 0], [0, 0, + 1/2*(11 + 3*math.sqrt(5)), 0, 0, 0, -1, 0, 0, 5 + 2*math.sqrt(5), 0, 0, 0, 0, + 0, 1/2*(-5 - 3*math.sqrt(5)), 0, 0, 0, 0], [0, 0, 4, 0, 0, 0, + 1/2*(-3 + math.sqrt(5)), 0, 0, 1/2*(3 + math.sqrt(5)), 0, 0, 0, 0, 0, + 1 - math.sqrt(5), 0, 0, 0, 0], [0, 0, 1/2*(1 + math.sqrt(5)), 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0], [0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, + 1/2*(11 + 3*math.sqrt(5)), 0, 0, 0, -1, 0, 0, 2*(2 + math.sqrt(5)), 0, 0, 0, + 0, 0, -(3/2)*(1 + math.sqrt(5)), 0, 0, 0, 0], [0, 0, 2*(1 + math.sqrt(5)), 0, + 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, 0, 0, + 0, -3 - math.sqrt(5), 0, 0, 0, 0], [0, 0, 3/2*(3 + math.sqrt(5)), 0, 0, 0, -1, + 0, 0, 3/2*(3 + math.sqrt(5)), 0, 0, 0, 0, 0, -1 - math.sqrt(5), 0, 0, 0, + 0], [0, 0, 4, 0, 0, 0, 1/2*(-3 + math.sqrt(5)), 0, 0, 3 + math.sqrt(5), 0, 0, + 0, 0, 0, 1/2*(-1 - 3*math.sqrt(5)), 0, 0, 0, 0]]), np.array([[0, 0, 0, 0, + 1/2*(11 + 5*math.sqrt(5)), 0, 2*(3 + math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), + 0, 0, 0, 0, 0, 0, 0, 0, -2*(2 + math.sqrt(5)), 0], [0, 0, 0, 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 1/2*(5 + 3*math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, + 0, 0, 0, 0, -2 - math.sqrt(5), 0], [0, 0, 0, 0, 2*(2 + math.sqrt(5)), 0, + 1/2*(7 + 3*math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(-7 - 3*math.sqrt(5)), 0], [0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, + 3 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, + 0, -1 - math.sqrt(5), 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(13 + 5*math.sqrt(5)), 0, + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0, 0, 1/2*(-11 - 5*math.sqrt(5)), 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1/2*(7 + 3*math.sqrt(5)), 0, + 2*(2 + math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(-7 - 3*math.sqrt(5)), 0], [0, 0, 0, 0, 1/2*(1 + math.sqrt(5)), 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0], [0, 0, 0, 0, + 2*(2 + math.sqrt(5)), 0, 2*(2 + math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, + 0, -2*(2 + math.sqrt(5)), 0], [0, 0, 0, 0, 1, 0, 1/2*(1 + math.sqrt(5)), 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/2*(-1 - math.sqrt(5)), 0], [0, 0, 0, 0, + 3 + math.sqrt(5), 0, 4 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, + 0, 0, 0, 0, 1/2*(-5 - 3*math.sqrt(5)), 0], [0, 0, 0, 0, + 1/2*(5 + 3*math.sqrt(5)), 0, 1/2*(7 + 3*math.sqrt(5)), 0, 0, -1, 0, 0, 0, 0, + 0, 0, 0, 0, -2 - math.sqrt(5), 0], [0, 0, 0, 0, 3 + math.sqrt(5), 0, + 1/2*(5 + math.sqrt(5)), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, + 0, -1 - math.sqrt(5), 0], [0, 0, 0, 0, 1/2*(13 + 5*math.sqrt(5)), 0, + 1/2*(11 + 5*math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0, 0, 1/2*(-9 - 5*math.sqrt(5)), 0], [0, 0, 0, 0, 4 + math.sqrt(5), 0, + 3 + math.sqrt(5), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(-5 - 3*math.sqrt(5)), 0], [0, 0, 0, 0, 1/2*(5 + math.sqrt(5)), 0, + 1/2*(5 + math.sqrt(5)), 0, 0, 1/2*(1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, 0, 0, + 1/2*(-1 - math.sqrt(5)), 0], [0, 0, 0, 0, 2*(3 + math.sqrt(5)), 0, + 1/2*(11 + 5*math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0, 0, -2*(2 + math.sqrt(5)), 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1/2*(11 + 5*math.sqrt(5)), 0, + 1/2*(13 + 5*math.sqrt(5)), 0, 0, 1/2*(-1 - math.sqrt(5)), 0, 0, 0, 0, 0, 0, + 0, 0, 1/2*(-9 - 5*math.sqrt(5)), 0]])] + + root = Node([-1, 2, 1/2*(11 + 5*math.sqrt(5)), 1/2*(23 + 9*math.sqrt(5)), 3/2*(7 + + 3*math.sqrt(5)), 3*(2 + math.sqrt(5)), 1/2*(27 + 13*math.sqrt(5)), 12 + + 5*math.sqrt(5), 1/2*(29 + 13*math.sqrt(5)), 13 + 5*math.sqrt(5), 18 + + 7*math.sqrt(5), 15 + 7*math.sqrt(5), 5 + 2*math.sqrt(5), 5 + + 2*math.sqrt(5), 1/2*(7 + math.sqrt(5)), 12 + + 5*math.sqrt(5), 2*(2 + math.sqrt(5)), 1/2*(5 + math.sqrt(5)), 11 + + 4*math.sqrt(5), 1/2*(13 + 5*math.sqrt(5))], [], words, False) + + #print(root.tuple) + #print(np.matmul(generators[0],root.tuple)) + current_leaves = [root] + nodes = 1 + while True: + new_leaves = [] + for leaf in current_leaves: + next_gen = leaf.next_generation(words, dc, generators) + new_leaves += next_gen + nodes += len(next_gen) if len(next_gen) > 1 else 0 + if current_leaves == new_leaves: + break + else: + current_leaves = new_leaves + for i,leaf in enumerate(current_leaves): + words[str(leaf.word)] = i + print(len(current_leaves), "partitions") + print(nodes,"nodes") + print("tree construction (s): %f\ntree construction (m): %f" % (time.time()-tt, (time.time()-tt)/60)) + return current_leaves + +def constructMatrix(words, dc): + leave = generateTree(words, dc) + row = [] + col = [] + data = [] + for i,leaf in enumerate(leave): + print(leaf.word) + thing = words[str(leaf.word[1:])] + if isinstance(thing,int): + row.append(i) + col.append(thing) + data.append(sampleValue(leaf.word)) + else: + sample = sampleValue(leaf.word) + for wor in thing.leaves(): + row.append(i) + col.append(words[str(wor.word)]) + data.append(sample) + return csr_matrix((data,(row,col)),shape=(len(leave),len(leave))) + +def secant(x0,y0,x1,y1,z): + return x0 - (y0-z) * ((x1-x0)/(y1-y0)) + +def matrixFunction(matrix,l,a): + #return np.real(eigs(matrix.power(a),k=1)[0][0]) + matrix = matrix.power(a) + vec = np.ones(l) + previous_entry = vec[0] + previous_val = 0 + current = matrix * vec + current_val = current[0] / previous_entry + count = 0 + while count < 10000000000 and abs(current_val - previous_val) > 1e-10: + previous_val = current_val + previous_entry = current[0] + current = matrix * current + #print(current[0],previous_entry) + current_val = current[0] / previous_entry + count += 1 + print("power method:", count) + return current_val + +def secantMethod(matrix,l,z,x1,x2,e,its): + k1 = x1 + k2 = x2 + y1 = matrixFunction(matrix,l,k1) + y2 = matrixFunction(matrix,l,k2) + #y1 = testFunction(k1) + #y2 = testFunction(k2) + count = 1 + print(count,k1,y1) + while abs(y1-z)>e and count 1 else 0 + if current_leaves == new_leaves: + break + else: + current_leaves = new_leaves + for i,leaf in enumerate(current_leaves): + words[str(leaf.word)] = i + print(len(current_leaves), "partitions") + print(nodes,"nodes") + print("tree construction (s): %f\ntree construction (m): %f" % (time.time()-tt, (time.time()-tt)/60)) + return current_leaves + +def constructMatrix(words, dc): + leave = generateTree(words, dc) + row = [] + col = [] + data = [] + for i,leaf in enumerate(leave): + thing = words[str(leaf.word[1:])] + if isinstance(thing,int): + row.append(i) + col.append(thing) + data.append(sampleValue(leaf.word)) + else: + sample = sampleValue(leaf.word) + for wor in thing.leaves(): + row.append(i) + col.append(words[str(wor.word)]) + data.append(sample) + return csr_matrix((data,(row,col)),shape=(len(leave),len(leave))) + +def secant(x0,y0,x1,y1,z): + return x0 - (y0-z) * ((x1-x0)/(y1-y0)) + +def matrixFunction(matrix,l,a): + #return np.real(eigs(matrix.power(a),k=1)[0][0]) + matrix = matrix.power(a) + vec = np.ones(l) + previous_entry = vec[0] + previous_val = 0 + current = matrix * vec + current_val = current[0] / previous_entry + count = 0 + while count < 10000000000 and abs(current_val - previous_val) > 1e-10: + previous_val = current_val + previous_entry = current[0] + current = matrix * current + #print(current[0],previous_entry) + current_val = current[0] / previous_entry + count += 1 + print("power method:", count) + return current_val + +def secantMethod(matrix,l,z,x1,x2,e,its): + k1 = x1 + k2 = x2 + y1 = matrixFunction(matrix,l,k1) + y2 = matrixFunction(matrix,l,k2) + #y1 = testFunction(k1) + #y2 = testFunction(k2) + count = 1 + print(count,k1,y1) + while abs(y1-z)>e and count