import math
#NOTE:The notation has been changed to simplify the coding process
#Variable Decleration
P_AB=4000 #Axial Force at section 1 in lb
P_BC=5000 #Axial Force at section 2 in lb
P_CD=7000 #Axial Force at section 3 in lb
A_1=1.2 #Area at section 1 in in^2
A_2=1.8 #Area at section 2 in in^2
A_3=1.6 #Area at section 3 in in^2
#Calculation
#S indicates sigma here
S_AB=P_AB/A_1 #Stress at section 1 in psi (T)
S_BC=P_BC/A_2 #Stress at section 2 in psi (C)
S_CD=P_CD/A_3 #Stress at section 3 in psi (C)
#Result
print "The stress at the three sections is given as"
print "Stress at section 1=",round(S_AB),"section 2=",round(S_BC),"section 3=",S_CD
#NOTE:The answer for the following example for section 1 and section 2
#are incorrect due to rounding in the textbook
#Computed values are correct
import math
#Variable Decleration
Ay=40 #Vertical Reaction at A in kN
Hy=60 #Vertical Reaction at H in kN
Hx=0 #Horizontal Reaction at H in kN
y=3 #Height in m
x=5 #Distance in m
p=4 #Panel distance in m
A=900 #Area of the member in mm^2
P_C=30 #Force at point C in kN
#Calculation
#Part 1
#Applying summation of forces in the x and y direction and equating to zero
P_AB=(-Ay)*(x*y**-1) #Force in member AB in kN
P_AC=-(p*x**-1*P_AB) #Force in member AC in kN
#Using stress=force/area
S_AC=(P_AC/A)*10**3 #Stress in member AC in MPa (T)
#Part 2
#Sum of moments about point E to zero
P_BD=(Ay*p*2-(P_C*p))*y**-1 #Force in memeber AB in kN (C)
S_BD=(P_BD/A)*10**3 #Stress in member in MPa (C)
#Result
print "The Stress in member AC is",round(S_AC,1),"MPa (T)"
print "The Stress in member BD is",round(S_BD,1),"MPa (C)"
import math
import numpy as num
#Variable Decleration
A_AB=800 #Area of member AB in m^2
A_AC=400 #Area of member AC in m^2
W_AB=110 #Safe value of stress in Pa for AB
W_AC=120 #Safe value of stress in Pa for AC
theta1=60*3.14*180**-1 #Angle in radians
theta2=40*3.14*180**-1 #Angle in radians
#Calculations
#Applying sum of forces
#Solving by matrix method putting W as 1
A=num.array([[-cos(theta1),cos(theta2)],[sin(theta1),sin(theta2)]])
B=num.array([[1],[1]])
C=inv(A)
D=C*B
#Using newtons third law
#Two values of W hence the change in the notation
W1=(W_AB*A_AB)*(D[1,1])**-1 #Weight W in N
W2=(W_AC*A_AC)*(D[0,1])**-1 #Weight W in N
#Result
print "The maximum value of W allowable is",round(W2*1000**-1,1),"kN"
import math
#Variable Decleration
d=3*4**-1 #Rivet diameter in inches
t=7*8**-1 #Thickness of the plate in inches
tau=14000 #Shear stress limit in psi
sigma_b=18000 #Normal stress limit in psi
#Calculations
#Design Shear Stress in Rivets
V=tau*(d**2*(pi/4))*4 #Shear force maximum allowable in lb
#Design for bearing stress in plate
Pb=sigma_b*t*d*4 #lb
#Result
print "The maximum load that the joint can carry is",round(V),"lb"
#NOTE:The answer in the textbook is off by 40lb