In [43]:

```
import math
#F force
#hd horizontal distance
#vd vertical distance
#O angle
#M moment of force
#Taking clockwise moment as positive
#calculations
F=100.0
hd=400.0
vd=500.0
o=60.0
M=F*(math.cos(o/180.0*3.14)*vd-math.sin(o/180.0*3.14)*hd)
print '%s %.2f %s' %("\n \n Moment is =", M ," Nmm clockwise");
```

In [44]:

```
import math
#F force
#hd horizontal distance
#vd vertical distance
#O angle
#M moment of force
#Taking clockwise moment as positive
#calculations
F=5000.0
o=37
M=8000.0
hd=M/(F*math.cos(o*3.14/180))
print '%s %.2f %s' %("\n \n Distance =", hd ,"m");
```

In [45]:

```
import math
#F force
#hd horizontal distance
#vd vertical distance
#O angle
#M moment of force
#Taking clockwise moment as positive
#calculations
F=5000.0
o=37
M=8000.0
hd=M/(F*math.cos(o*3.14/180))
print '%s %.2f %s' %("\n \n Distance =", hd ,"m");
```

In [46]:

```
import math
#R resultant force
#Rx resultant horizontal component
#Ry resultant vertical component
#f1 force
#f2 force
#f3 force
#o1 angle with the line
#o2 angle with the line
#o3 angle with the line
#O angle of resultant force with line
f1=70.0
f2=80.0
f3=50.0
o1=50.0
o2=25.0
o3=-45.0
Rx=(f1*math.cos(o1/180*3.14)+f2*math.cos(o2/180*3.14)+f3*math.cos(o3/180*3.14));
Ry=(f1*math.sin(o1/180*3.14)+f2*math.sin(o2/180*3.14)+f3*math.sin(o3/180*3.14));
R=math.sqrt(Rx**2+Ry**2)
O=math.atan(Ry/Rx)
print '%s %.2f %s' %("\n \n Resultant Force =", R ,"N");
print '%s %.2f %s' %("\n \n Resultant angle =", O ,"radians");
```

In [47]:

```
import math
#O angle of inclined plane
#N normal reaction
#W weight
#F,T forces
#Rx resultant horizontal component
#Ry resultant vertical component
o = 60.0
W = 1000.0
N = 500.0
F = 100.0
T = 1200.0
Rx = T-F-(W*math.sin(o/180*3.14))
Ry = N-(W*math.cos(o/180*3.14))
print '%s %.2f %s' %("\n \n Resultant Force along the incline plane =", Rx ,"N");
print '%s %.2f %s' %("\n \n Resultant Force vertical to the incline plane =", Ry ,"N");
```

In [48]:

```
import math
R=1000.0 #Resultant force
F1=500.0 #Force
F2=1000.0 #force
o=45.0*3.14/180.0 #angle resultant makes with x axis
o1=30.0*3.14/180.0 #angle F1 makes with x axis
o2=60.0*3.14/180.0 #angle F2 makes with x axis
#F3coso3=Rcoso-F1coso1-F2sino2
#F3sino=Rsino-F1sino1-F2coso2
F3=((R*math.cos(o)-F1*math.cos(o1)-F2*math.cos(o2))**2+(R*math.sin(o)-F1*math.sin(o1)-F2*math.sin(o2))**2)**0.5
print "Force",F3,"N"
o3=180/3.14*math.atan((R*math.sin(o)-F1*math.sin(o1)-F2*math.sin(o2))/(R*math.cos(o)-F1*math.cos(o1)-F2*math.cos(o2)))
print "At an angle",o3
```

In [49]:

```
from math import cos,sin,atan,pi,asin
#variable declaration
P1=300.0
P2=500.0
thetaI=30.0*pi/180.0
thetaP2=30.0*pi/180
thetaP1=40.0*pi/180
# Let the x and y axes be If the resultant is directed along the x axis, its component in y direction is zero.
#Taking horizontal direction towards left as x axis and the vertical downward direction as y axis.
##sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
F=(P2*sin(thetaP2))/(P1)
theta=(asin((F/(cos(20*pi/180)*2)))*180/pi)-20
print"theta=",round(theta,2),"°"
```

