#Given
shear_v = 3000 #N - Transmitted vetical shear
shear_al = 700 #N - The maximum allowable
#We will divide this into two parts
l_1 = 50.0 #mm
l_2 = 200.0 #mm
b_1 = 200.0 #mm
b_2 = 50.0 #mm
A_1 = l_1* b_1 #mm2 - area of part_1
y_1 = 25.0 #mm com distance
A_2 =l_2*b_2 #mm2 - area of part_1
y_2 = 150.0 #in com distance
y_net = (A_1*y_1 +A_2*y_2)/(A_1+A_2) #mm - The com of the whole system
c_max = (4-y_net) #mm - The maximum distace from com to end
c_min = y_net #mm - the minimum distance from com to end
I_1 = b_1*(l_1**3)/12 + A_1*((y_1-y_net)**2) #Parallel axis theorm
I_2 = b_2*(l_2**3)/12 + A_2*((y_2-y_net)**2)
I_net = I_1 + I_2 #mm4 - the total moment of inertia
Q = A_1*(-y_1+y_net) #mm3
q = shear_v*Q/I_net #N/mm - Shear flow
d = shear_al/q # The space between the nails
print "The minimal space between the nails ",round(d,0) ,"mm"
#Given
l = 6 #m -length of the beam
p = 3 #KN-m _ the load applied
R_a = l*p/2 #KN -The reaction at a, Since the system is symmetry
R_b = l*p/2 #KN -The reaction at b
l_s = 10 #mm - The length of the screw
shear_al = 2 #KN - The maximum load the screw can take
I = 2.36*(10**9) #mm2 The moment of inertia of the whole system
#We will divide this into two parts
l_1 = 50.0 #mm
l_2 = 50.0 #mm
b_1 = 100.0 #mm
b_2 = 200.0 #mm
A_1 = l_1* b_1 #in2 - area of part_1
y_1 = 200.0 #mm com distance
A_2 =l_2*b_2 #mm2 - area of part_1
y_2 = 225.0 #in com distance
Q = 2*A_1*y_1 + A_2*y_2 # mm3 For the whole system
q = R_a*Q*(10**3)/I #N/mm The shear flow
d = shear_al*(10**3)/q #mm The space between the nails
print "The minimal space between the nails ",round(d,0),"mm"
#Given
#we will divide this into two equal parts and other part
l = 10.0 # in - The height
t = 0.1 # in - The width
b = 5.0 #mm- The width of the above part
A = t* b #in2 - area of part
y_net = l/2 # The com of the system
y_1 = l # The position of teh com of part_2
I_1 = t*(l**3)/12 #in4 The moment of inertia of part 1
I_2 = 2*A*((y_1-y_net)**2) #in4 The moment of inertia of part 2
I = I_1 + I_2 #in4 The moment of inertia
e = (b**2)*(l**2)*t/(4*I) #in the formula of channels
l_sc = e - t/2 #in- The shear centre
print "The shear centre from outside vertical face is ",l_sc ,"in"
#Given
dia = 10.0 #mm - The diameter of the cylinder
c = dia/2 #mm - the radius of the cylinder
A = 3.14*(c**2) #mm2 The area of the crossection
y = 4*c/(3*3.14) #mm The com of cylinder
I = 3.14*(c**4)/4 #mm4 - The moment of inertia of the cylinder
j = 3.14*(dia**4)/32 #mm4
T = 20.0 #N.m - The torque
V = 250.0 #N - The shear
M = 25.0 #N-m The bending moment
Q = A*y/2 #mm
stress_dmax = 4*V/(3*A) #V*Q/(I*d) #Mpa The direct maximum stress
stress_tmax = T*c*(10**3)/j #-Mpa The torsion maximum stress
stress_total = stress_dmax + stress_tmax #Mpa The total stress
print "The direct maximum stress",round(stress_dmax,2),"Mpa"
print "The torsion maximum stress",round(stress_tmax,2),"Mpa"
print "The total stress",round(stress_total,2),"Mpa"
#Given
dia = 15 #mm - The diameter of the rod
h = 0.5 #mt - The freely falling height
A = 3.14*(dia**2)/4 #mm2 The area of the crossection
E = 200 #Gpa -Youngs modulus
L = 750 #mm - The total length of the rod
G = 80 #gpa - Shear modulus
N = 10 #number of live coils
d = 5 #mm the diameter of live coil
m = 3 # the mass of freely falling body
H = 500 #mm -from mass to spring
F= m*9.81 #Kg the force due to that mass
p = 3 #KN-m _ the load applied
#e = e_rod + e_spr
#e_rod
e_rod = p*L*(10**-3)/(A*E) #mm The elongation due to freely falling body
#e_spr
e_spr = 64*F*(dia**3)*N*(10**-3)/(G*(d**4)) #mm The elongation due to spring
e = e_rod + e_spr #mm The total elongation
p_dyn =F*(1+pow((1+(2*H/e)),0.5))
Stress_max = p_dyn/A #MPa - The maximum stress in the system
print "The maximum stress in the system ",round(Stress_max,2),"Mpa"