import math
import numpy as np
#Initilization of variables
F1=2000 #lb
F2=4000 #lb
l1=10 #ft
l2=30 #ft
l3=20 #ft
l4=40 #ft
# as t=60 degrees
sint=sqrt(3)*2**-1
cost=2**-1
#Calculations
#Taking moment about point B and A
Ra=(F1*l2+F2*l1)/l4
Rb=(F2*l2+F1*l1)/l4
#Consider fig 7-4(c)
A=np.array([[1,-cost],[0,-sint]])
B=np.array([[0],[-2500]])
C=np.linalg.solve(A,B)
#Consider figure 7-4(d)
A1=np.array([[1,cost],[0,-sint]])
B1=np.array([-C[1]*cost,-C[1]*sint+F1])
C1=np.linalg.solve(A1,B1)
#Consider figure 7-4(e)
CD=577
CE=C[0]+C1[1]*cost+CD*cost
#Consider figure 7-4(f)
DE=Rb/sint
#Result
print'The reactions are:Ra=',round(Ra),"lb",'and Rb=',round(Rb),"lb"
print'Force in member AB=',round(C[1]),"lb (C)",'and AC=',round(C[0]),"lb (T)"
print'Force in member BC=',round(C1[1]),"lb (T)",'and BD=',round(C1[0]),"lb (-ve sign indicates compression)"
print'Force in member CD=',round(CD),"lb (C)",'and CE=',round(CE),"lb (T)"
print'Force in member DE=',round(DE),"lb (C)"
#Decimal Accuracy causes discrepancy in answers.Thus answers wary as compared to the textbook.
import math
#Initilization of variables
s=4 #m length of sides
l=2 #kN load acting on each node
r=7 #kN by inspection reaction at A
sin60=sqrt(3)*2**-1
tan30=sqrt(3)**-1
tan60=sqrt(3)
#Calculation
#Taking Moment about point G
FH=(-r*12+2*10+2*6+2*2)/(2*tan60) #kN Compressive
#Taking moment about point H
GI=(r*14-2*12-2*8-2*4)/(2*tan30) #kN Tension
#Summing forces in the vertical direction
HG=-(r-(l*3))/sin60 #kN Compression
#Taking moment about point J yields
IK=(-2*4-2*8+r*10)/(2*tan60) #kN
#Result
print'The value of the forces in the components are as follows'
print'FH=',round(FH,1),"kN (C)",',GI=',round(GI,1),"kN (T)",',HG=',round(HG,2),"kN (C)",'and IK=',round(IK,1),"kN (T)"
print'The answer in the text book for GI is wrong'
import math
#Initilization of variables
# as theta=30 degrees,
sin30=2**-1
EF=40000 #lb
l=36 #feet
#Calculation
#Taking moment about point D and setting EF=40000lbs
P=-(EF*sin30*l)/l #lb
#Result
print'The maximum value of P is',round(P),"lb"
print'The negative sign indicates the downward direction'
import math
#Initilization of variables
l=12 #m
# as theta1=30 degrees
cos30=sqrt(3)*2**-1
cos60=2**-1
sin30=2**-1
F1=1000 #N
F2=2000 #N
#Calculation
FG=l*cos30 #m
DG=(l+(l/2))/cos30 #m
#Taking moment about point G
A=(F1*l+F2*FG+F1*DG)/(l*3) #N
#Summing forces in horizontal direction
G_x=(2*F1+F2)*sin30 #N
#Summing forces in the vertical direction
G_y=(2*F1+F2)*cos30+F1-A #N
#Taking moment about point C
BD=-(A*l)/(l/2) #N
#Taking moment about point D
CE=(A*(l+(l/2)))/FG #N
theta=arctan((l/2)/FG) #degrees
#Summing forces in the vertical direction
CD=(A+(BD*cos60))/cos(theta) #N
#Result
print'The values of the forces are as follows'
print'A=',round(A),"N",',G_x=',round(G_x),"N",',G_y=',round(G_y),"N",',BD=',round(BD),"N (C)",',CE=',round(CE),"N (T)",'and CD=',round(CD),"N(T)"
#Decimal Accuracy causes discrepancy in answers
import math
#Initilization of variables
A=2000 #lb
E=2000 #lb
# as theta=60 degrees and theta1=30 degrees, which means:
sin60=sqrt(3)*2**-1
cos60=2**-1
sin30=2**-1
cos30=sqrt(3)*2**-1
#Sign convention positive means Tension and negative means Compression
#Taking sum of forces along x and y direction in fig7-13
AB=-A/sin60 #lb
AG=-AB*cos60 #lb
#Taking sum of forces along x and y direction in fig7-14
BG=((-AB*cos30)-1000)/(cos30) #lb
BC=((AB*sin30)-(BG*sin30)) #lb
#Taking sum of forces along x and y direction in fig7-15
GC=-(BG*sin60)/sin60 #lb
GF=AG+BG*cos60-GC*(cos60) #lb
#By symmetry of structure
DE=AB #lb
FE=AG #lb
DF=BG #lb
CD=BC #lb
#Result
print'The forces in the truess are'
print'AB=DE=',round(AB),"lb (C)",',AG=FE=',round(AG),"lb (T)",',BG=DF=',round(BG),"lb (T)",',BC=CD=',round(BC),"lb (C)",'and CG=CF=',round(GC),"lb (C)"
import math
#Initilization of variables
F=500 #N
A=1000 #N
# as theta=60 degrees,
sin60=sqrt(3)*2**-1
l=20 #m
#Calculations
#Taking moment about point G
R_c=(20*3*A+50*F+30*F+10*F)/40 #N
#Returning to fig7-17
#Taking moment about point C
BD=(l*A+(l/2)*F)/(l*sin60) #N
#Taking sum of forces in vertical direction
CD=(A+F-R_c)/sin60 #N
#Result
print'The forces in the members are as follows'
print'BD=',round(BD),"N (T)",'and CD=',round(CD),"N (C).",'Also the reaction at C is',round(R_c),"N"
#Decimal accuracy causes discrepancey in answers
import math
#Initilization of variables
w=800 #lb/ft
a=600 #ft
d=40 #ft
#Calculations
T=0.5*w*a*(sqrt(1+(a**2/(16*d**2)))) #lb
H=(w*a**2)/(8*d) #lb
#Taking the first two terms of the series
l=a*(1+(8/3)*(d*a**-1)**2-(32/5)*0.00002) #ft
#Result
print'The value of T=',round(T),"lb",'and that of H=',round(H),"lb.",'Also l=',round(l),"ft"
#Deciaml accuracy causes discrepancy in answers
import math
#Initilization of variables
l=800*300 #lb
#Calculations
#Summing forces in horizontal and vertical direction
theta=arctan(40*150**-1) #degrees
H=l/tan(theta) #lb
T_max=sqrt(l**2+H**2) #lb
#Result
print'The maximun tension is',round(T_max),"lb",'and H=',round(H),"lb"
#Decimal accuracy causes discrepancy in answers
import math
#Initilization of variables
#For simplicity a1 and a2 values are being considered as constant free of H
a_1=sqrt(10*14.7**-1)
a_2=sqrt(30/14.7)
y=10 #m
#Calculations
H=(300/(a_1+a_2))**2 #N
#Now reconsidering a1 and a2 actual values
a1=a_1*sqrt(H) #m
a2=a_2*sqrt(H) #m
#Theta calculations
x=a1
theta=arctan(2*y/x)
#T calculations
T=sqrt((864*a2**2)+H**2) #N
#Result
print'The tension in the cable is',round(T,2),"*10**-3 kN"
# The answer may wary due to decimal point descrepancy
import math
#Initilization of variables
T=140000 #N
w=2000 #N/m
a=20 #m
#Calculations
#Calculation step by step
lhs=(140000*2)*(2000*20)**-1
d=sqrt(1/((((lhs**2)-1)*16)/(20**2))) #m
l=a*(1+(8/3)*(d/a)**2) #m
#Result
print'The sag in the cable is',round(d,2),"m"
print'The required length is',round(l,2),"m"
# Value of l is off by 0.2 m
import math
#Initilization of variables
w=10*16**-1 #lb/ft
a=80 #ft
P=500 #lb
#Calculations
lhs=(P*2)/(w*a)
d=sqrt(1*((((lhs**2)-1)*16)/(80**2))**-1) #ft
#Result
print'The sag in the cable is',round(d),"ft"
import math
%matplotlib inline
#Initilization of variables
w=0.518 #lb/ft
d=50 #ft
l=500 #ft
#Plot coding
A=linspace(0,800,9) #defined x axis
B=A+50
C=[50000,500*(2*100)**-1,500*(2*200)**-1,500*(2*300)**-1,500*(2*400)**-1,500*(2*500)**-1,500*(2*600)**-1,500*(2*700)**-1,500*(2*800)**-1]
D=cosh(C)
E=([D[0]*A[0],D[1]*A[1],D[2]*A[2],D[3]*A[3],D[4]*A[4],D[5]*A[5],D[6]*A[6],D[7]*A[7],D[8]*A[8]])
plot(A,B,A,E) #plotting two lines on the same plot
#Calculations
#By close observation of plot taking c around 650
#consider c=635
c=635
T_max=w*(c+d) #lb
a=c+d
l=(4*(a*a-c*c))**0.5
#Result
print'The maximum tension is',round(T_max),"lb",'and length required is',round(l),"ft respectively."
import math
#Initilization of variables
m=0.6 #kg/m
l=240 #m
d=24 #m
#Calculations
c=((((1*4**-1)*(l**2))-(24*24)))/(2*d)
T_max=9.8*m*(c+d) #N
a=arcsinh((l)/(2*c))*576
#Result
print'The maximun tension is',round(T_max),"N"
print'The value of a is',round(a)