#Example 2.1
import math
from __future__ import division
# The parallelogram law of addition is shown in Fig.2-10b
# F_R is determined using law of cosines
#Calculation
F_R = math.sqrt((100**(2))+(150**(2))-2*100*150*math.cos(115*math.pi/180)) #[Newton]
#Result
print"Resultant Force F_R = ",int(round(F_R)),"N"
# Angle theta is determined by law of sines
#Calculation
theta = math.asin(150*0.9063/212.6) #[Radians]
#Result
print "theta = ",(round(math.degrees(theta),1)),"degrees"
#The direction of phi as masured from horizontal is given by
phi = 39.8 + 15.0 #[Degrees]
print"phi = ",phi,"degrees"
# Example 2.2
import math
from __future__ import division
# Variable Declaration
F = 2000 #[newton]
# In each case parallelogram law is used to resolve F into its two components
# Part(a)
# The vector addition F = F_x + F_y is shown in fig2-11b
# Calculation
F_x = F*math.cos(40*math.pi/180) #[Newton]
F_y = F*math.sin(40*math.pi/180) #[Newton]
# Result
print"F_x = ",int((F_x)),"N"
print"F_y = ",int((F_y)),"N"
# Part(b)
# The vector addition F = F_x_dash + F_y is shown in fig2-11b
# Calculation
F_x_dash = F*math.sin(50*math.pi/180)/math.sin(60*math.pi/180) #[Newton]
F_y = F*math.sin(70*math.pi/180)/math.sin(60*math.pi/180) #[Newton]
# Result
print"F_x_dash = ",int((F_x_dash)),"N"
print"F_y = ",int((F_y)),"N"
# Example 2.3
import math
from __future__ import division
# The angle phi can be determined using law of cosines
# Calculation
phi = math.asin((400/500)*math.sin(60*math.pi/180)) #[Radians]
phi = math.degrees(phi) #[Degrees]
theta = 180-60-phi #[Degrees]
# Result
print"theta = ",round(theta,1),"degrees"
# Example 2.4
import math
from __future__ import division
# Part(a) Refer fig 2-13b
# Using parallelogram law
# Calculation
F1 = 1000*math.sin(30*math.pi/180)/math.sin(130*math.pi/180) #[Newton]
F2 = 1000*math.sin(20*math.pi/180)/math.sin(130*math.pi/180) #[Newton]
# Result
print"Part(a)"
print"F1 = ",int(round(F1,0)),"N"
print"F2 = ",int(round(F2,0)),"N\n"
# Part(b) Refer fig 2-13d
# Calculation
F1 = 1000*math.sin(70*math.pi/180) #[Newton]
F2 = 1000*math.cos(70*math.pi/180) #[Newton]
# Result
print"Part(b)"
print"F1 = ",int(round(F1,0)),"N"
print"F2 = ",int(round(F2,0)),"N"
# Example 2.5
import math
from __future__ import division
# F1_x acts in -x direction and F1_y acts in +y direction Refer fig 2-17b
# Calculation
F1_x = -200*math.sin(30*math.pi/180) #[Newton]
F1_y = 200*math.cos(30*math.pi/180) #[Newton]
# Result
print"F1_x = ",int(round(F1_x,0)),"N"
print"F1_y = ",int(round(F1_y,0)),"N"
# F2 is resolved into its x and y components Refer fig 2-17c
# Calculation
F2_x = 260*(12/13) #[Newton]
F2_y = 260*(5/13) #[Newton]
# Result
print"F2_x = ",int(round(F2_x,0)),"N"
print"F2_y = ",int(round(F2_y,0)),"N"
# Example 2.6
import math
from __future__ import division
# Variable Declaration
F1 = 600 #[Newton]
F2 = 400 #[Newton]
# We resolve each force into x and y components Refer fig 2-18b
# Let FR be resultant force
# Let FR_x be resultant force along x direction
# Let FR_y be resultant force along y direction
# Calculation
FR_x = F1*math.cos(30*math.pi/180) - F2*math.sin(45*math.pi/180) #[Newton]
FR_y = F1*math.sin(30*math.pi/180) + F2*math.cos(45*math.pi/180) #[Newton]
FR = math.sqrt(round(FR_x,1)**(2)+round(FR_y,1)**(2)) #[Newton]
theta = math.atan(round(FR_y,1)/round(FR_x,1)) #[Radians]
theta = math.degrees(theta) #[Degrees]
# Result
print"FR_x = ",round(FR_x,1),"N"
print"FR_y = ",round(FR_y,1),"N"
print"FR = ",int(round(FR,0)),"N"
print"Theta = ",round(theta,1),"degrees"
# Example 2.7
import math
from __future__ import division
# Variable Declaration
F1 = 400 #[Newton]
F2 = 250 #[Newton]
F3 = 200 #[Newton]
# We resolve each force into x and y components Refer fig 2-18b
# Let F_R be resultant force
# Let F_R_x be resultant force along x direction
# Let F_R_y be resultant force along y direction
# Calculation
F_R_x = -F1 + F2*math.sin(45*math.pi/180) - F3*(4/5) #[Newton]
F_R_y = F2*math.cos(45*math.pi/180) + F3*(3/5) #[Newton]
F_R = math.sqrt(round(F_R_x,1)**(2)+round(F_R_y,1)**(2)) #[Newton]
theta = math.atan(abs(round(F_R_y,1)/round(F_R_x,1))) #[Radians]
theta = math.degrees(theta) #[Degrees]
# Result
print"F_R_x = ",round(F_R_x,1),"N"
print"F_R_y = ",round(F_R_y,1),"N"
print"F_R = ",int(round(F_R,0)),"N"
print"Theta = ",round(theta,1),"degrees"
# Example 2.8
import math
from __future__ import division
# Variable declaration
beta = 60 #[Degrees]
gamma = 45 #[Degrees]
f = 100 #[Newton]
# Calculation
cos_alpha = math.sqrt(1-(math.cos(beta*math.pi/180)**(2))-(math.cos(gamma*math.pi/180)**(2))) #[Radians]
alpha1 = math.degrees(math.acos(+cos_alpha)) #[Degrees]
alpha2 = math.degrees(math.acos(-cos_alpha)) #[Degrees]
Fx = f*math.cos(alpha1*math.pi/180) #[Newton]
Fy = f*math.cos(beta*math.pi/180) #[Newton]
Fz = f*math.cos(gamma*math.pi/180) #[Newton]
F = math.sqrt(round(Fx**(2),1)+round(Fy**(2),1)+round(Fz**(2),1)) #[Newton]
# Result
print"cos_alpha = +/-",(cos_alpha)
print"F = ",int(F),"N"
# Example 2.9
import math
from __future__ import division
# Variable declaration
F1_x = 0 #[Newton]
F1_y = 60 #[Newton]
F1_z = 80 #[Newton]
F2_x = 50 #[Newton]
F2_y = -100 #[Newton]
F2_z = 100 #[Newton]
# Calculation
FR_x = F1_x + F2_x #[Newton]
FR_y = F1_y + F2_y #[Newton]
FR_z = F1_z + F2_z #[Newton]
# Let F_R be resultant force
FR = round(math.sqrt(FR_x**(2)+FR_y**(2)+FR_z**(2)),1)
# The coordinate direction angles alpha,beta and gamma are determined from components of unit vector along direction of F_R
cos_alpha = FR_x/FR
cos_beta = FR_y/FR
cos_gamma = FR_z/FR
alpha = round(math.degrees(math.acos(cos_alpha)),1) #[Degrees]
beta = round(math.degrees(math.acos(cos_beta)),1) #[Degrees]
gamma = round(math.degrees(math.acos(cos_gamma)),1) #[Degrees]
# Result
print"Resultant Force FR = ",(FR),"N"
print"alpha = ",(alpha),"degrees"
print"beta = ",(beta),"degrees"
print"gamma = ",(gamma),"degrees"
# Example 2.10
import math
from __future__ import division
# For F1
# Calculation
F1_z = int(round(1000*math.sin(60*math.pi/180),0)) #[Newton]
F1_dash = int(round(1000*math.cos(60*math.pi/180),0)) #[Newton]
F1_x = int(round(F1_dash*math.cos(45*math.pi/180),0)) #[Newton]
F1_y = int(round(F1_dash*math.sin(45*math.pi/180),0)) #[Newton]
# F1_y has direction defined by -j
F1 = int(round(math.sqrt(F1_x**(2)+(-F1_y)**(2)+F1_z**(2)),0)) #[Newton]
# u1 is unit vector along F1
u1_x = round(F1_x/F1,3)
u1_y = round(F1_y/F1,3)
u1_z = round(F1_z/F1,3)
alpha1 = round(math.degrees(math.acos(u1_x)),1) #[Degrees]
betaa1 = round(math.degrees(math.acos(u1_y)),1) #[Degrees]
gamma1 = round(math.degrees(math.acos(u1_z)),1) #[Degrees]
# Result
print"F1_x = ",F1_x,"N"
print"F1_y = ",F1_y,"N"
print"F1_z = ",F1_z,"N"
print"F1 = ",F1,"N\n"
# For F2
# Calculation
F2_z = int(round(3000*math.sin(45*math.pi/180),0)) #[Newton]
F2_dash = int(round(3000*math.cos(45*math.pi/180),0)) #[Newton]
F2_x = int(round(F2_dash*math.sin(30*math.pi/180),0)) #[Newton]
F2_y = int(round(F2_dash*math.cos(30*math.pi/180),0)) #[Newton]
# F2_z has direction defined by -k
F2 = int(round(math.sqrt(F2_x**(2)+F2_y**(2)+(-F2_z)**(2)),-1)) #[Newton]
# u1 is unit vector along F1
u2_x = round(F2_x/F2,3)
u2_y = round(F2_y/F2,3)
u2_z = round(F2_z/F2,3)
alpha2 = round(math.degrees(math.acos(u2_x)),1) #[Degrees]
betaa2 = round(math.degrees(math.acos(u2_y)),1) #[Degrees]
gamma2 = round(math.degrees(math.acos(u2_z)),1) #[Degrees]
# Result
print"F2_x = ",F2_x/1000,"kN"
print"F2_y = ",F2_y/1000,"kN"
print"F2_z = ",F2_z/1000,"kN"
print"F2 = ",F2,"N"
# Example 2.11
import math
from __future__ import division
# Variable declaration
F1 = 300 #[Newton]
F2 = 700 #[Newton]
FR = 800 #[Newton]
alpha1 = 45 #[Degrees]
beta1 = 60 #[Degrees]
gamma1 = 120 #[Degrees]
# Calculation
F1_x = round(F1*math.cos(alpha1*math.pi/180),1) #[Newton]
F1_y = round(F1*math.cos(beta1*math.pi/180),1) #[Newton]
F1_z = round(F1*math.cos(gamma1*math.pi/180),1) #[Newton]
# FR acts along +y axis
FR_x = 0 #[Newton]
FR_y = 800 #[Newton]
FR_z = 0 #[Newton]
# FR = F1 + F2
# F2 = FR - F1
F2_x = FR_x - F1_x #[Newton]
F2_y = FR_y - F1_y #[Newton]
F2_z = FR_z - F1_z #[Newton]
alpha2 = round(math.degrees(math.acos(F2_x/F2)),1) #[Degrees]
beta2 = round(math.degrees(math.acos(F2_y/F2)),1) #[Degrees]
gamma2 = round(math.degrees(math.acos(F2_z/F2)),1) #[Degrees]
# Result
print"alpha2 = ",(alpha2),"degrees"
print"beta2 = ",(beta2),"degrees"
print"gamma2 = ",(gamma2),"degrees"
# Example 2.12
import math
from __future__ import division
# Variable Declaration
A_x = 1 #[meters]
A_y = 0 #[meters]
A_z = -3 #[meters]
B_x = -2 #[meters]
B_y = 2 #[meters]
B_z = 3 #[meters]
# Calculation
# r = B - A
r_x = B_x - A_x #[meters]
r_y = B_y - A_y #[meters]
r_z = B_z - A_z #[meters]
r = math.sqrt(r_x**(2)+r_y**(2)+r_z**(2))
# Assume u to be a unit vector along r
u_x = r_x/r
u_y = r_y/r
u_z = r_z/r
alpha = round(math.degrees(math.acos(u_x)),1) #[Degrees]
beta = round(math.degrees(math.acos(u_y)),1) #[Degrees]
gamma = round(math.degrees(math.acos(u_z)),1) #[Degrees]
# Result
print"alpha = ",(alpha),"degrees"
print"beta = ",(beta),"degrees"
print"gamma = ",(gamma),"degrees"
# Example 2.13
import math
from __future__ import division
# Variable Declaration
A_x = 0 #[meters]
A_y = 0 #[meters]
A_z = 8 #[meters]
B_x = 3 #[meters]
B_y = -2 #[meters]
B_z = 2 #[meters]
# Calculation
# r = B - A
r_x = B_x - A_x #[meters]
r_y = B_y - A_y #[meters]
r_z = B_z - A_z #[meters]
r = math.sqrt(r_x**(2)+r_y**(2)+r_z**(2))
# Assume u to be a unit vector along r
u_x = r_x/r
u_y = r_y/r
u_z = r_z/r
# Since F = 70 N and direction is specified by u
F_x = 70 * u_x #[Newton]
F_y = 70 * u_y #[Newton]
F_z = 70 * u_z #[Newton]
alpha = round(math.degrees(math.acos(u_x)),1) #[Degrees]
beta = round(math.degrees(math.acos(u_y)),1) #[Degrees]
gamma = round(math.degrees(math.acos(u_z)),1) #[Degrees]
# Result
print"F_x = ",(F_x),"N"
print"F_y = ",(F_y),"N"
print"F_z = ",(F_z),"N"
print"alpha = ",(alpha),"degrees"
print"beta = ",(beta),"degrees"
print"gamma = ",(gamma),"degrees"
# Example 2.14
import math
from __future__ import division
# Variable Declaration
A_x = 0 #[meters]
A_y = 0 #[meters]
A_z = 2 #[meters]
B_x = 1.707 #[meters]
B_y = 0.707 #[meters]
B_z = 0 #[meters]
# Calculation
# r = B - A
r_x = B_x - A_x #[meters]
r_y = B_y - A_y #[meters]
r_z = B_z - A_z #[meters]
r = math.sqrt(r_x**(2)+r_y**(2)+r_z**(2))
# Assume u to be a unit vector along r
u_x = r_x/r
u_y = r_y/r
u_z = r_z/r
# Since F = 500 N and direction is specified by u
F_x = round(500 * u_x,1) #[Newton]
F_y = round(500 * u_y,1) #[Newton]
F_z = round(500 * u_z,1) #[Newton]
F = round(math.sqrt(F_x**(2)+F_y**(2)+F_z**(2)),1) #[Newton]
# Result
print"F_x = ",(F_x),"N"
print"F_y = ",(F_y),"N"
print"F_z = ",(F_z),"N"
print"F = ",(F),"N"
# Example 2.15
import math
from __future__ import division
# Variable Declaration
FAB = 100 #[Newton]
FAC = 120 #[Newton]
A_x = 0 #[meters]
A_y = 0 #[meters]
A_z = 4 #[meters]
B_x = 4 #[meters]
B_y = 0 #[meters]
B_z = 0 #[meters]
C_x = 4 #[meters]
C_y = 2 #[meters]
C_z = 0 #[meters]
# Calculation(FAB)
rAB_x = B_x - A_x #[meters]
rAB_y = B_y - A_y #[meters]
rAB_z = B_z - A_z #[meters]
rAB = round(math.sqrt(rAB_x**(2)+rAB_y**(2)+rAB_z**(2)),2)
FAB_x = round(FAB*(rAB_x/rAB),1) #[Newton]
FAB_y = round(FAB*(rAB_y/rAB),1) #[Newton]
FAB_z = round(FAB*(rAB_z/rAB),1) #[Newton]
# Calculation(FAC)
rAC_x = C_x - A_x #[meters]
rAC_y = C_y - A_y #[meters]
rAC_z = C_z - A_z #[meters]
rAC = round(math.sqrt(rAC_x**(2)+rAC_y**(2)+rAC_z**(2)),2)
FAC_x = round(FAC*(rAC_x/rAC),1) #[Newton]
FAC_y = round(FAC*(rAC_y/rAC),1) #[Newton]
FAC_z = round(FAC*(rAC_z/rAC),1) #[Newton]
# FR = FAB + FAC
FR_x = FAB_x + FAC_x #[Newton]
FR_y = FAB_y + FAC_y #[Newton]
FR_z = FAB_z + FAC_z #[Newton]
FR = round(math.sqrt(FR_x**(2)+FR_y**(2)+FR_z**(2)),0)
print"FR = ",(FR),"N"
# Example 2.16
import math
from __future__ import division
# Variable Declaration
rB_x = 2 #[meters]
rB_y = 6 #[meters]
rB_z = 3 #[meters]
F_x = 0 #[Newton]
F_y = 300 #[Newton]
F_z = 0 #[Newton]
# Calculation
F = math.sqrt(F_x**(2)+F_y**(2)+F_z**(2)) #[Newton]
# Let uB be unit vector defining direction of AB
rB = math.sqrt(rB_x**(2)+rB_y**(2)+rB_z**(2)) #[meters]
uB_x = rB_x/rB
uB_y = rB_y/rB
uB_z = rB_z/rB
# The magnitude of component of F along AB is equal to dot product of F and unit vector uB
FAB = round(F_x*uB_x + F_y*uB_y + F_z*uB_z,1) #[Newton]
# Expressing FAB in Cartesian form
FAB_x = round(FAB*uB_x,1) #[Newton]
FAB_y = round(FAB*uB_y,1) #[Newton]
FAB_z = round(FAB*uB_z,1) #[Newton]
FAB = round(math.sqrt(FAB_x**(2)+FAB_y**(2)+FAB_z**(2)),1) #[Newton]
# Let Fp be perpendicular component
Fp_x = F_x - FAB_x #[Newton]
Fp_y = F_y - FAB_y #[Newton]
Fp_z = F_z - FAB_z #[Newton]
Fp = round(math.sqrt(F**(2)-FAB**(2)),0) #[Newton]
# Result
print"FAB = ",(FAB),"N"
print"FAB_x = ",(FAB_x),"N"
print"FAB_y = ",(FAB_y),"N"
print"FAB_z = ",(FAB_z),"N"
print"Fp = ",(Fp),"N"
# Example 2.17
import math
from __future__ import division
# Variable Declaration
F = 80 #[Newton]
A_x = 0
A_y = 1
A_z = 0
B_x = 2
B_y = 3
B_z = -1
C_x = 2
C_y = 0
C_z = 0
# Calculation
rBA_x = A_x - B_x
rBA_y = A_y - B_y
rBA_z = A_z - B_z
rBC_x = C_x - B_x
rBC_y = C_y - B_y
rBC_z = C_z - B_z
rBA = round(math.sqrt(rBA_x**(2)+rBA_y**(2)+rBA_z**(2)),2)
rBC = round(math.sqrt(rBC_x**(2)+rBC_y**(2)+rBC_z**(2)),2)
theta = round(math.degrees(math.acos((rBA_x*rBC_x+rBA_y*rBC_y+rBA_z*rBC_z)/(rBA*rBC))),1)
# let uBA be unit vector along BA
uBA_x = rBA_x/rBA
uBA_y = rBA_y/rBA
uBA_z = rBA_z/rBA
F_x = round(F*(rBC_x/rBC),2) #[Newton]
F_y = round(F*(rBC_y/rBC),2) #[Newton]
F_z = round(F*(rBC_z/rBC),2) #[Newton]
# FBA = F.uBA
FBA = round(F_x*uBA_x + F_y*uBA_y + F_z*uBA_z,1) #[Newton]
# Since theta was calculated FBA can be calculated by FBA = F*cos(theta)
# Let Fp be perpendicular component
Fp = round(F*math.sin(theta*math.pi/180),1) #[Newton]
# Result
print"theta = ",(theta),"degrees"
print"FBA = ",(FBA),"N"
print"Fp = ",(Fp),"N"