# Chapter 3 : Motion in a Straight Line¶

## Example 3.1 , page : 43¶

In :
# Importing module

import math

# Variable declaration

l1=360                   # The distance from O to P in m
l2=120                   # The distance from P to Q in m
t1=18                    # The time taken to travel OP in s
t2=6                     # The time taken to travel PQ in s
d1=360                   # The displacement from O to P in m
d2=(l1-l2)               # The displacement from P to Q in m
p1=360                   # The total pathlength from O to P in m
p2=(l1+l2)               # The total pathlength from O to P and p to Q in m

# Calculation

#(a)
a_v1=d1/t1
a_s1=p1/t1

#(b)
a_v2=d2/(t1+t2)
a_s2=p2/(t1+t2)

# Result

print("(a)")
print("The average velocity of the car in going from O to P =",a_v1,"m/s")
print("The average speed of the car in going from O to P =",a_s1,"m/s")
print("(b)")
print("The average velocity of the car in going from O to P and back to Q =",a_v2,"m/s")
print("The average speed of the car in going from O to P and back to Q =",a_s2,"m/s")

(a)
The average velocity of the car in going from O to P = 20.0 m/s
The average speed of the car in going from O to P = 20.0 m/s
(b)
The average velocity of the car in going from O to P and back to Q = 10.0 m/s
The average speed of the car in going from O to P and back to Q = 20.0 m/s


## Example 3.2 , page : 45¶

In :
# Importing module

import math
import numpy as np

# Variable declaration

a=8.5                    # Distance in m
b=2.5                    # Acceleration in m/s²

# Calculation

#  In notation of differential calculus, the velocity is  v = dx/dt = d (a+bt²)/dt = 2bt = 5.0t

p0=np.polyval([0,5,0],0) # Velocity at t= 1.0 s
p2=np.polyval([0,5,0],2) # Velocity at t= 2.0 s
p4=np.polyval([0,5,0],4) # Velocity at t= 4.0 s
avg_v=(p2+p4)/2

# Result

print("The velocity at t = 0.0 s =",p0,"m/s")
print("The velocity at t = 2.0 s  =",p2,"m/s")
print("The average velocity between t = 2.0 s and t = 4.0 s =",avg_v,"m/s")

The velocity at t = 0.0 s = 0 m/s
The velocity at t = 2.0 s  = 10 m/s
The average velocity between t = 2.0 s and t = 4.0 s = 15.0 m/s


## Example 3.3 , page : 48¶

In :
# Calculation

# By definition, a = dv/dt
# .i.e  dv = adt
# Integrating on both sides we get, v - v_o = at  or  v = v_o + at
# Further we know that, v = dx/dt
# .i.e  dx = vdt
# Integrating on both sides we get, x - x_o = v_ot + (1/2)at²  or   x = x_o + v_ot + (1/2)at²
# Now we can write,  a = dv/dt = (dv/dx)(dx/dt) = v(dv/dx)
# .i.e. v dv = a dx
# Integrating on both sides we get, (v² - v²_o) = a(x - x_o)  or   v² = v²_o + 2a(x - x_o)

# Result

print("The equations of motion for constant acceleration using method of calculus are as follows.")
print("v = v_o + at")
print("x = x_o + v_ot + (1/2)at²")
print("v²= v²_o + 2a(x - x_o)")

The equations of motion for constant acceleration using method of calculus are as follows.
v = v_o + at
x = x_o + v_ot + (1/2)at²
v²= v²_o + 2a(x - x_o)


## Example 3.4 , page : 48¶

In :
# Importing module

import sympy

# Variable declaration

t = sympy.symbols('t')
v_o=20                   # Initial velocity in m/s
y_o=25                   # Height of the initial point from ground in m
a=-10                    # Acceleration due to gravity
v=0
y=0

# Calculation

#(a)
# Let us take the y-axis in the vertically upward direction with zero at the ground
# Since v=(v_o)²+2ah
h=(-(v_o)**2)/(2*a)

#(b)
# The total time taken can also be calculated by noting the coordinates of initial and final positions of the ball with respect to the origin chosen
# and using equation  (y - y_0) = v_ot + (1/2)at²
# Substituting the values in the above equation we get the quadratic equation for t as , 5t² - 20t -  25  =  0
t = round(max(sympy.solve(5*t**2 - 20*t -y_o,t)),0)

# Result

print("(a) The height at which the ball has risen =",h,"m")
print("(b) The time taken before the ball to hit the ground =",t,"s")

(a) The height at which the ball has risen = 20.0 m
(b) The time taken before the ball to hit the ground = 5.0 s


## Example 3.5 , page : 49¶

In :
# Calculation

