##calculate the shear centre of cross section
## initialization of variables
import math
t=4. ##mm
## calculations
l1=100. ##mm See figure
l2=50. ##mm See figure
ybar=125. ##mm
t=t*10**-3
ybar=ybar*10**-3
l1=l1*10**-3
l2=l2*10**-3
Ix=2.*t*(2.*(l1+l2))**3/12.-t*(2.*l1)**3/12.
qAk=l1*t*ybar ## qA=qAk*V
qBk=qAk+l1*t*l1/2.
qave=qAk+2/3*(qBk-qAk)
F2k=200.*qave*10**-3 ##F2=F2k*V
DO=100./math.tan(30.*math.pi/180.) ## from figure
## Now we need to solve the following equation
## (DO-e)*V=DO*F2
e=DO*(1.-F2k/Ix)
print"%s %.2f %s"%('e = ',e/2,' mm')
##calculate the shear centre
## initialization of variables
import math
import numpy
## Defining the legs
a=50. ##mm Top horizontal leg
b=100. ##mm Verical leg
c=100. ##mm bottom leg
t=4. ##mm
Ix=1.734e6 ##mm**4
Iy=0.876e6 ##mm**4
Ixy=-0.5e6 ##mm**4
I=numpy.matrix([[Ix, Ixy],[Ixy ,Iy]])
theta=1./2.*math.atan(-2.*Ixy/(Ix-Iy))
Q=numpy.matrix([[math.cos(theta), -math.sin(theta)],[math.sin(theta), math.cos(theta)]])
I1=numpy.transpose(Q)
I__1=(Q*I)
I_1=numpy.dot((I1),I__1)#I_1=numpy.matrix([[IX, IXY],[IXY ,IY]])
## Finding out the centroidal coordinates
## We have x_bar = Summation(Ai*Xi)/Summation(Ai)
## We take D as reference
Aa=a*t
Ab=b*t
Ac=c*t
A=Aa+Ab+Ac
x_D=((Ac*c/2.)+(Aa*a/2.))/A
y_D=((Ab*b/2.)+(Aa*b))/A
##Finding out B coordinates
xb=a-x_D
yb=b-y_D
X1=numpy.transpose(Q)
X=numpy.dot((Q),I) ##New coordinates of B in transformed system
def func(l):
y=t*l/I_1[0]*(X[1]+1/2.*l*math.sin(theta)),
F3=0.1299425 ## This is the coefficient of VY
e_X=b*F3
print"%s %.2f %s"%('eX = ',e_X,' mm')
## To find eY
def func(l1):
y1=t*l1/I_1[3]*(X[0]-1/2*l*math.cos(theta)),
F3=0.2524810 ## This is the coefficient of VX
e_Y=b*F3
print"%s %.2f %s"%('\n eY = ',e_Y,' mm')
#due to rounding of error we cannot calculate co-ordinates
import math
## initialization of variables
##calculate the shear centre
t1=1 ##mm
t2=2 ##mm
oT=9.67 ##mm distance between base and the centroid of each T-ection
y2_bar=100.+10.+1.+oT ##mm (follwos from the figure)
A1=400. ##mm**2
y1_bar=100. ##mm
A2=324. ##mm**2
Ix=2.*A1*y1_bar**2.+2.*A2*y2_bar**2.
q1k=A2*y2_bar ##q1=q1k*Vy/Ix
F1k=(oT+t1/2.)*q1k ## Fi=Fik*Vy/Ix
F2k=60.*q1k
F3k=(10.+t1/2.)*q1k
q2k=q1k+(A1*y1_bar)
F4k=(10.+t2/2.)*q2k
F5k=200.*q2k
V_pk=2*(F1k+2.*F3k+F5k)/Ix ## V_p=V_pk*Vy
e=(-2*F1k*71.-2.*F3k*11.+F2k*221+F4k*200)/Ix
print"%s %.2f %s"%('e = ',e,' mm')
import math
## initialization of variables
##calculate the shear centre of cross section
b=300. ##mm
h=500. ##mm
t1=20. ##mm
t2=10. ##mm
t3=t2
Ix=687.5e+06 ##mm**4
q_P=b*t2*h/2.
q_Q=q_P+h/2.*t1*h/4.
q_S=h/2.*t3*h/4.
q_A=-1./(h/t1+b/t2+h/t3+b/t2)*((-q_P-2./3.*(q_Q-q_P))*h/t1-q_P/2.*b/t2+2./3.*q_S*h/t3-q_P/2.*b/t2)
e=1/Ix*((444.4+2/3*625.)*b*h+444.4/2*177.76*h-q_A/(1000.*2.)*122.24*h)
V1=(q_P-q_A+2./3.*(q_Q-q_P))*h
V2=(q_A+2./3.*q_S)*h
V=V1+V2
print"%s %.2f %s"%('e = ',e*10**3,' mm')
print"%s %.2f %s"%('\n V = ',V/1000,' kN')
import math
import numpy
## initialization of variables
##calculate the location of shear centre
a=500. ##mm
b=a
t1=5. ##mm
t2=10. ##mm
t3=20. ##mm
## calculations
Ix=2343.75e+06##mm^4
q_B=b*t2*a/2.
q_C=q_B+a/2.*t1*a/4.
q_S=a/2.*t3*a/4.
q_G=2.*b*t2*a/2.
q_H=q_G+a/2.*t3*a/4.
## th_L = th_R = 0
## Writing the above in following form
##Ab=c ; b={q_A q_F}
A11=a/t1+b/t2+a/t3+b/t2
A12=a/t3
c1=(q_B+2./3.*(q_C-q_B))*a/t1 + 1./2.*q_B*b/t2 - 2./3.*q_S*a/t3 + 1./2.*q_B*b/t2
A21=A12
A22=a/t3+2.*b/t2+a/t3+2.*b/t2
c2=(q_G+2/3.*(q_H-q_G))*a/t3+1/2.*q_G*2.*b/t2-2/3.*q_S*a/t3+1/2.*q_G*2*b/t2
A=numpy.matrix([[A11, A12], [A21, A22]])
c=numpy.matrix([[c1], [c2]])
b=numpy.dot(numpy.linalg.inv(A),c)
q_A=b[0]/1000. ##kN/mm
q_F=b[1]/1000. ##kN/mm
q_B=q_B/1000.
q_C=q_C/1000.
q_S=q_S/1000.
q_G=q_G/1000.
q_H=q_H/1000.
b=a ## rewriting to it's initival value
## To find out e, balance the moments
e=-((q_B-q_A+2./3.*(q_C-q_A-(q_B-q_A)))*a*b + 1./2.*(q_B-q_A)*219.1*a - 1/2.*q_A*280.9*a + 1/2.*q_F*471.9*a -1/2.*(q_G-q_F)*528.1*a-(q_G-q_F+2./3.*(q_H-q_F-(q_G-q_F)))*a*2.*b)
e=e/Ix
print"%s %.2f %s"%('e = ',e*10**3,' mm')
## Wrong answer in the text