#Given
sigma_y = 44 #stress ,ksi
db =0.731 #inch, diameter
rb = db/2.0 #radius
import math
Ab = math.pi*(rb**2)
E = 29*10**3 #N/mm**2, stress
da1 = 0.875 #inch, diameter
ra1 = da1/2.0
La1 = 2 #inch
La2= 0.25 #inch
da2 =0.731 #inch
ra2 = da2/2.0
Lb = 2.25 #inch
#Calculation
#Bolt A
Aa2 = math.pi*(ra2**2)
Aa1 = math.pi*(ra1**2)
P_max = sigma_y*Ab
Uia = (P_max**2/(2*E))*(La1/Aa1 + La2/Aa2) #Ui = (N**2L)/(2AE)
#Bolt B
Uib = (P_max**2/(2*E))*(Lb/Ab)
#Display
print'The greatest amount of strain energy absorbed by bolt A = ',round(Uia,4),"J"
print'The greatest amount of strain energy absorbed by bolt B = ',round(Uib,4),"J"
#Given
G = 75*10**9 #N/m**2, stress
ro = 80/1000.0 #m, outside radius
t = 15/1000.0 #m, thickness
ri = ro - t #inside radius
l1 = 750/1000.0 #m, length
l2 = 300/1000.0 #m
T1 = 40 #Nm. torque
T2 =15 #Nm
#Calculations
import math
J = (math.pi/2.0)*(ro**4 - ri**4)
#Eqn 14-22
U1 = (T1**2*l1)/(2*G*J)
U2 = (T2**2*l2)/(2*G*J)
Ui = U1 + U2
Ui = Ui*10**6 #in micro Joule
#Display
print'The strain energy stored in the shaft = ',round(Ui,0),"micro J"
#Given:
F=5.0 #kip, horizontal distance
A=0.20 #inch**2, area
E=29*10**3 #ksi, stress
Nab=2.89 #kip, normal stress
Nac=5.77 #kip
L1=2 #ft, length
L2=4 #ft
L3=3.46 #ft
#calculation
#Appling equation 14-24
dBh=(Nab**2*L1/(2*A*E)+(-Nac)**2*L2/(2*A*E)+F**2*L3/(2*A*E))*(2/F)
#result
print"The horizontal displacement is",round(dBh*12,4),"inch"
#Given
ro = 3 #inch, outside radius
ri = 2.5 #inch, inside radius
E = 10*10**3 #ksi, stress
W = 150 #kip, force
L = 12 #inch, length
h = 0
#Part a
import math
A = (math.pi)*(ro**2 - ri**2)
del_st= (W*L)/(A*E)
#Part b
del_max = del_st*(1 + math.sqrt(1 + 2*(h/del_st)))
#Display
print'The maximum displacement at the top of the pipe for gradually applied load = ',round(del_st,4),"inch"
print'The maximum displacement at the top of the pipe for suddenly applied load = ',round(del_max,4),"inch"
#Given
W = 1.5 #kip, force
h = 2 #inch, height
E = 29*1000 #N/mm**2, stress
L = 16 #ft, length
I = 209 #inch**2, area
#Calculations
import math
del_st = (W*L**3*12**3)/(48*E*I)
del_max = del_st*(1 + math.sqrt(1 + 2*(h/del_st)))
c = 9.92/2.0
Pmax=48*E*I/(L**3*12**3)
Mmax=Pmax*L/4.0
sigma_max = (12*E*del_max*c)/(L**2*12**2)
#Display
print'The maximum bending stress in the steel beam = ',round(sigma_max,1),"ksi"
print'The maximum deflection in the beam = ',round(del_max,2),"inch"
#Given
m = 80*1000 #kg
v = 0.2 #m/s
l_ac = 1.5 #m
E = 200*10**9 #N/m**2
w = 0.2 #m
I = (1/12.0)*(w**4)
l_ab = 1000 #mm
#Calculations
import math
del_Amax = math.sqrt((m*v**2*l_ac**3)/(3*E*I))
P_max = (3*E*I*del_Amax)/(l_ac**3)
theta_A = (P_max*l_ac**2)/(2*E*I)
del_Amax = del_Amax*1000
del_Bmax = del_Amax + (theta_A*l_ab)
#Display
print'The maximum horizontal displacement of the post at B due to impact =',round(del_Bmax,2),"mm"
#Given
A = 400*10**-6 #m**2
E = 200*10**6 #kN/m**2
P = 100 #kN
#Virtual Work Equation
n1 = 0
n2=0
n3=-1.414
n4=1
N1=-100
N2=-141.4
N3=-141.4
N4=200
L1=4
L2=2.828
L3=2.828
L4=2
Sum=n1*N1*L1+n2*N2*L2+n3*N3*L3+n4*N4*L4
del_cv = Sum/(A*E)
#Display
print'The vertical displacement of joint C of the steel truss ',round(del_cv*1000,1),"mm"
#given
A=250*10**(-6) #m**2
E=200*10**6 #pa
alpha=12*10**(-6)
l=4 #m
l1=-1.155 #KN
l2=-12 #KN
#calculation
x=0 #x=n*N*L/A*E
y=0 #y=n*alpha*delta*T*L
z=(l1*l2*l)/(A*E)
deltabh=(x+y+z)
#result
print "The horizontal displacement is ",round(deltabh*1000,2),"m"
#Given
E = 200*10**6 #kN/m**2
P = 0 #N
A = 400*10**-6 #m**2
#Calculation
N_by_P1 = 0
N_by_P2=0
N_by_P3=-1.414
N_by_P4=1
L1=4
L2=2.828
L3=2.828
L4=2
N1=-100
N2=141.4
N3=-141.4
N4=200
Sum = N_by_P1*L1*N1+N_by_P2*L2*N2+N_by_P3*L3*N3+N_by_P4*L4*N4
del_ch = Sum/(E*A)
#Display
print'The vertical displacement of joint C of the steel truss =',round(del_ch*1000,1),"mm"