In [50]:

```
from math import cos,sin,atan,sqrt,pi
#variable declaration
P1=20.0
P2=30.0
P3=20.0
theta3=60.0*pi/180.0
#Taking horizontal direction towards left as x axis and the vertical downward direction as y axis.
##sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=20.0*cos(theta3)
Fy=P1+P2+P3*sin(theta3)
R=sqrt(pow(Fx,2)+pow(Fy,2))
print "R=",round(R,4),"KN"
alpha=atan(Fy/Fx)*180/pi
print"alpha=",round(alpha,2),"°"
#moment at A
MA=P1*1.5+P2*3.0+P3*sin(theta3)*6.0
#The distance of the resultant from point O is given by:
d=MA/R
x=d/sin(alpha*pi/180)
print"x=",round(x,3),"m"
```

In [51]:

```
from math import cos,sin,atan,sqrt
#variable declaration
PA=100.0 #inclined up loading at 60° at A, N
PB1=80.0 #Vertical down loading at B,N
PB2=80.0 #Horizontal right loading at at B,N
PC=120.0 #inclined down loading at 30° at C,N
thetaA=60.0*pi/180.0
thetaB=30.0*pi/180.0
#Taking horizontal direction towards left as x axis and the vertical downward direction as y axis.
##sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=PB2-PA*cos(thetaA)-PC*cos(thetaB)
Rx=-Fx
Fy=PB1+PC*sin(thetaB)-PA*sin(thetaA)
Ry=Fy
R=sqrt(pow(Rx,2)+pow(Ry,2))
print "R=",round(R,2),"KN"
alpha=atan(Fy/Fx)*180/pi
print"alpha=",round((-alpha),2),"°"
#Let x be the distance from A at which the resultant cuts AC. Then taking A as moment centre,
x=(PB1*100*sin(thetaA)+PB2*50+PC*sin(thetaB)*100)/Ry
print"x=",round(x,3),"mm"
```

In [52]:

```
from math import sqrt,pi,atan
#variable declaration
PA=800.0 #Vertical down loading at A,N
PC=400.0 #vertical up loading at B,N
HD=600.0 #Horizontal left loading at A,N
HB=200.0 #Horizontal right loading at B,N
a=1.0 #length of side,m
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=HB-HD
Fy=PC-PA
R=sqrt(pow(Fx,2)+pow(Fy,2))
print "R=",round(R,2),"N"
theta=atan(Fy/Fx)*180/pi
print"theta=",round(theta),"°"
#moment at A
MA=PC*a+HD*a
#Let x be the distance from A along x axis, where resultant cuts AB.
x=MA/Fy
print"x=",round((-x),1),"m"
```

In [53]:

```
from math import sqrt,pi,atan,cos,sin
#variable declaration
PB=2.0 #loading at B,KN
PC=sqrt(3.0) #loading at C,KN
PD=5.0 #loading at D,KN
PE=PC #loading at E,KN
PF=PB #loading at F,KN
#Let O be the centre of the encircling circle A, B, C, D, E and F. In regular hexagon each side is equal to the radius AO. Hence OAB is equilateral triangle.
angleoab=60.0*pi/180
anglecab=angleoab/2.0
theta1=anglecab
theta2=(angleoab-theta1)
theta3=theta1
theta4=theta1
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=PB*cos(theta1+theta2)+PC*cos(theta2)+PD+PE*cos(theta3)+PF*cos(theta3+theta4)
Fy=-PB*sin(theta1+theta2)-PC*sin(theta2)+0+PE*sin(theta3)+PF*sin(theta3+theta4)
R=sqrt(pow(Fx,2)+pow(Fy,2))
print "R=",round(R,2),"KN"
theta=atan(Fy/Fx)*180/pi
print"theta=",round(theta),"°","i.e.",",","the resultant is in the direction x."
```

