Chapter 1:Vectors

Example 1.1-1,Page no: 8

In [32]:
import math

#Initialisation of Variables

f1=120 #lb
f2=100 #lb
theta=((60*pi)/180) #radians

#Calculations

R=sqrt(120**2+100**2-(2*120*100*cos(theta))) #Applying Thr rule of Cosines
alpha1=(((arcsin(120*sin(theta)/111))*180)/pi) #Applying the Law of Sines
alpha=alpha1+270 #As the vector lies in the fourth Quadrant by obsrevaton

#Results

print'The Resultant of The force system is equal to',round(R),"lb" #lb
print'The Resultant is at',round(alpha),"degrees" #degrees
The Resultant of The force system is equal to 111.0 lb
The Resultant is at 339.0 degrees

Example 1.1-2,Page no: 9

In [1]:
import math

#Initilization of variables

P=100 #lb
Q=120 #lb
theta=((30*pi)/180) #radians

#Calculations

R_x=Q*cos(theta) #lb
R_y=Q*sin(theta)-P #lb
R=sqrt(R_x**2+R_y**2) #lb Triangle law
Theta_1=((arctan(R_y/R_x))*180)/pi #degrees
Theta_R=360+Theta_1 #degrees

#Result

print'The resultant of the force system is',round(R),"lb"
print'The resultant is at',round(Theta_R),"degrees"
The resultant of the force system is 111.0 lb
The resultant is at 339.0 degrees

Example 1.1-3,Page No: 9

In [1]:
import math

# Initialization of variables

R=400 # N
F2=200 # N
Theta1=((120*pi)/180) # radians
Theta2=((20*pi)/180) # radians
Theta=Theta1-Theta2 # radians

# Calculation

F=sqrt(R**2+F2**2-(2*R*F2*cos(Theta))) # N.Applying the Rule of Cosine
Theta_r=arcsin((400*sin(Theta))/F) #radians Applying the rule of sines
Theta_R=(Theta_r*180)/pi

# Result

print'The resultant of the force system is',round(F),"N"
print'The Angle between F and 200N force is',round(Theta_R,1),"degrees"

# Theta_R is off by 0.1 degrees
The resultant of the force system is 477.0 N
The Angle between F and 200N force is 55.6 degrees

Example 1.1-4, Page No: 9

In [35]:
import math

# Initilization of variables

F1=280 # N
F2=130 # N
Theta1=((320*pi)/180) # Radians
Theta2=((60*pi)/180) # Radians

# Calculations

R_x=-F1*cos(Theta1)+F2*cos(Theta2) # N
R_y=F1*sin(Theta1)-F2*sin(Theta2) # N
R=sqrt(R_x**2+R_y**2) # N Applying Triangle Law
ThetaR=arctan(R_y/R_x) # radians
Theta_R=360-(ThetaR*180/pi) # degrees

# Result

print'The resultant of the force system is',round(R),"N"
print'The resultant is at',round(Theta_R),"degrees"

# The answer for R waries from textbook. 
The resultant of the force system is 329.0 N
The resultant is at 297.0 degrees

Example 1.1-5, Page No: 10

In [36]:
import math

# Initialization of variables

F1=26 #lb
F2=39 #lb
F3=63 #lb
F4=57 #lb
T1=((10*pi)/180) #Radians
T2=((114*pi)/180) #Radians
T3=((183*pi)/180) #radians
T4=((261*pi)/180) #radians

# Calculations

R_x=F1*cos(T1)+F2*cos(T2)+F3*cos(T3)+F4*cos(T4) # lb Resolving vectors
R_y=F1*sin(T1)+F2*sin(T2)+F3*sin(T3)+F4*sin(T4) # lb resolving vectors
R=sqrt(R_x**2+R_y**2) # lb Applying Triangle Law
theta=arctan(R_y/R_x)# radians
Theta=(theta*180)/pi # degrees
Theta_R=180+Theta

# Results

print'The Resultant of the force system is',round(R),"lb"
print'The resultant is at',round(Theta_R),"degrees"
The Resultant of the force system is 65.0 lb
The resultant is at 197.0 degrees

Example 1.1-6, Page No: 11

In [11]:
import math

#Initilization of variables

F=10 #lb
theta1=((60*pi)/180) #radians
theta2=((45*pi)/180) #radians
theta=theta1-theta2 #radians

#Calculation

F_OH=F/cos(theta) #lb resolving vectors

# Result

print'The component of F in the direction of OH is',round(F_OH,2),"lb"
The component of F in the direction of OH is 10.35 lb

Example 1.1-7, Page No: 11

In [37]:
import math

#Initilization of variables

weight=80 #kg
theta=((20*pi)/180) #radians
theta_p=((70*pi)/180) # radians