# If air resistance is neglected, the object is said to be in free fall.
# If the height through which the object falls is small compared to the earths radius, g can be taken to be constant, equal to 9.8 ms².
# Free fall is thus a case of motion with uniform acceleration.
# We assume that the motion is in y-direction, more correctly in y-direction because we choose upward direction as positive.
# Since the acceleration due to gravity is always downward, it is in the negative direction.
# Then we have, a =  g  =  9.8 ms²
# The object is released from rest at y = 0. Therefore, v_0 = 0 and the equations of motion become as follows
# v =  0 - g t = 9.8t m/s
# y =  0 - (1/2)gt² = 4.9t² m
# v² = 0 - 2gy = -19.6 y   m²/s²

# Result

print("The motion of an object under free fall can be explained by the following equations")
print("v =  0 - g t = 9.8t m/s")
print("y =  0 - (1/2)gt² = 4.9t² m")
print("v² = 0 - 2gy = -19.6 y   m²/s²")

The motion of an object under free fall can be explained by the following equations
v =  0 - g t = 9.8t m/s
y =  0 - (1/2)gt² = 4.9t² m
v² = 0 - 2gy = -19.6 y   m²/s²


## Example 3.6 , page : 50¶

In :
# Result

print("Let us divide the time interval of motion of an object under free fall into many equal intervals τ  and find out the distancestraversed during successive intervals of time.")
print("Since initial velocity is zero, we have")
print("Using this equation, we can calculate the position of the object after different time intervals, 0, τ, 2τ,  3τ which are given in second column of Table 3.2. If we take (1/ 2) gτ2 as y0  the position coordinate after first time interval τ, then third column gives the positions in the unit of yo. The fourth column gives the distances traversed in successive τs. We find that the distances are in the simple ratio 1: 3: 5: 7: 9: 11 as  shown in the last column. This  law was established by Galileo Galilei (1564-1642) who was the first to make quantitative studies of free fall.")
print("Hence the proof.")

Let us divide the time interval of motion of an object under free fall into many equal intervals τ  and find out the distancestraversed during successive intervals of time.
Since initial velocity is zero, we have
Using this equation, we can calculate the position of the object after different time intervals, 0, τ, 2τ,  3τ which are given in second column of Table 3.2. If we take (1/ 2) gτ2 as y0  the position coordinate after first time interval τ, then third column gives the positions in the unit of yo. The fourth column gives the distances traversed in successive τs. We find that the distances are in the simple ratio 1: 3: 5: 7: 9: 11 as  shown in the last column. This  law was established by Galileo Galilei (1564-1642) who was the first to make quantitative studies of free fall.
Hence the proof.


## Example 3.7 , page : 50¶

In :
# Calculation

# Let the distance travelled by the vehicle before it stops be d_s.
# Then, using equation of motion  v² = v²_o + 2ax, and noting that  v = 0, we have the stopping distance as given below,
# The stopping distance, d_s = -v²_o / 2a

# Result

print("The stopping distance, d_s = -v²_o / 2a")

The stopping distance, d_s = -v²_o / 2a


## Example 3.8 , page : 51¶

In :
# Importing module

import math

# Variable declaration

v0=0                     # Initial velocity in m
g=9.8                    # Acceleration due to gravity
d=21                     # Distance travelled in cm

# Calculation

d=21*10**-2
t=math.sqrt((2*d)/g)     # Reaction time = √(2d/g)

# Result

print("Reaction Time =",round(t,1),"s")

Reaction Time = 0.2 s


## Example 3.9 , page : 52¶

In :
# Importing module

import math

# Variable declaration

# Choose the positive direction of X-axis to be from South to North
V_A=54                   # The speed of train A in km/h
V_B=-90                  # The speed of train B in km/h
V_MA=-18                 # The relative speed of monkey km/h

# Calculation

V_A=54*(5/18)            # The speed of train A in m/s
V_B=-90*(5/18)           # The speed of train B in m/s
V_MA=-18*(5/18)          # The relative speed of monkey m/s

#(a)
V_BA=V_B-V_A # Relative velocity of train B with respect to A

#(b)
V_GB=0-V_B # Relative velocity of ground with respect to train B

#(c)
# Since V_MA = V_M - V_A
V_M=V_MA+V_A

# Result

print("(a) Relative velocity of train B with respect to tain A =",V_BA,"m/s")
print("(b) Relative velocity of ground with respect to train B =",V_GB,"m/s")
print("(c) Speed of the monkey =",V_M,"m/s")

(a) Relative velocity of train B with respect to tain A = -40.0 m/s
(b) Relative velocity of ground with respect to train B = 25.0 m/s
(c) Speed of the monkey = 10.0 m/s