In [54]:

```
from math import sqrt,pi,atan,cos,sin
#variable declaration
P1=2.0 #loading at 1,KN
P2=1.5 #loading at 2,KN
P3=5.0 #loading at 3,KN
a=10.0 #side length,mm
# If theta1, theta2 and theta3 are the slopes of the forces 2 kN, 5 kN and 1.5 kN forces with respect to x axis, then
theta1=atan(a/a)
theta2=atan((3*a)/(4*a))
theta3=atan((a)/(2*a))
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=P1*cos(theta1)+P3*cos(theta2)-P2*cos(theta3)
Fy=P1*sin(theta1)-P3*sin(theta2)-P2*sin(theta3)
R=sqrt(pow(Fx,2)+pow(Fy,2))
print "R=",round(R,2),"N"
alpha=atan(Fy/Fx)*180/pi
print"alpha=",round((-alpha),2),"°"
#Distance d of the resultant from O is given by
#Rd=sum of moment at A
d=((a*3)*P1*cos(theta1)+(5*a)*P3*sin(theta2)+P2*(a)*sin(theta3))/(4.66)
print"d=",round(d,2),"mm"
#Note: To find moment of forces about O, 2 kN force is resolved at it’s intersection with y axis and 5 kN and 1.5 kN forces are resolved at their intersection with x axis, and then Varignon theorem is used
```

In [55]:

```
from math import sqrt,pi,atan,cos,sin
#variable declaration
PB=20.0 #loading at B,KN
PC=30.0 #loading at C,KN
PD=40.0 #loading at D,KN
PA=60.0 #loading at E,KN
AB=1.0
BC=2.0
CD=1.0
#length are in m
# Let x and y axes be selected
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Rx=0
Ry=PA+PB+PC+PD
R=sqrt(pow(Rx,2)+pow(Ry,2))
print "R=",round(R,2),"KN"
#Taking clockwise moment as positive,
#sum of moment at A
MA=(0)*PA+(AB)*PB+PC*(AB+BC)+PD*(AB+BC+CD)
print"MA=",round(MA,2),"KN-m"
# The distance of resultant from A is,
x=MA/R
print "x=",round(x,1),"m"
```

In [56]:

```
from math import sqrt,pi,atan,cos,sin
#variable declaration
PB=30.0 #up loading at B,KN
PC=40.0 #down loading at C,KN
PD=50.0 #up loading at D,KN
PA=80.0 #down loading at A,KN
PE=60.0 #down loading at E,KN
AB=2.0
BC=2.0
CD=4.0
DE=2.0
#length are in m
# Let x and y axes be selected
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Rx=0
Ry=PA-PB+PC-PD+PE
R=sqrt(pow(Rx,2)+pow(Ry,2))
print "R=",round(R,2),"KN","in y-direction"
#Taking clockwise moment as positive,
#sum of moment at A
MA=(0)*PA-(AB)*PB+PC*(AB+BC)-PD*(AB+BC+CD)+PE*(AB+BC+CD+DE)
print"MA=",round(MA,2),"KN-m"
# The distance of resultant from A is,
x=MA/R
print "x=",round(x),"m"
```

In [57]:

```
from math import pi,atan,sin ,cos,sqrt
#variable declaration
P1=500.0 #Loading at inclined to 60.0°,N
P2=1000.0 #vertical loading at 150 distance from O,N
P3=1200.0 #vertical loading at 150 distance from O,N
H=700.0 #Horizontal loading at 300 ditance from O,N
a=150.0
theta=60.0*pi/180
#assume Resulat R at distance x from O,
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Rx=P1*cos(theta)-H
Ry=-P3-P2-P1*sin(theta)
R=sqrt(pow(Rx,2)+pow(Ry,2))
print "R=",round(R,2),"KN","in y-direction"
alpha=atan(Ry/Rx)*180/pi
print"alpha",round(alpha,2),"°"
#Let the point of application of the resultant be at a distance x from the point O along the horizontal arm. Then,
x=(P1*sin(theta)*(2*a)+P2*a-P3*a*cos(theta)+H*a*2*sin(theta))/(-Ry)
print"x=",round(x,3),"mm"
```

