# Ex 12.1
from scipy import integrate
from scipy.misc import derivative
# Calculation
# Position
t = lambda t: 3*t**2+2*t
s = round(integrate.quad(t, 0, 3)[0],1) #[meter]
# Acceleration
# a = dv/dt
def f(t):
return 3*t**2+2*t
a = round(derivative(f, 3),1) #[meter per seconds square]
# Result
print"s = ",(s),"m"
print"a = ",(a),"m/s**(2)"
# Ex 12.2
from scipy import integrate
from __future__ import division
# Calculation
# At t = 4 s
v = round(((1/(60**(2))) +0.8*4)**(-0.5),3) #[meter per second]
# ds = vdt
t = lambda t: ((1/(60**(2))) +0.8*t)**(-0.5)
s = round(integrate.quad(t, 0, 4)[0],2) #[meter]
# Result
print"v = ",(v),"m/s"
print"s = ",(s),"m"
# Ex 12.3
from __future__ import division
import math
# Variable Declaration
vA = 75 #[meter per second]
aC = -9.81 #[meter per second square]
sA = 40 #[meter]
# Calculation
# Maximum height
sB = round((-75**(2)/(2*-9.81))+40,1) #[meter]
# Velocity
# Method 1
vC = round(math.sqrt(0+2*(-9.81)*(0-327)),1) #[meter per second]
# Method 2
vC = round(math.sqrt(75**(2)+2*(-9.81)*(0-40)),1) #[meter per second]
# Result
print"sB = ",(sB),"m"
print"vC = ",(vC),"m"
# Ex 12.4
from scipy import integrate
import math
from __future__ import division
# Calculation
vB = round(2*(0.2**(2)-0.01)**(0.5)*1000,1) #[millimeter per second]
s = lambda s: (0.5)*(1/math.sqrt(s**(2)-0.01))
t = round(integrate.quad(s, 0.1, 0.2)[0],3) #[seconds]
# Result
print"vB = ",(vB),"mm/s"
print"t = ",(t),"s"
# Ex 12.5
from __future__ import division
# Calculation
# ds = vdt
# s = t**(3)-3*t**(2) m
# Let s1 be displacement at t = 0 sec
s1 = 0**(3)-3*0**(2) #[meter]
# Let s2 be displacement at t = 2 sec
s2 = 2**(3)-3*2**(2) #[meter]
# Let s3 be displacement at t = 0 sec
s3 = 3.5**(3)-3*3.5**(2) #[meter]
# Let sT be distance travelled in 3.5 sec
sT = round(abs(s2)+abs(s2)+abs(s3),1) #[meter]
# Velocity
# Let delta_s be displacement from t = 0 to t = 3.5 s
delta_s = s3 - s1 #[meter]
# let v_avg be average velocity
v_avg = delta_s/(3.5-0) #[meter per second]
# Let vsp_avg be average speed defined in terms of distance travelled sT
vsp_avg = round(sT/(3.5-0),2) #[meter per second]
# Result
print"sT = ",(sT),"m"
print"v_avg = ",(v_avg),"m/s"
print"vsp_avg = ",(vsp_avg),"m/s"
# Ex 12.6
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show
# Calculation
# v-t graph
plot(
[0,10,30],
[0,10,10],
color='b',linewidth = 2
)
plot(
[0,10],
[10,10],
color='g',linestyle='--'
)
plot(
[10,10],
[0,10],
color='g',linestyle='--'
)
plot(
[30,30],
[0,10],
color='g',linestyle='--'
)
text(2.6,5.8,'v = t',color='r')
text(15,10.2,'v = 10',color='r')
axis([0,40,0,20])
title('Plot of v-t')
xlabel('t(s)')
ylabel('v(m/s)')
show()
print"\n\n"
# a-t graph
plot(
[0,10],
[1,1],
color='b',linewidth = 2
)
plot(
[10,30],
[0,0],
color='b',linewidth = 2
)
plot(
[10,10],
[0,1],
color='g',linestyle='--'
)
axis([0,40,0,2])
title('Plot of a-t')
xlabel('t(s)')
ylabel('a(m/s**(2))')
show()
# Ex 12.7
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show
# Calculation
# v-t graph
plot(
[0,10,60],
[0,100,0],
color='b',linewidth = 2
)
plot(
[10,10],
[0,100],
color='g',linestyle='--'
)
plot(
[0,10],
[100,100],
color='g',linestyle='--'
)
text(0,95,'v = 10t',color='r')
text(30,66,'v = -2t + 120',color='r')
axis([0,80,0,150])
title('Plot of v-t')
xlabel('t(s)')
ylabel('v(m/s)')
show()
print"\n\n"
# s-t graph
l1 = []
l2 = []
for i in range(0,11,1):
l1.append(i)
l2.append(5*i**(2))
plot(
l1,
l2,
color='b',linewidth = 2
)
l1 = []
l2 = []
for i in range(10,61,1):
l1.append(i)
l2.append(-(i**(2))+120*i-600)
plot(
l1,
l2,
color='b',linewidth = 2
)
plot(
[10,10],
[0,500],
color='g',linestyle='--'
)
plot(
[0,10],
[500,500],
color='g',linestyle='--'
)
plot(
[60,60],
[0,3000],
color='g',linestyle='--'
)
plot(
[0,60],
[3000,3000],
color='g',linestyle='--'
)
text(8,200,'s = 5t**(2)',color='r')
text(25,1500,'s = t**(2) + 120t - 600',color='r')
axis([0,80,0,3500])
title('Plot of s-t')
xlabel('t(s)')
ylabel('s(m)')
show()
# Ex 12.8
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show
from __future__ import division
# Calculation
# a-s graph
l1 = []
l2 = []
for i in range(0,51,1):
l1.append(i)
l2.append(0.16*i+2)
plot(
l1,
l2,
color='b',linewidth = 2
)
l1 = []
l2 = []
for i in range(50,101,1):
l1.append(i)
l2.append(0)
plot(
l1,
l2,
color='b',linewidth = 2
)
plot(
[50,50],
[0,10],
color='g',linestyle='--'
)
plot(
[0,50],
[10,10],
color='g',linestyle='--'
)
text(4,8,'a = 0.16*s + 2',color='r')
text(52,2,'a = 0',color='r')
axis([0,120,0,15])
title('Plot of s-t')
xlabel('t(s)')
ylabel('s(m)')
show()
print"\n\n"
# Variable Declaration
s = 100 #[meter]
t = s/50 + 10.07 #[seconds]
# Result
print"t = ",(t),"s"
# Ex 12.9
import math
from __future__ import division
# Calculation
# Position
x = 16 #[meter]
y = 16**(2)/10 #[meter]
# Let r be straight line distance from A to B
r = round(math.sqrt(x**(2)+y**(2)),1) #[meter]
# Velocity
vx = 8 #[meter per second]
vy = (2*16*8)/10 #[meter per second]
# Let v be magnitude of velocity at t = 2 s
v = round(math.sqrt(vx**(2)+vy**(2)),1) #[meter per second]
theta_v = round(math.degrees(math.atan(vy/vx)),1) #[Degrees]
# Accceleration
ax = 0 #[meter per second square]
ay = 2*8**(2)/10+2*16*0/10 #[meter per second square]
a = round(math.sqrt(ax**(2)+ay**(2)),1) #[meter per second square]
theta_a = 90 #[Degrees]
# Result
print"r = ",(r),"m"
print"v = ",(v),"m/s"
print"theta_v = ",(theta_v),"degrees"
print"a = ",(a),"m/s**(2)"
print"theta_a = ",(theta_a),"degrees"
# Ex 12.10
import math
from __future__ import division
# Calculation
# Position
r_x = round(0.5*math.sin(1.5),3) #[meter]
r_y = round(0.5*math.cos(1.5),4) #[meter]
r_z = round(-0.2*(0.75),4) #[meter]
r = round(math.sqrt(r_x**(2)+r_y**(2)+r_z**(2)),3) #[meter]
alpha = round(math.degrees(math.acos(r_x/r)),1) #[Degrees]
beta = round(math.degrees(math.acos(r_y/r)),1) #[Degrees]
gamma = round(math.degrees(math.acos(r_z/r)),1) #[Degrees]
# Velocity
v = round(math.sqrt((1*math.cos(1.5))**(2)+(-1*math.sin(1.5))**(2)+(-0.2)**(2)),3) #[meter per second]
# Accelaration
a = math.sqrt((-2*math.sin(1.5))**(2)+(-2*math.cos(1.5))**(2)) #[meter per second square]
# Result
print"r_x = ",(r_x),"m"
print"r_y = ",(r_y),"m"
print"r_z = ",(r_z),"m"
print"r = ",(r),"m"
print"alpha = ",(alpha),"degrees"
print"beta = ",(beta),"degrees"
print"gamma = ",(gamma),"degrees"
print"v = ",(v),"m/s"
print"a = ",(a),"m/s**(2)"
# Ex 12.11
from __future__ import division
import math
# Variable Declaration
v = 12 #[meters]
# Calculation
# Vertical motion
tAB = round(math.sqrt(-6/((1/2)*(-9.81))),2) #[seconds]
# Horizontal motion
R = 0+v*1.11 #[meter]
# Result
print"tAB = ",(tAB),"s"
print"R = ",(R),"m"
# Ex 12.12
import math
from __future__ import division
# Variable Declaration
v0 = 10 #[meter per second]
theta = 30 #[degrees]
# Calculation
vo_x = round(v0*math.cos(math.pi*30/180),2) #[meter per second]
vo_y = round(v0*math.sin(math.pi*30/180),2) #[meter per second]
# Horizontal Motion
tOA = round((8-0)/vo_x,4) #[seconds]
# Vertical Motion
h = round(0+5*tOA+(1/2)*(-9.81)*tOA**(2)+1,3) #[meter]
# Result
print"h = ",(h),"m"
# Ex 12.13
from __future__ import division
import math
# Calculation
# Vertical Motion
vA = round((-1-(1/2)*-9.81*1.5**(2))/(math.sin(math.pi*30/180)*1.5),2) #[meter per second]
# Horizontal Motion
R = round(0+vA*math.cos(math.pi*30/180)*1.5,1) #[meter]
h = round(((0**(2)-(vA*math.sin(math.pi*30/180))**(2))/(2*(-9.81)))+1,2) #[meter]
# Result
print"vA = ",(vA),"m/s"
print"R = ",(R),"m"
print"h = ",(h),"m"
# Ex 12.14
import math
from __future__ import division
# Calculation
# Velocity
# Velocity is always directed tangent to the path
vA = 6 #[meter per second]
# Acceleration
rho = round(((1+((1/10)*10)**(2))**(3/2))/(1/10),2) #[meter]
at = 2 #[meter per second**(2)]
an = round((6**(2))/rho,3) #[meter per second**(2)]
a = round(math.sqrt(at**(2)+an**(2)),2) #[meter per second**(2)]
phi = round(math.degrees(math.atan(at/an)),1) #[Degrees]
# Result
print"vA = ",(vA),"m/s"
print"a = ",(a),"m/s**(2)"
# Ex 12.15
import math
from __future__ import division
# Calculation
# Let t be time needed for acceleration to reach 3 m/s**(2)
t = round(math.sqrt((math.sqrt(3**(2)-2**(2)))/0.04),2) #[seconds]
# Velocity
# Let v be speed at time t = 7.48 s
v = 3*t #[meter per second]
# Result
print"t = ",(t),"s"
print"v = ",(v),"m/s"
# Ex 12.16
import math
from __future__ import division
# Calculation
tB = round((6.142/0.0333)**(1/3),3) #[seconds]
aBt = 0.2*5.690 #[meter per second square]
vB = 0.1*(tB**(2)) #[meter per second]
aBn = (vB**(2))/2 #[meter per second square]
aB = round(math.sqrt(aBt**(2)+aBn**(2)),2) #[meter per second square]
# Result
print"aB = ",(aB),"m/s**(2)"
# Ex 12.18
import math
from __future__ import division
# Calculation
vr = 200*1 #[millimeter per second]
vtheta = 100*(1)**(2)*3**(1) #[millimeter per second]
v = round(math.sqrt(vr**(2)+vtheta**(2)),1)
delta = round(math.degrees(math.atan(vtheta/vr)),1) #[Degrees]
ar = 200-100*(3**(2)) #[millimeter per second square]
atheta = 100*6+2*200*3 #[millimeter per second square]
a = round(math.sqrt(ar**(2)+atheta**(2)),1) #[millimeter per second square]
phi = round(math.degrees(math.atan(atheta/ar)),1) #[Degrees]
# Result
print"v = ",(v),"mm/s"
print"delta = ",(delta),"degrees"
print"a = ",(a),"mm/s**(2)"
print"phi = ",(phi),"degrees"
# Ex 12.19
import math
from __future__ import division
# Calculation
vr = round(400*(1/math.cos(math.pi*45/180))*math.tan(math.pi*45/180),1) #[meter per second]
vtheta = round(100*(1/math.cos(math.pi*45/180))*4,1) #[meter per second]
v = round(math.sqrt(vr**(2)+vtheta**(2)),1) #[meter per second]
ar = round((1600*((1/math.cos(math.pi*45/180))*(math.tan(math.pi*45/180)**(2))+(1/math.cos(math.pi*45/180)**(3)))) - 100*(1/math.cos(math.pi*45/180))*4**(2),1) #[meter per second square]
atheta = round(100*(1/math.cos(math.pi*45/180))*0+2*400*(1/math.cos(math.pi*45/180))*math.tan(math.pi*45/180)*4,1) #[meter per second square]
a = round(math.sqrt(ar**(2)+atheta**(2)),1) #[meter per second square]
# Result
print"v = ",(v),"m/s"
print"a = ",(a),"m/s**(2)"
# Ex 12.20
import math
# Variable Declaration
a = 10 #[meter per second square]
v = 1 #[meter per second]
# Calculation
theta_dot = math.sqrt((v**(2))-(0**(2))) #[radian per second]
theta_doubledot = round(math.sqrt((10**(2))-((-1.5)**(2))),2) #[radian per second square]
# Result
print"theta_dot = ",(theta_dot),"rad/s"
print"theta_doubledot = ",(theta_doubledot),"rad/s**(2)" # Correction in the answer
# Ex 12.21
# Calculation
vA = -3*-2 #[meter per second]
# Result
print"vA = ",(vA),"m/s"
# Ex 12.22
# Calculation
vA = -4*-2 #[meter per second]
# Result
print"vA = ",(vA),"m/s"
# Ex 12.23
from __future__ import division
# Calculation
vB = -2/4
# Result
print"vB = ",(vB),"m/s"
# Ex 12.24
from __future__ import division
import math
# Variable Declaration
vA = 0.5 #[meter per second]
# Calculation
vS = round((20*vA)/math.sqrt(225+20**(2)),1) #[meter per second]
aS = (225*vA**(2))/((225+20**(2))**(3/2)) #[meter per second square]
# Result
print"vS = ",(vS*1000),"mm/s"
print"aS = ",(aS*1000),"mm/s**(2)"
# Ex 12.25
import math
from __future__ import division
# Calculation Solution 1 Vector Analysis
vTA_x = round(60-45*math.cos(math.pi*45/180),1) #[kilometer per hr]
vTA_y = round(-45*math.sin(math.pi*45/180),1) #[kilometer per hr]
vTA = round(math.sqrt(vTA_x**(2)+vTA_y**(2)),1) #[kilometer per hr]
theta = round(math.degrees(math.atan(abs(vTA_y)/vTA_x)),1) #[Degrees]
# Result Solution 1
print"Solution 1"
print"vTA_x = ",(vTA_x),"km/hr"
print"vTA_y = ",(vTA_y),"km/hr"
print"vTA = ",(vTA),"km/hr"
print"theta = ",(theta),"degrees"
# Calculation Solution 2 Scalar Analysis
# vT = vA + vT/A
vTA_x = round(60-45*math.cos(math.pi*45/180),1) #[kilometer per hr]
vTA_y = round(-45*math.sin(math.pi*45/180),1) #[kilometer per hr]
# Result Solution 2
print"Solution 2"
print"vTA_x = ",(vTA_x),"km/hr"
print"vTA_y = ",(vTA_y),"km/hr"
# Ex 12.26
import math
from __future__ import division
# Variable Declaration
rho = 400 #[kilometers]
# Calculation
# Velocity
vBA = 600-700 #[kilometers per hr]
# Acceleration
aBn = 600**(2)/rho #[kilometers per hr square]
aBA_x = 900 #[kilometers per hr square]
aBA_y = -100-50 #[kilometers per hr square]
aBA = round(math.sqrt(aBA_x**(2)+aBA_y**(2)),1) #[kilometers per hr square]
theta = round(math.degrees(math.atan(abs(aBA_y)/aBA_x)),1) #[Degrees]
# Result
print"aBA = ",(aBA),"km/hr**(2)"
print"theta = ",(theta),"degrees"
# Ex 12.27
import math
from __future__ import division
# Variable Declaration
vA = 18 #[meter per second]
vB = 12 #[meter per second]
# Calculation
# Velocity
vBA_x = 18*math.cos(math.pi*60/180) #[meter per second]
vBA_y = 18*math.sin(math.pi*60/180)-12 #[meter per second]
vBA = round(math.sqrt(vBA_x**(2)+vBA_y**(2)),2) #[meter per second]
theta = round(math.degrees(math.atan(vBA_y/vBA_x)),1) #[Degrees]
# Acceleration
aBn = vB**(2)/100 #[meter per second square]
aBA_x = round(-1.440-2*math.cos(math.pi*60/180),3) #[meter per second square]
aBA_y = round(-3-2*math.sin(math.pi*60/180),3) #[meter per second square]
aBA = round(math.sqrt(aBA_x**(2)+aBA_y**(2)),2) #[meter per second square]
phi = round(math.degrees(math.atan(aBA_y/aBA_x)),1) #[Degrees]
# Result
print"vBA = ",(vBA),"m/s"
print"theta = ",(theta),"degrees"
print"aBA = ",(aBA),"m/s**(2)"
print"phi = ",(phi),"degrees"