#Entire truss
#Applying sum(M_C) = 0
# Given Data
E = (10.*12+5*6)/3; #kN
#Applying sum Fx = 0
Cx = 0.
#Applying sumFy = 0
Cy = 10.+5-E; #kN
# Calculations
#At joint A
#By proportion 10kN/4 = F_AB/3 = F_AD/5
F_AB = 10./4*3; #kN, force in member AB
F_DA = 10./4*5; #kN, force in member AD
#At joint D
F_DB = F_DA; #kN, force in member DB
F_DE = 2*3./5*F_DA; #kN, force in member DE
#At joint B
#applying sumFy = 0
F_BE = 5./4*(-5-4./5*F_DB); #kN, force in member BE
#Applying sumFx = 0
F_BC = F_AB+3./5*F_DB-3./5*F_BE; #kN, force in member BC
#At joint E
#Applying sumFx = 0
F_EC = -5./3*(F_DE-3./5*F_BE); #kN, Force in member EC
# Results
print "The forces in member of truss are F_AB = %.1f kN T \
\nF_AD = %.1f kN C, \
\nF_DB = %.1f kN T \
\nF_DE = %.0f kN C \
\nF_BE = %.2f kN \
\nF_BC = %.2f kN \
\nF_EC = %.2f kN "%(F_AB,F_DA,F_DB,F_DE,F_BE,F_BC,F_EC);
#Variation in answe because of round off
# Given Data
#Entire truss
v1 = 140.; #kn, verical force 1
v2 = 140.; #kN, Vertical force 2
h = 80.; #kN , Horizontal force
#Applying sum(M_B) = 0
J = (v1*4+v2*12+h*5)/16; #kN
# Calculations and Results
#Applying sum Fx = 0
Bx = -h; #kN, negative sign shows it is along negative x axis
#Applying sumFy = 0
By = v1+v2-J; #kN
#Force in member EF
#Applying sumFy = 0
F_EF = By-v2; #kN, Force in member EF
print "Force in member EF is %.0f kN Negative sign shows member is in compression "%(F_EF);
#Force in member GI
F_GI = (-J*4-Bx*5)/5; #kN Force in member GI
print "Force in member GI is %.0f kN Negative sign shows member is in compression "%(F_GI);
#Answer difference is because of rounding off variables
import math
# Given Data
#Entire truss
vB = 1.; #kN, verical force at B
vD = 1.; #kN, verical force at D
vF = 1.; #kN, verical force at F
vH = 1.; #kN, verical force at H
vJ = 1.; #kN, verical force at J
vC = 5.; #kN, verical force at C
vE = 5.; #kN, verical force at E
vG = 5.; #kN, verical force at G
h = 8.; #m, height
v = 5.; #m, horizontal dismath.tance between successive node
A = 12.50; #kN, reaction at A
L = 7.50; #kN, reaction at L
# Calculations and Results
alpha = math.atan(h/3./v); # rad, angle made by inclined members with X axis
#alpha = alpha/math.pi*180; # Conversion of angle into degrees
#Force in member GI
#Applying sum(M_H) = 0
F_GI = (L*2*v-vJ*v)/(2*v*math.tan(alpha)); #kN Force in member GI
print "Force in member GI is %.2f kN "%(F_GI);
#Force in member FH
#Applying sum(M_G) = 0
F_FH = (L*3*v-vH*v-vJ*2*v)/(-h*math.cos(alpha)); #kN, Force in member FH
print "Force in member FH is %.2f kN Negative sign shows member is in compression "%(F_FH);
#Force in member GH
be = math.atan(v/(2*v*math.tan(alpha))); #rad, as math.tan(be) = GI/HI
#Applying sum(M_L) = 0
F_GH = (-vH*v-vJ*2*v)/(3*v*math.cos(be)); #kN, Force in member FH
print "Force in member GH is %.3f kN Negative sign shows member is in compression "%(F_GH);
import math
#Entire truss
#Applying sum(Fy) = 0
# Given Data
Ay = 480.; #N, Y component of reaction at A
#Applying sum(M_A) = 0
B = 480*100./160; #N, reaction at B
#Applying sum(Fx) = 0
Ax = -300.; #N, X component of reaction at A
# Calculations and Results
alpha = math.atan(80./150); #radian
#Free body member BCD
#Applying sum(M_C) = 0
F_DE = (-480*100.-B*60)/(math.sin(alpha)*250); #N, Force in link DE
print "Force in link DE is F_DE = %.0f N Negative sign shows force is compressive"%(F_DE);
#Applying sum(Fx) = 0
Cx = F_DE*math.cos(alpha)-B; #N, X component of force exerted at C
#Applying sum(Fy) = 0
Cy = F_DE*math.sin(alpha)+Ay; #N, Y component of force exerted at C
print "Components of force exerted at C is Cx = %.0f N and Cy = %.0f N "%(Cx,Cy);
# Given Data
P = 18.; #kN, Force applied at D
AF = 3.6; #m, Length AF
EF = 2.; #m, Length EF
ED = 2.; #m, Length ED
DC = 2.; #m, Length DC
#Entire frame
# Calculations and Results
#Applying sum(M_F) = 0
Ay = -P*(EF+ED)/AF; #kN, Y component of reaction at A
#Applying sum(Fx) = 0
Ax = -P; #kN, X component of reaction at A
#Applying sum(Fy) = 0
F = -Ay; #kN, reaction at B
print "Components of force exerted at A is Ax = %.0f kN and Ay = %.0f kN "%(Ax,Ay);
print "Force exerted at F is F = %.0f kN "%(F);
#Free body member BE
#Applying sum(Fx) = 0
#B = E, and as it is 2 force member
By = 0;
Ey = 0;
#Member ABC
#Applying sum(Fy) = 0
Cy = -Ay; #kN, Y component of force exerted at C
#Applying sum(M_C) = 0
B = (Ay*AF-Ax*(DC+ED+EF))/(ED+DC); #kN, Force in link DE
print "Force exerted at B is B = %.0f kN "%(B);
#Applying sum(Fx) = 0
Cx = -Ax-B; #kN, X component of force exerted at C
print "Components of force exerted at C is Cx = %.0f kN and Cy = %.0f kN "%(Cx,Cy);
print "Negative signs shows forces are in negative direction"
import math
from numpy.linalg import solve
# Given Data
P = 3.; #kN, Horizontal Force applied at A
AB = 1.; #m, perpendicular dismath.tance between A and B
BD = 1.; #m, perpendicular dismath.tance between D and B
CD = 1.; #m, perpendicular dismath.tance between C and D
FC = 1.; #m, perpendicular dismath.tance between C and F
EF = 2.4; #m, perpendicular dismath.tance between E and F
#Entire frame
# Calculations
#Applying sum(M_E) = 0
Fy = P*(AB+BD+CD+FC)/EF; #kN, Y component of reaction at F
#Applying sum(Fy) = 0
Ey = -Fy; #kN, Y component of reaction at E
#Free body member ACE
#Applying sum(Fy) = 0, and sum(M_E) = 0 we get 2 equation
A = [[-AB/math.sqrt(AB**2+EF**2) ,CD/math.sqrt(CD**2+EF**2) ] , [ -EF/math.sqrt(AB**2+EF**2)*(AB+BD+CD+FC) , -EF/math.sqrt(CD**2+EF**2)]]; # Matrix of coefficients
B = [[Ey],[-P*(AB+BD+CD+FC)]]; # Matrix B
X = solve(A,B); #kN Solution matrix
F_AB = X[0]; #kN, Forec inmember AB
F_CD = X[1]; #kN, Forec inmember CD
Ex = -P-EF/math.sqrt(AB**2+EF**2)*F_AB-EF/math.sqrt(CD**2+EF**2)*F_CD; #kN, X component of force exerted at E
#Free body : Entire frame
#Applying sum(F_X) = 0
Fx = -P-Ex; #kN, X component of force exetered at F
print "Components of force exerted at F is Fx = %.1f kN and Fy = %.0f kN "%(Fx,Fy);
print "Force in member AB is F_AB = %.1f kN "%(F_AB);
print "Force in member CD is F_CD = %.1f kN "%(F_CD);
print "Components of force exerted at E is Ex = %.1f kN and Ey = %.1f kN "%(Ex,Ey);
print "Negative signs shows forces are in negative direction"