In [58]:

```
from math import pi,atan,sin ,cos,sqrt
#variable declaration
P1=1120.0 #vertical down Loading at 2m distance from O,KN
P2=120.0 #vertical up loading at 4m distance from O,KN
P3=420.0 #vertical downloading at 5m distance from O,KN
H=500.0 #Horizontal loading at 4m ditance from O,KN
ah=4.0
a1=2.0
a2=4.0
a3=5.0
a=7.0
#assume Resulat R at distance x from O,
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Rx=H
Ry=P1-P2+P3
print "Ry=",round(Ry,2),"KN","downward"
#Let x be the distance from O where the resultant cuts the base.
#moment at O
x=(H*ah+P1*a1-P2*a2+P3*a3)/(Ry)
print"x=",round(x,3),"m"
print "The resultant passes through the middle third of the base i.e., between 7/3m, and 2*7/3 m.Hence, the dam is safe."
```

In [59]:

```
from math import pi,atan,sin ,cos,sqrt
#variable declaration
P1=5.0 #Inclined at 45° down Loading at 3m distance from A,KN
P2=10.0 #Inclined at 45° down Loading at 2m distance from A,KN
P3=10.0 #Inclined at 45° down Loading at 1m distance from A,KN
P4=5.0 #Inclined at 45° down Loading A,KN
P8=5.0 #Inclined at 45° UP Loading at 3m distance from A,KN
P7=10.0 #Inclined at 45° UP Loading at 2m distance from A,KN
P6=10.0 #Inclined at 45° UP Loading at 1m distance from A,KN
P5=5.0 #Inclined at 45° UP Loading A,KN
a=1.0
theta=45.0*pi/180.0
#The roof is inclined at 45° to horizontal and loads are at 90° to the roof. Hence, the loads are also inclined at 45° to vertical/horizontal.
#assume Resulat R at distance d from A,
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Rx=(P1+P2+P3+P4+P5+P6+P7+P8)*cos(theta)
Ry=-(P1+P2+P3+P4)*sin(theta)+(P5+P6+P7+P8)*sin(theta)
print "R=",round(Rx,3),"KN"
#and its direction is horizontal
#Let R be at a distance d from the ridge A
#moment at A
d=((P1*3*cos(theta)*a+P2*cos(theta)*2*a+P3*cos(theta)*a)*2)/(Rx)
print"d=",round(d,1),"m"," Resultant is a horizontal force of magnitude",round(Rx,3)," at",round(d,1)," m below A."
```

In [60]:

