Esempio n. 1
0
def psi(t, eigenvalues, coefficients, f0=mp.mpf("1.0")):
    '''The nearly periodic function'''
    f = None

    if len(eigenvalues) == len(coefficients):
        f = [mp.expj(E*t) for E in eigenvalues]
        f = mp.fdot(coefficients, f)
        f = mp.fabs(f - f0)

    return(f)
Esempio n. 2
0
def R_final_kl(r, k, l, Z_eff):
    return 4 * pi * (2*k*r)**l * abs( mp.gamma(l+1 - 1j*Z_eff / k / a0) ) * mp.exp(pi * Z_eff /2/k/a0) / mp.factorial(2*l+1) * (mp.expj(-k*r) * mp.hyp1f1(l+1+1j*Z_eff/k/a0, (2*l+2), 2j*k*r, maxterms=1000000)).real
Esempio n. 3
0
 'asin': ['primitive', [lambda x, y: mp.asin(x), None]],
 'acos': ['primitive', [lambda x, y: mp.acos(x), None]],
 'atan': ['primitive', [lambda x, y: mp.atan(x), None]],
 'atan2': ['primitive', [lambda x, y: mp.atan2(y[0], x), None]],
 'asec': ['primitive', [lambda x, y: mp.asec(x), None]],
 'acsc': ['primitive', [lambda x, y: mp.acsc(x), None]],
 'acot': ['primitive', [lambda x, y: mp.acot(x), None]],
 'sinc': ['primitive', [lambda x, y: mp.sinc(x), None]],
 'sincpi': ['primitive', [lambda x, y: mp.sincpi(x), None]],
 'degrees': ['primitive', [lambda x, y: mp.degrees(x),
                           None]],  #radian - >degree 
 'radians': ['primitive', [lambda x, y: mp.radians(x),
                           None]],  #degree - >radian 
 #
 'exp': ['primitive', [lambda x, y: mp.exp(x), None]],
 'expj': ['primitive', [lambda x, y: mp.expj(x), None]],  #exp(x*i) 
 'expjpi': ['primitive', [lambda x, y: mp.expjpi(x), None]],  #exp(x*i*pi)
 'expm1': ['primitive', [lambda x, y: mp.expm1(x), None]],  #exp(x)-1
 'power': ['primitive', [lambda x, y: mp.power(x, y[0]), None]],
 'powm1': ['primitive', [lambda x, y: mp.powm1(x, y[0]),
                         None]],  #pow(x, y) - 1 
 'log': [
     'primitive',
     [lambda x, y: mp.log(x) if y is None else mp.log(x, y[0]), None]
 ],
 'ln': ['primitive', [lambda x, y: mp.ln(x), None]],
 'log10': ['primitive', [lambda x, y: mp.log10(x), None]],
 #
 'lambertw': [
     'primitive',
     [
Esempio n. 4
0
#Selection options for braidword sequences

overall_loss = 10000000
winning_matrix = 0
seq = 0
other_seq = 0

iterations = 50000

approx_matrix = np.array([[1/np.sqrt(2), 1/np.sqrt(2)], [1/np.sqrt(2), -1/np.sqrt(2)]])

braidword_length = 34

golden = (1 + 5**0.5)/2

row1 = [golden**(-1)*complex(mpmath.expj((4/5)*math.pi)), golden**(-0.5)*complex(mpmath.expj(-1*(3/5)*math.pi))]

row2 = [golden**(-0.5)*complex(mpmath.expj(-1*(3/5)*math.pi)), -1*golden**(-1)]
complex_boi = np.array([row1, [1, 0]])

braiding_matrices = [np.array([[complex(mpmath.expj(-1*(4/5)*np.pi)), 0], [0, complex(mpmath.expj((3/5)*np.pi))]]), complex_boi]
exp_selector = [-1, 1]

for i in range(0, iterations):

    total = np.random.choice(len(braiding_matrices), braidword_length)
    exponents = np.random.choice(exp_selector, braidword_length)

    #Loss function for computing the 'best matching' braidword
    def distance(matrix1, matrix2):
        matrix = np.conjugate(np.transpose(matrix2))