#Calcuations

#Part (a)
F=weight*9.81 # N
R=F*cos(theta) #N
#part (b)
R_p=F*cos(theta_p) #N

#Result

print'The normal component is',round(R),"N"
print'The parallel component is',round(R_p),"N"
The normal component is 737.0 N
The parallel component is 268.0 N

Example 1.1-8, Page No: 11

In [2]:
import math

#Initilization of variables

P=235 #N
theta=((60*pi)/180) #radians
bet=((22*pi)/180) #radians
gam=((38*pi)/180) #radians

#Calculations

#Part (a)
P_h=P*cos(theta) #N
P_v=P*sin(theta) #N
#Part (b)
P_l=P*cos(theta-bet) #N
P_p=P*sin(gam) #N

#Result

print'The horizontal component is',round(P_h,1),"N"
print'The vertical component is',round(P_v,1),"N"
print'The component parallel to plane is',round(P_l),"N"
print'The component perpendicular to the plane is',round(P_p,1),"N"

#The decimal point accuracy might cause a small discrepancy in the answers
The horizontal component is 117.5 N
The vertical component is 203.5 N
The component parallel to plane is 185.0 N
The component perpendicular to the plane is 144.7 N

Example 1.1-9, Page No: 12

In [23]:
import math

#Initilization of variables

F1=90 #lb
theta1=((40*pi)/180) #radians
theta2=((30*pi)/180) #radians

# Calculations

R_x=0 #lb
R_y=20 # lb
#Taking the sum of forces in the X-Direction
P=((F1*cos(theta1))/cos(theta2)) # lb
# Taking the sum of the forces in the Y-Direction
F=(P*sin(theta2))+(F1*sin(theta1))-20 #lb

# Results

print'The value of P is',round(P,1),"lb"
print'The value of F is',round(F,1),"lb"

# Decimal point error may cause a small discrepancy in the answers.
The value of P is 79.6 lb
The value of F is 77.7 lb

Example 1.1-10, Page No: 12

In [2]:
import math

#Initilization of variables

x=4 # m
y=3 # m
z=2 # m
F=50 #N

# Calculations

OP=sqrt(x**2+y**2+z**2) #m
thetax=(x/OP) #radians
thetay=(y/OP) #Radians
thetaz=(z/OP) #radians
P_x=F*(thetax) #N
P_y=F*(thetay) #N
P_z=F*(thetaz) #N

# Result

print'The vector P is',round(P_x,1),"i +",round(P_y,1),"j +",round(P_z,1),"k"

# component of i is off by 0.1 units
The vector P is 37.1 i + 27.9 j + 18.6 k

Example 1.1-11, Page No: 12

In [3]:
import math

#Initilization of variables

x=2 
y=-4
z=1
F=100 #N

#Calculation

thetax=x/sqrt(x**2+y**2+z**2) #radians
thetay=y/sqrt(x**2+y**2+z**2) #radians
thetaz=z/sqrt(x**2+y**2+z**2) #radians
P_x=F*thetax #N
P_y=F*thetay #N
P_z=F*thetaz #N

#Result

print'The vector P is',round(P_x,1),"i",round(P_y,1),"j +",round(P_z,1),"k"

# component off i is off by 0.1 units
The vector P is 43.6 i -87.3 j + 21.8 k

Example 1.1-12, Page No: 13

In [21]:
import math

#Solution

print'P X Q=(Pxi+Pyj+Pzk)x(Qxi+Qyj+Qzk)'
print'       =(PxQx)i x i+(PxQy)i x j +(PxQz)i x k'
print'But i x i = j x j = k x k =0; and i x j =k and j x i= -k, etc. Hence'
print'P X Q= (PxQy)k-(PxQz)j-(PyQx)k+(PxQz)i+(PzQx)j-(PzQy)i'
print'These terms can be grouped as'
print'P X Q=(PyQz-PzQy)i+(PzQx-PxQz)j+(PxQy-PyQx)k'
P X Q=(Pxi+Pyj+Pzk)x(Qxi+Qyj+Qzk)
       =(PxQx)i x i+(PxQy)i x j +(PxQz)i x k
But i x i = j x j = k x k =0; and i x j =k and j x i= -k, etc. Hence
P X Q= (PxQy)k-(PxQz)j-(PyQx)k+(PxQz)i+(PzQx)j-(PzQy)i
These terms can be grouped as
P X Q=(PyQz-PzQy)i+(PzQx-PxQz)j+(PxQy-PyQx)k

Example 1.1-13,Page No: 13

In [24]:
import math

#Initilization of variables

Fx=2.63 #N
Fy=4.28 #N
Fz=-5.92 #N

#Calculation