```
from math import sqrt,pi,atan,cos,sin
#variable declaration
#The two 40 kN forces acting on the smooth pulley may be replaced by a pair of 40 kN forces acting at centre of pulley C and parallel to the given forces, since the sum of moments of the two given forces about C is zero
PA=20.0 #inclined at 45° loading at A,KN
PB=30.0 #inclined at 60° loading at B,KN
PC1=40.0 #inclined at 30° loading at C,KN
PC2=40.0 #inclined at 20° loading at C,KN
PD=50.0 #inclined at 30.0 at distance 2m form A,KN
PE=20.0 #inclined at alpha at distance xm form A,KN
P=20.0 #vertical loading at distance 4m,KN
thetaA=45.0*pi/180.0
thetaB=60.0*pi/180.0
thetaC1=30.0*pi/180.0
thetaC2=20.0*pi/180.0
thetaD=30.0*pi/180.0
AD=2.0
AC=3.0
AB=6.0
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
Fx=PA*cos(thetaA)-PB*cos(thetaB)-PD*cos(thetaD)-PC1*sin(thetaC1)+PC2*cos(thetaC2)
Fy=-PA*sin(thetaA)-P+P-PB*sin(thetaB)-PD*sin(thetaD)-PC2*sin(thetaC2)-PC1*cos(thetaC1)
R=sqrt(pow(Fx,2)+pow(Fy,2))
print "R=",round(R,2),"KN"
alpha=atan(Fy/Fx)*180/pi
print"alpha=",round(alpha,2),"°"
#Let the resultant intersect AB at a distance x from A. Then,
X=(-P*4+P*4+PB*sin(thetaB)*AB+PD*sin(thetaD)*AD-PD*cos(thetaD)*AD+PC2*AC*cos(thetaC2)-PC1*AC*sin(thetaC1))/R
print"x=",round(X,2),"m"
print"The equilibriant is equal and opposite to the resultant in which E = 116.515 kN, alpha= 76.82° and ","x=",round(X,2),"m"
```

In [61]:

```
from math import sin,cos,pi
#Free body diagram of the sphere shows all the forces moving away from the centre of the ball. Applying Lami’s theorem to the system of forces.
#variable declaration
W=100.0 #weight of sphere,N
theta=15.0*pi/180 #angle of inclination of string with wall
T=(W*sin((pi/2)))/sin((pi/2)+theta)
R=(W*sin((pi-theta)))/sin((pi/2)+theta)
print"T=",round(T,2),"N"
print"R=",round(R,2),"N"
#The above problem may be solved using equations of equilibrium also. Taking horizontal direction as x axis and vertical direction as y axis,
#Notes:
#1. The string can have only tension in it (it can pull a body), but cannot have compression in it (cannot push a body).
#2. The wall reaction is a push, but cannot be a pull on the body.
#3. If the magnitude of reaction comes out to be negative, then assumed direction of reaction is wrong. It is acting exactly in the opposite to the assumed direction. However, the magnitude will be the same. Hence no further analysis is required. This advantage is not there in using Lami's equation. Hence, it is advisable for beginners to use equations of equilibrium, instead of Lami's theorem even if the body is in equilibrium under the action of only three forces.
```

In [62]:

```
from math import sin,cos,pi
#The body is in equilibrium under the action of applied force P, self-weight 1500 N and normal reaction R from the plane. Since R, which is normal to the plane, makes 30° with the vertical (or 60° with the horizontal),
#variable declaration
W=1500.0 #weight of block,N
theta=30.0*pi/180 #angle of inclination
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
R=W/cos(theta)
print"R=",round(R,2),"N"
P=R*sin(theta)
print"P=",round(P,2),"N"
#Note: Since the body is in equilibrium under the action of only three forces the above problem can be solved using Lami’s theorem
```

In [63]:

```
from math import sin,cos,pi
#A bar can develop a tensile force or a compressive force. Let the force developed be a compressive force S (push on the cylinder).
#variable declaration
W=10.0 #weight of Roller,KN
IL=7.0 #inclined loading at angle of 45°,KN
H=5.0 #Horizontal loading ,KN
theta=45.0*pi/180 #angle of loading of IL
thetaS=30.0*pi/180.0
#Since there are more than three forces in the system, Lami’s equations cannot be applied. Consider the components in horizontal and vertical directions.
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
S=(-H+IL*cos(theta))/cos(thetaS)
print"S=",round(S,3),"N"
print"Since the value of S is negative the force exerted by the bar is not a push, but it is pull (tensile force in bar) of magnitude",round(-S,3) ,"kN."
R=W+IL*sin(theta)-S*sin(thetaS)
print"R=",round(R,3),"kN"
```

In [64]:

