#Given
#From fig. A-4(a) The given dimensions are
l1=8 #inch
l2=3 #inch
l3=10 #inch
l4=5 #inch
l5=11.5 #inch
l6=2 #inch
#calculation
ymean1=((l4*l3*l6)+(l5*l2*l1))/((l3*l6)+(l2*l1))
#From fig. A-4(b)
l1_=-8 #inch
l2_=3 #inch
l3_=10 #inch
l4_=-1.5 #
l5_=2 #inch
ymean2=((l4_*l2_*-l1_)+(l1_*l3_*l5_))/((l2_*-l1_)+(l3_*l5_))
d=ymean1-ymean2 #Depth of beam
#From fig. A-4(c)
la=8 #inch
lb=6.5 #inch
lc=10 #inch
ld=13 #
le=5 #inch
lf=3 #inch
ymean3=((lb*ld*la)-2*(le*lc*lf))/((ld*la-2*(lc*lf)))
print"Location of centroid in fig (a)is",ymean1,"inch"
print"Location of centroid in fig (b)is",ymean2,"inch"
print"Location of centroid in fig (c)is",ymean3,"inch"
#Given
#Dimension in the fig.A-7 a
#The given dimensions are
l1=8 #inch
l2=8.55 #inch
l3=10 #inch
l4=5 #inch
l5=1.5 #inch
l6=2 #inch
l7=4.45 #inch
#Calculation
Ix1=(1/12.0*l6*l3**3)
A1=l6*l3
dy1=(l2-l4)
Ix2=(1/12.0*l1*(l5+l5)**3)
A2=l1*(l5+l5)
dy2=(l7-l5)
I1=(Ix1+A1*dy1**2)+(Ix2+A2*dy2**2)
print I1
#Dimension in the fig.A-7 b
l1_= 13 #inch
l2_= 3 #inch
l3_=10 #inch
l4_=5 #inch
l5_= 2 #inch
l6_= 6.5 #inch
l7_=4.45 #inch
l8_=8.55 #inch
l9_=6.5 #inch
Ix1_=(1/12.0*l1_*(l2_+l5+l2_)**3)
A1_=l1_*(l2_+l5+l2_)
dy1_=(l8_-l9_)
Ix2_=(1/12.0*l2_*(l3_)**3)
A2_=l2_*(l3_)
dy2_=(l7_-l4_)
I2=(Ix1+A1*dy1**2)+(Ix2+A2*dy2**2)
#Result
print"Moment of inertia for fig a is",round(I1,0),"inch**4"
print"Moment of inertia for fig a is",round(I2,0),"inch**4"
#Given
#From fig A-8(a)
#The given dimensions are
l1=100 #mm
l2=400 #mm
l3=600 #mm
dx=250 #mm
dy=200 #mm
#Calculation
#Rectangle A:
Ix1=(1/12.0*l1*(l2-l1)**3)
Ady=(l1*(l2-l1)*dy**2)
Ix=(Ix1+Ady)
Iy1=(1/12.0*(l2-l1)*l1**3)
Adx=(l1*(l2-l1)*dx**2)
Iy=(Iy1+Adx)
#Rectangle B:
Ix_=(1/12.0*l3*l1**3)
Iy_=(1/12.0*l1*l3**3)
#Rectangle C
Ix3=(1/12.0*l1*(l2-l1)**3)
Ady_=(l1*(l2-l1)*200**2)
Ix3_=(Ix3+Ady_)
Iy3=(1/12.0*(l2-l1)*l1**3)
Adx_=(l1*(l2-l1)*dx**2)
Iy3_=(Iy3+Adx)
#Total Moment of inertia
Itx=(Ix+Ix_+Ix3_)
Ity=(Iy+Iy_+Iy3_)
#Result
print"Moment of inertia across x is ",Itx,"mm**4"
print"Moment of inertia across y is ",Ity,"mm**4"
#Given
#From fig A-12 a
#The given length of sides are
l1=100 #mm
l2=300 #mm
dy=200 #mm
dx=250 #mm
#Calculation
#Rectangle A
Ixy1=0
A1=l1*l2
Ixy1=Ixy1+A1*(-dx)*dy
#Rectangle B
Ixy2=0
A2=0
Ixy2=Ixy2+A2*dx*dy
#Rectangle D
Ixy3=0
A3=l1*l2
Ixy3=Ixy3+A3*(dx)*(-dy)
Ixy=Ixy1+Ixy2+Ixy3
#Result
print"The moment of inertia is",Ixy,"mm**4"
#Given
#From fig A-15 and From Example A.3 and A.4
Ix=2.9*10**9 #moment of inertia along x
Iy=5.6*10**9 #moment of inertia along y
Ixy=-3*10**9 #moment of inertia along xy
#Calculation
import math
#Using eq. A11
import math
thetaP1=1/2.0*math.atan(-Ixy*2/(Ix-Iy))*100
#As shown in fig. A-15
thetaP2=-32.9 #degree
Imax=(Ix+Iy)/2.0+math.sqrt((((Ix-Iy)/2.0)**2)+Ixy**2)
Imin=(Ix+Iy)/2.0-math.sqrt((((Ix-Iy)/2.0)**2)+Ixy**2)
#Result
print"Maximum moment of inertia is",Imax,"mm**4"
print"Minimum moment of inertia is",Imin,"mm**4"
#given
#From fig. A-17 a and Example A.3 and A.4
Ix=2.9*10**9 #mm**4, moment of inertia
Iy=5.6*10**9
Ixy=-3*10**9
#Calculation
import math
d=(Ix+Iy)/2.0 #distance of centre of circle
#from fig A-17 b
BC=1.35
AB=3
CA=math.sqrt(BC**2+AB**2)
#the circle intersect the I axis at point (7.54,0) and (0.960,0) hence
Imax=7.54*(10**9) #mm**4
Imin=0.960*(10**9) #mm**4
thetap1=1/2.0*(180-(math.atan(AB/BC))*180/math.pi)
#Result
print"The maximum moment of inertia is",Imax,"mm**4"
print"The minimum moment of inertia is",Imin,"mm**4"
print"The angle is ",round(thetap1,1)