Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sympy import *
- def GLA(i,j,a):
- theta = Symbol('theta')
- chy = Symbol('chy')
- sy = Symbol('sy')
- t = Symbol('t')
- temp1 = 0
- temp2 = 0
- temp3 = 0
- sumTialpha = 0
- sumTjalpha = 0
- if a == 1:
- xa = 'theta'
- elif a == 2:
- xa = 'sy'
- elif a == 3:
- xa = 'chy'
- elif a == 4:
- xa = 't'
- csc = exp(-log(sin(theta)))
- gl = [ [-exp(4*t), 0, 0, 0],[0, -exp(4*t)*sin(theta)**2-exp(6*t)*cos(theta)**2, -exp(6*t)*cos(theta), 0],[0,-exp(6*t)*cos(theta),-exp(6*t),0],[0, 0, 0, 1]]
- #gl = [ [-exp(4*t), 0, 0, 0],[0, -exp(4*t) -exp(6*t)*(theta**2), -exp(6*t)*(theta), 0],[0,-exp(6*t)*(theta),-exp(6*t),0],[0, 0, 0, 1]]
- gL = [[-1, 0, 0 , 0],[0,-1*(1/(sin(theta))*sin(theta)),cos(theta)/(sin(theta)*sin(theta)),0],[0,cos(theta)/(sin(theta)*sin(theta)),-1*(1/(sin(theta)*sin(theta))),0],[0,0,0,1]]
- #gL = [[-1/exp(2*t), 0, 0 , 0],[0,-1/exp(2*t),theta/exp(2*t),0],[0,theta/exp(2*t),-(theta**2)/exp(2*t) - 1/exp(3*t),0],[0,0,0,1]]
- T = [[[0,0,0,0],[0,0,sin(theta)*0.5,0],[0,sin(theta)*0.5,0,0],[0,0,0,0]],[[0,0.5*cot(theta),-0.5*csc,0],[0.5*cot(theta),0,0,0],[-0.5*csc,0,0,0],[0,0,0,0]],[[0,-0.5*csc,0.5*cot(theta),0],[-0.5*csc,0,0,0],[0.5*cot(theta),0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]]
- #T = [[[0,0,0,0],[0,-theta,-0.5,0],[0,-0.5,0,0],[0,0,0,0]],[[0,theta*0.5,0.5,0],[theta*0.5,0,0,0],[0.5,0,0,0],[0,0,0,0]],[[0,(1-theta**2)*0.5,-theta*0.5,0],[(1-theta**2)*0.5,0,0,0],[-theta*0.5,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]]
- k = diff(gl[i-1][j-1],xa)
- while temp1 < 4:
- sumTialpha = sumTialpha + T[temp1][i-1][a-1]*gl[temp1][i-1]
- temp1 = temp1 + 1
- while temp2 < 4:
- sumTjalpha = sumTjalpha + T[temp2][j-1][a-1]*gl[temp2][j-1]
- temp2 = temp2 + 1
- return simplify(k - sumTialpha - sumTjalpha,ratio = 1.7)
- def glab(i,j,a,b):
- theta = Symbol('theta')
- chy = Symbol('chy')
- sy = Symbol('sy')
- t = Symbol('t')
- temp1 = 0
- temp2 = 0
- temp3 = 0
- sumTibeta = 0
- sumTjbeta = 0
- if a == 1:
- xa = 'theta'
- elif a == 2:
- xa = 'sy'
- elif a == 3:
- xa = 'chy'
- elif a == 4:
- xa = 't'
- #gl = [ [-1, 0, 0, 0],[0, -1, -cos(theta), 0],[0,-cos(theta),-1,0],[0, 0, 0, 1]]
- gl = [ [-exp(2*t), 0, 0, 0],[0, -exp(2*t) -exp(3*t)*(theta**2), -exp(3*t)*(theta), 0],[0,-exp(3*t)*(theta),-exp(3*t),0],[0, 0, 0, 1]]
- #gL = [[-1, 0, 0 , 0],[0,-1*(1/(sin(theta))*sin(theta)),cos(theta)/(sin(theta)*sin(theta)),0],[0,cos(theta)/(sin(theta)*sin(theta)),-1*(1/(sin(theta)*sin(theta))),0],[0,0,0,1]]
- gL = [[-1/exp(2*t), 0, 0 , 0],[0,-1/exp(2*t),theta/exp(2*t),0],[0,theta/exp(2*t),-(theta**2)/exp(2*t) - 1/exp(3*t),0],[0,0,0,1]]
- #T = [[[0,0,0],[0,0,sin(theta)/2],[0,0,0]],[[0,cos(theta)/(2*sin(theta)),-1/sin(theta)],[0,0,0],[0,0,0]],[[0,cos(theta)/(2*sin(theta)),-1/sin(theta)],[0,0,0],[0,0,0]]]
- T = [[[0,0,0],[0,-theta,-1/2],[0,-1/2,0]],[[0,theta/2,1/2],[theta/2,0,0],[1/2,0,0]],[[0,1/2 - (theta**2)/2,-(theta/2)],[1/2 - (theta**2)/2,0,0],[-theta/2,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]]
- gla = GLA(i,j,a)
- k = diff(gla,xa)
- while temp1 < 4:
- sumTibeta = sumTibeta + T[i-1][b-1][temp1-1]
- temp1 = temp1+1
- while temp2 < 4:
- sumTjbeta = sumTjbeta + T[j-1][b-1][temp2-1]
- temp2 = temp2+1
- return k - sumTibeta*gla - sumTjbeta*gla
Add Comment
Please, Sign In to add comment