```
from math import cos,sin,pi,asin
#The pulley C is in equilibrium under the action of tensile forces in CA and CB and vertical downward load 200 N. The tensile forces in segment CA and CB are the same since the pulley is frictionless. Now consider the equilibrium of pulley C
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
#variable declaration
L=200.0 #suspended load at C,N
AB=3.0
BI=1.0
ACB=5.0 #Length of cord,m
DE=3.0
BE=4.0
theta=asin(4.0/5.0)
#assume T is tension in string making angle theta1 & theta2,solving horizontal we find theta1=theta2,lets called them theta ,as triangleCFD=triangle=CFA.so, CD=AC
HI=BI*DE/BE
AH=DE-HI
x=AH/2
print"x=",round(x,3),"m"
T=L/(2*sin(theta))
print"T=",round(T),"N"
```

In [65]:

```
from math import sin ,acos, pi,cos
#When the roller is about to turn over the curb, the contact with the floor is lost and hence there is no reaction from the floor. The reaction R from the curb must pass through the intersection of P and the line of action of self weight, since the body is in equilibrium under the action of only three forces (all the three forces must be concurrent).
#variable declaration
W=2000.0 #weight of roller,N
r=300.0 #radius of roller,mm
h=150.0 # height of curb,mm
OC=r-h
AO=r
alpha=acos(OC/AO)
#angleOAB=angleOBA,Since OA=OB,
angleOBA=(alpha)/2
#the reaction makes 30° with the vertical
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
R=W/cos(angleOBA)
P=R*sin(angleOBA)
print"P=",round(P,2),"N"
#Least force through the centre of wheel: Now the reaction from the curb must pass through the centre of the wheel since the other two forces pass through that point. Its inclination to vertical is theta = 60°. If the triangle of forces ABC representing selfweight by AB, reaction R by BC and pull P by AC, it may be observed that AC to be least, it should be perpendicular to BC. In other words, P makes 90° with the line of action of R.
#From triangle of forces ABC, we get
P=W*sin(alpha)
print "P=",round(P,2),"N"
```

In [66]:

```
from math import sin,cos,pi
#variable declaration
PB=200.0 #Vertical loading at B,N
PD=250.0 #Vertical loading at D,N
thetabc=30.0*pi/180.0
thetabd=60.0*pi/180.0
thetaed=45.0*pi/180.0
#Free body diagrams of points B and D . Let the forces in the members be as shown in the figure. Applying Lami’s theorem to the system of forces at point D,
T1=PD*sin(pi-thetabd)/sin(thetaed+(pi/2)-thetabd)
T2=PD*sin(pi-thetaed)/sin(thetaed+(pi/2)-thetabd)
print "T1=",round(T1,2),"N"
print "T2=",round(T2,2),"N"
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
T3=(PB+T2*cos(thetabd))/cos(thetabc)
print "T3=",round(T3,2),"N"
T4=(T2*sin(thetabd))+T3*sin(thetabc)
print "T4=",round(T4,2),"N"
```

In [67]:

```
from math import sin,cos,pi,acos,sqrt
#variable declaration
PC=1500.0 #Vertical loading at C,N
CD=2.0
AC=1.5
BD=1.0
AB=4.0
x=((pow(AC,2)-pow(BD,2))/4)+1
y=sqrt(pow(AC,2)-pow(x,2))
alpha=acos(x/AC)
beta=acos((CD-x)/BD)
#Applying Lami’s theorem to the system of forces acting at point C
T1=PC*sin(pi/2)/sin(pi-alpha)
T2=PC*sin((pi/2)+alpha)/sin(pi-alpha)
T3=T2*sin(pi/2)/sin((pi/2)+beta)
W=T2*sin(pi-beta)/sin((pi/2)+beta)
print "W=",round(W,2),"N"
```

In [68]:

