#calculate lift using Energy method
##initialization of variables
import math
L=6000. ##cm
L1=150. ##cm
T=90. ##W
Ip=math.pi*10**4./32.
E=2*10**6 ##kg/cm^2
G=E/2.5
A=3. ##cm^2
delta=0.5
##calculations
U=L/(2.*E*A)+(T*T*L1/(2.*G*Ip))
## U=0.5*W*delta
W=0.25/U
##results
print'%s %.2f %s'%('W = ',W,' kg')
#find deflection under a load of one tonne at end
##initialization of variabes
import math
cA=10. ##cm^2
wA=5. ##cm^2
P=1. ##tonne
E=2*10**6 ##kg/cm^2
P=P*1000. ##kg
## calculations
U_up=P**2*200./(2.*E*cA)*1./math.sqrt(3)*(2.+4.+6.+8.+10.+12.)
U_do=P**2*200./(2.*E*cA)*1./math.sqrt(3)*(1.+3.+5.+7.+9.+11.+13./2.)
U_web=P**2*200./(2.*E*wA)*1./math.sqrt(3)*(2.*13.)
U=U_up+U_do+U_web
delta=U*2./(P)
## results
print'%s %.2f %s'%('deflection = ',delta,' cm')
#calculate deflection of loaded end due to same load of one tonne
a=2*10**8
b=69282032.302
c=136.5
d=28
aa=5
bb=15
BC=16.77
cc=56000
dd=1300
ee=20*10**6
#part(a)
AB=a*c/(b) #
print'%s %.2f %s'%('energy stored in Bd due to axial force ',AB,'kg-cm')
#Part(b)
Ubc=(b*b*aa)/(bb*bb)
UB=BC*100./(4.*10.)
UBC=Ubc*UB
Bc=730
print'%s %.2f %s'%('energy stored in Bd due to axial force ',Bc,'kg-cm')
#part(c)
AB=394 #
print'%s %.2f %s'%('energy stored in Bd due to axial force ',AB,'kg-cm')
#part(d)
Ebc=d*2/bb
#assuming that only chord memeber are taking axial stress then
BD=(cc/bb)**2*(dd/4*ee)
BD1=227
print'%s %.2f %s'%('energy stored in Bd due to axial force ',BD1,'kg-cm')
#total energy
TE=BD1+AB+Bc+AB
delta=(2*TE)/(1000.)
print'%s %.2f %s'%('total energy stored in Bd due to axial force ',delta,'kg-cm')
#calculate stresses in steel and stress in cloth laminate
##initialization of variables
import math
L=1. ##m
w=10. ##kg
h=50. ##cm
A=1. ##cm^2
E=2*10**6 ##kg/cm^2
Ar=1 ##cm^2
Ec=3*10**4 ##kg/cm^2
## For steel
D=w*L*100./(A*E)
P=w*(1+math.sqrt(1.+(2.*h/D)))
print'%s %.2f %s'%('Stress in steeel = ',P,' kg/cm^2 ')
## for cloth laminate
D=w*L*100./(A*Ec)
P=w*(1+math.sqrt(1.+(2.*h/D)))
print'%s %.2f %s'%('\n Stress in cloth laminate = ',P,' kg/cm^2 ')
#calculate maximum stress in wood and divers feet in all parts
##initialization of variables
import math
w=64. ##kg
H=60. ##cm
b=40. ##cm
h=5. ##cm
E=0.12*10**6 ##kg/cm^2
Es=2*10**6 ##kg/cm^2
## for part (a) and (b)
I=b*h**3./12.
D=4.*w*120**3/(E*I)
P=w*(1+math.sqrt(1.+(2.*H/D)))
str=P*240.*6./(b*h**2.)
print('part (a) and (b)')
print'%s %.2f %s'%('\n Maximum stress in wood = ',str,' kg/cm^2')
print'%s %.2f %s'%('\n Max. force on divers feet =',P,' kg')
##for part (c)
Ixx=I*E/Es
Zxx=19.4 ##cm^2
Ixx=72.7 ##cm^4
D=4*w*120**3/(Es*Ixx)
P=w*(1+math.sqrt(1.+(2.*H/D)))
str=P*240./Zxx
## results
print('\n part (c)')
print'%s %.2f %s'%('\n Maximum stress in steel = ',str,' kg/cm^2')
print'%s %.2f %s'%('\n Max. force on divers feet =',P,' kg')
print('\n Hence wood is better than steel')
print('wrong calculations in some parts')
#calculate central deflection
##initialization of variables
A=100. ##cm^2
E=2*10**6 ##kg/cm^2
## calculations
D=1093.5*10**6/(E*A)
## 1093.5 from the table
## results
print'%s %.2f %s'%('Central deflection = ',D,' mm')
#calculate deflection
##initialization of variables
T=30. ##degree celcius
alpha=0.0000117 ## per degree celcius
##AB
L=6. ##m
dl=T*alpha*L
df=0.375 ##kg
tot=dl*df
##BC
dl=T*alpha*L
df=0.375 ##kg
tot=tot+dl*df
##CD
dl=T*alpha*L
df=0.75 ##kg
tot=tot+dl*df
tot=tot*100.*2.
## results
print'%s %.2f %s'%('The deflection is ',tot,' cm')