F=sqrt(Fx**2+Fy**2+Fz**2) #N
thetax=((arccos(Fx/F))*180)/pi #degrees
thetay=((arccos(Fy/F))*180)/pi #degrees
thetaz=((arccos(Fz/F))*180)/pi #degrees

#Result

print'The magnitude of force is',round(F,2),"N"
print'Thetax',round(thetax,1),"degrees"
print'Thetay',round(thetay,1),"degrees"
print'Thetaz',round(thetaz,1),"degrees"

# Decimal point error may cause a small discrepancy in the answers.
The magnitude of force is 7.76 N
Thetax 70.2 degrees
Thetay 56.5 degrees
Thetaz 139.7 degrees

Example 1.1-14, Page No: 13

In [29]:
import math

#Initilization of variables

P=[4.82, -2.33, 5.47] #N
Q=[-2.81,-6.09,1.12 ] #m

#Calculations

M=P[0]*Q[0]+P[1]*Q[1]+P[2]*Q[2] #Nm

#Results

print'Result is',round(M,2),"N.m"

# Decimal point error in calculation causes a small discrepancy in the answer.
Result is 6.77 N.m

Example 1.1-15, Page No: 13

In [2]:
import math
import numpy as np
#Initilization of variables

x1=2 #units
x2=-2 #units
y1=3 #units
y2=4 #units
z1=0 #units
z2=6 #units
P=np.array([2,3,-1]) #units

#Calculations

X=sqrt((x2-x1)**2+(y2-y1)**2+(z2-z1)**2) #units
eLx=(x2-x1)/X #units
eLy=(y2-y1)/X #units
eLz=(z2-z1)/X #units
Q=np.array([eLx,eLy,eLz]) #units
Z=P[0]*Q[0]+P[1]*Q[1]+P[2]*Q[2] # units

#Result

print'The unit vector is',round(eLx,3),"i +",round(eLy,3),"j +",round(eLz,3),"k"
print'The projection of P is',round(Z,2),"units"

#Note:The final answer for the projection of P is off by 0.1 units
#The answer mentioned in the textbook is -1.41
The unit vector is -0.549 i + 0.137 j + 0.824 k
The projection of P is -1.51 units

Example 1.1-16, Page No: 14

In [4]:
import math
import numpy as np
#Initilization of variables

x1=2 #units
x2=5 #units
y1=-5 #units
y2=2 #units
z1=3 #units
z2=-4 #units
P=np.array([10,-8,14]) #units

#Calculations

X=sqrt((x2-x1)**2+(y2-y1)**2+(z2-z1)**2) #units
eLx=(x2-x1)/X #units
eLy=(y2-y1)/X #units
eLz=(z2-z1)/X #units
Q=np.array([eLx,eLy,eLz]) #units
Z=P[0]*Q[0]+P[1]*Q[1]+P[2]*Q[2] #units

#Result

print'The unit vector is',round(eLx,3),"i +",round(eLy,3),"j",round(eLz,3),"k" 
print'The projection of P is',round(Z),"lb"
The unit vector is 0.29 i + 0.677 j -0.677 k
The projection of P is -12.0 lb

Example 1.1-17, Page No: 14

In [45]:
import math

Px=2.85 #ft
Py=4.67 #ft
Pz=-8.09 #ft
Qx=28.3 #lb
Qy=44.6 #lb
Qz=53.3 #lb

#Calculations

X=(Py*Qz-Pz*Qy) #N.m 
Y=(Pz*Qx-Px*Qz) #N.m
Z=(Px*Qy-Py*Qx) #N.m

#Result

print'The cross product is',round(X),"i",round(Y),"j",round(Z),"k lb-ft"
The cross product is 610.0 i -381.0 j -5.0 k lb-ft

Example 1.1-18, Page No: 14

In [47]:
import math

#Result
#As this is symbolic solution directly print command is being used to give the required output

print'The Time derivative is '
print'dr/dt=(dx/dt)i+12*y(dy/dt)j-3*(dz/dt)k'
The Time derivative is 
dr/dt=(dx/dt)i+12*y(dy/dt)j-3*(dz/dt)k

Example 1.1-19, Page No: 14

In [5]:
import math
from scipy.integrate import quad
def integrand(x, a, b):
    return x**2
a=1
b=1
I=quad(integrand, 1, 3, args=(a,b))

def integrand(y, a, b):
    return 2*y
a=1
b=1
J=quad(integrand, 1, 3, args=(a,b))

def integrand(z, a, b):
    return 1
a=1
b=1
K=quad(integrand, 1, 3, args=(a,b))

# Results
print'The answer is',round(I[0],2),"i +",round(J[0]),"j -",round(K[0]),"k."
The answer is 8.67 i + 8.0 j - 2.0 k.