```
from math import sin,cos,pi,atan
#variable declaration
PB=20.0 #vertical loadng at point B,KN
PC=30.0 #vertical loadng at point C,KN
thetaab=30.0 *pi/180.0
thetabc=50.0*pi/180.0
#applying lami's thereom
T1=PB*sin(thetabc)/sin(pi-thetabc+thetaab)
T2=PB*sin(pi-thetaab)/sin(pi-thetabc+thetaab)
theta=atan((T2*sin(thetabc))/(PC-T2*cos(thetabc)))*180/pi
print "T1=",round(T1,2),"KN"
print "T2=",round(T2,2),"KN"
#Writing equations of equilibrium for the system of forces at C
print "theta=",round(theta,2),"°"
T3=(PC-T2*cos(thetabc))/cos(theta*pi/180)
print "T3=",round(T3,2),"KN"
#mistake in book
```

In [69]:

```
from math import sin,cos,pi,atan
#variable declaration
PB=20.0 #vertical loadng at point B,KN
PC=25.0 #vertical loadng at point C,KN
thetaab=30.0*pi/180.0
thetadc=60.0*pi/180.0
#Writing equations of equilibrium for the system of forces at joints B and C
#T1*sin(thetaab)=T3*sin(thetadc)
T3=(PB+PC)/((sin(thetadc)*cos(thetaab)/sin(thetaab))+cos(thetadc))
print "T3=",round(T3,2),"KN"
T1=T3*sin(thetadc)/sin(thetaab)
print "T1=",round(T1,2),"KN"
theta=(atan((T3*sin(thetadc))/(PC-T3*cos(thetadc))))*180/pi
print"theta=",round(theta,2),"°"
T2=T3*sin(thetadc)/(sin(theta*pi/180))
print "T2=",round(T2,2),"KN"
```

In [70]:

```
from math import sin,cos,atan,pi
#variable declaration
W=600.0 #weight of cyclinder,N
r=150.0 #radius of cylinder,mm
a=600.0 #mm
b=300.0 #mm
#Free body diagram of sphere and frame
##sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
RB=600.0
#As the frame is in equilibrium under the action of three forces only, they must be concurrent forces. In other words, reaction at D has line of action alone OD. Hence, its inclination to horizontal is given by:
print"RB=",round(RB,2),"N"
alpha=atan((a-r)/r)
print"alpha=",round(alpha,4),"°"
RD=W/sin(alpha)
print"RD=",round(RD,3),"N"
RC=RD*cos(alpha)
RA=RC
print"RC=",round(RC),"N"
print"RA=",round(RA),"N"
```

In [71]:

```
from math import sin,cos,pi,acos,asin
# Let O1 and O2 be the centres of the first and second spheres. Drop perpendicular O1P to the horizontal line through O2. show free body diagram of the sphere 1 and 2, respectively. Since the surface of contact are smooth, reaction of B is in the radial direction, i.e., in the direction O1O2. Let it make angle a with the horizontal. Then,
#Variable declaration
W=100.0 #weight of spheres,N
r=100.0 #radius of spheres,mm
d=360.0 # horizontal channel having vertical walls, the distance b/w,mm
O1A=100.0
O2D=100.0
O1B=100.0
BO2=100.0
O2P=360.0-O1A-O2D
O1O2=O1B+BO2
alpha=acos(O2P/O1O2)
###sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
RB=W/sin(alpha)
RA=RB*cos(alpha)
print"RB=",round(RB,2),"N"
print"RA=",round(RA,2),"N"
RC=100+RB*sin(alpha)
RD=RB*cos(alpha)
print"RC=",round(RC),"N"
print"RD=",round(RD,2),"N"
```

In [72]:

```
from math import sin,cos,pi
# Two cylinders, A of weight 4000 N and B of weight 2000 N rest on smooth inclines. They are connected by a bar of negligible weight hinged to each cylinder at its geometric centre by smooth pins
#variable declaration
WA=4000.0 #weight of cylinder A,N
WB=2000.0 #weight of cylinder B,N
thetaWA=60.0*pi/180.0 #inclination of wall with cylinderA,°
thetaWB=45.0*pi/180.0 #inclination of wall with cylinderB,°
thetaAb=15.0*pi/180.0 #angle inclination bar with cylinder A ,N
thetaBb=15.0*pi/180.0 #angle inclination bar with cylinder B ,N
#he free body diagram of the two cylinders. Applying Lami’s theorem to the system of forces on cylinder A, we get
C=WA*sin(thetaWA)/sin(thetaWA+(pi/2)-thetaAb)
#Consider cylinder B. Summation of the forces parallel to the inclined plane
P=(-WB*cos(thetaWB)+C*cos(thetaWA))/cos(thetaBb)
print"P=",round(P,1),"N"
```

In [73]:

```
from math import pi,atan,sin ,cos,sqrt
# The 12 m boom AB weighs 1 kN, the distance of the centre of gravity G being 6 m from A. For the position shown, determine the tension T in the cable and the reaction at B
#variable declaration
PB=2.5 #vertical Loading at B,KN
WAB=1.0 #vertical loading at G,KN
theta=15.0*pi/180
AG=6.0 #Length of boom AB is 12m
GB=6.0
thetaAB=30.0*pi/180.0
thetaABC=15.0*pi/180.0
#sum of moment at A
T=(PB*(AG+GB)*cos(thetaAB)+WAB*AG*cos(thetaAB))/(sin(thetaABC)*12)
print"T=",round(T,4),"KN"
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
HA=T*cos(thetaABC)
VA=WAB+PB+T*sin(thetaABC)
RA=sqrt(pow(RA,2)+pow(RA,2))
print "RA=",round(RA,2),"KN"
alpha=atan(VA/HA)*180/pi
print"alpha",round(alpha,2),"°"
```

In [74]:

```
from math import sin,cos,pi
#variable declaration
#A cable car used for carrying materials in a hydroelectric project is at rest on a track formed at an angle of 30° with the vertical. The gross weight of the car and its load is 60 kN and its centroid is at a point 800 mm from the track half way between the axles. The car is held by a cable . The axles of the car are at a distance 1.2 m. Find the tension in the cables and reaction at each of the axles neglecting friction of the track.
W=60.0 #gross weight of car,KN
theta=60.0*pi/180.0
T=W*sin(theta)
print"T=",round(T,4),"KN"
#Taking moment equilibrium condition about upper axle point on track, we get
R1=(-T*600.0+W*sin(theta)*800.0+W*cos(theta)*600.0)/1200.0
print"R1=",round(R1,4),"KN"
#Sum of forces normal to the plane = 0, gives
R2=W*cos(theta)-R1
print"R2=",round(R2,4),"KN"
```

In [75]:

```
from math import sin,cos,acos,pi
# A hollow right circular cylinder of radius 800 mm is open at both ends and rests on a smooth horizontal plane. Inside the cylinder there are two spheres having weights 1 kN and 3 kN and radii 400 mm and 600 mm, respectively. The lower sphere also rests on the horizontal plane.
# Join the centres of spheres, O1 and O2 and drop O1D perpendicular to horizontal through O2.
#variable declaration
R=800.0
W1=1.0
r1=400.0
W2=3.0
r2=600.0
O1O2=1000 #mm
O2D=600 #mm
#If alpha is the inclination of O2O1 to horizontal
alpha=acos(O2D/O1O2)
#Free body diagrams of cylinder and spheres are shown. Considering the equilibrium of the spheres.
#Sum of Moment at O2
R1=W1*O2D/(O1O2*sin(alpha))
#sum of vertical Fy & sum of horizontal forces Fx is zero
#Assume direction of Fx is right
#Assume direction of Fy is up
R2=R1
R3=W1+W2
#Now consider the equilibrium of cylinder. When it is about to tip over A, there is no reaction from ground at B. The reaction will be only at A.
#Sum of Moment at A
W=R1*O1O2*sin(alpha)/R
print"W=",round(W,2),"KN"
```