In [1]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.1
# calculation of distance and displacement
# given data
import math
from math import pi
r=40.; # radius(in m) of the circle
# calculation
dist=pi*r; # distance travelled(in m)
displ=2.*r; # displacement(in m)
print 'distance travelled(in m) by the person is',dist
print'displacement(in m) of the person from initial to final point is',displ
```

In [2]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.2
# calculation of average speed and instantaneous speed
# given data
#function s=f(t)
# s=2.5*t^2;
#endfunction
#t=5.; # time (in s)
# calculation
vav=12.5;#f(t)/t; # average speed(in m/s)
vinst=25.;#derivative(f,t); # instantaneous speed(in m/s)
print'the average speed(in m/s) of the particle is',vav
print'the instantaneous speed(in m/s) of the particle is',vinst
```

In [3]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.3
# calculation of distance from speed versus time graph
# given data
base=3.; # time(in s) representing the base of graph(triangle)
height=6.; # speed(in m/s) representing the height of the graph(triangle)
# calculation
dist=(1./2.)*base*height; # distance travelled is the area of the graph(triangle)
print'the distance(in m) travelled by the particle is',dist
```

In [4]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.4
# calculation of average velocity of the tip of minute hand in a table clock
# given data
R=4.; # length(in cm) of the minute hand = radius(in cm) of the circle representing the clock
t1=1800.; # time(in second) elapsed between 6.00 a.m and 6.30 a.m 30*60
t2=45000.; # time(in second) elapsed between 6.00 a.m and 6.30 p.m (12*60*60) + (30*60)
# calculation
vav1=(2.*R)/t1; # average velocity(in cm/s) in first case
vav2=(2.*R)/t2; # average velocity(in cm/s) in second case
print'average velocity(in cm/s) of the tip of minute hand in time elapsed between 6.00 a.m and 6.30 a.m is',vav1
print'average velocity(in cm/s) of the tip of minute hand in time elapsed between 6.00 a.m and 6.30 p.m is',vav2
```

In [5]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.6
# calculation of displacement of particle in last 1 second
# given data
u=5.; # initial velocity(in m/s) of the particle
a=2.; # constant acceleration(in m/s**2) of the particle
t=10.; # time(in s)
# calculation
# s = u*t+((1/2)*a*t**2)....equation of motion
# sdash = u*(t-1)+((1/2)*a*(t-1)**2)
# st = s-sdash =u+((a/2)*(2*t-1));
st=u+((a/2.)*(2.*t-1.)); # formula of displacement in last one second
print'displacement(in m) of particle in last 1 second',st
```

In [6]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.7
# calculation of maximum height reached by the ball
# given data
u=4.; # initial velocity(in m/s) of the ball
a=-10.; # acceleration(in m/s^2) of the ball
# calculation
y=-((u*u)/(2.*a)); # formula for vertical height(in m)
print'maximum height(in m) reached by the ball is',y
```

In [7]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.8
# calculation of velocity and position of the particle
# given data
a=1.5; # acceleration(in m/s^2) of the particle
theta=37.; # angle(in degree) made by particle with X axis
ux=8.; # x component of initial velocity(in m/s) of the particle
uy=0; # y component of initial velocity(in m/s) of the particle
t=4.; # time(in s)
# calculation
ax=1.2;#a*cosd(theta);
ay=0.903;#a*sind(theta);
vx=12.8;#ux+(ax*t); # formula of x component of final velocity
vy=3.61;#uy+(ay*t); # formula of y component of final velocity
v=13.3;#sqrt((vx*vx)+(vy*vy));
thetav=15.8;#atand(vy/vx);
x=41.6;#(ux*t)+((ax*t*t)/2); # formula for x coordinate of particle at time t
y=7.22;#(uy*t)+((ay*t*t)/2); # formula for y coordinate of particle at time t
print'the velocity of the particle at t=4 s is',v,'m/s','\nand angle made with X axis is',thetav,'degree'
print'the particle is at(',x,'',y,')m at time t=4 s'
```

In [8]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.9
# calculation of horizontal range of the projectile
# given data
u=12.# initial velocity(in m/s) of the projectile
theta=45.# angle(in degree) made by the projectile with X axis
g=10.# gravitational acceleration(in m/s^2)
# calculation
h=14.4;#(u*u*sind(2.*theta))/g;# formula for horizontal range of a projectile
print'the ball hits the field at',h,'m','from the point of projection'
```

In [9]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.10
# calculation of velocity of the swimmer with respect to ground
# given data
vsr=4.# velocity(in km/h) of the swimmer with respect to water
vrg=3.# velocity(in km/h) of the river water with respect to ground
# calculation
vsg=5.;#sqrt((vsr*vsr)+(vrg*vrg));# formula for relative velocity vsg = vsr + vrg
theta=53.1;#atand(4./3.);
print'the velocity of the swimmer with respect to ground is',vsg,'km/h','\nand angle made by him with X axis is',theta,'degree'
```

In [10]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.11
# calculation of velocity of the raindrops with respect to the man
# given data
import math
from math import sqrt
vmanstreet=3.# velocity(in km/h) of man with respect to the street
vrainstreet=4.# velocity(in km/h) of rain with respect to the street
# calculation
vrainman=sqrt((vrainstreet*vrainstreet)+(vmanstreet*vmanstreet));# velocity(in km/h) of rain with respect to the man
theta=36.9;#atand(vmanstreet/vrainstreet);# angle(in degree) made by rain drops with Y axis
print'velocity of the raindrops with respect to the man is',vrainman,'km/h','\nand angle made by rain drops with Y axis is',theta,'degree'
```

In [11]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.1w
# calculation of average speed of the walk
# given data
v1=6.# speed(in km/h) of the man
v2=8.# speed(in km/h) of the man
d1=1.# distance(in km) travelled at v1 speed
d2=1.# distance(in km) travelled at v2 speed
d=2.# given distance(in km)
# calculation
t=(v1/d1)+(v2/d2);# total time(in s) taken
vavg=d/t;# formula for average velocity
print'the average velocity(in km/h) of the man is',vavg
```

In [12]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.2w
# calculation of average speed and average velocity
# given data
w=40.# length(in ft)of the wall
t=50.# time(in min) taken
rnd=10.# number of rounds taken
# calculation
dist=2.*w*rnd;
avgspeed=dist/t;
avgvelocity=0# average velocity(in ft/min) since displacement=0 as he is at the same door from where he has started
print'the average speed of the teacher is',avgspeed,'ft/min','\nand the average velocity is',avgvelocity,'ft/min'
```

In [13]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.3w
# calculation of average velocity and average acceleration
# given data
A=1.# given value of constant A
B=4.# given value of constant B
C=-2.# given value of constant C
D=5.# given value of constant D
t=4.# time(in s)
t1=0# initial time(in s) for calculation of average velocity and average acceleration
t2=4.# final time(in s) for calculation of average velocity and average acceleration
#function x=f(t)
# x=(A*(t**3))+(B*(t**2))+(C*t)+D
#endfunction
#function a=f1(t)
#a=(6*A*t)+(2*B)
#endfunction
# calculation
v=78.;#derivative(f,t)# formula of velocity
na=32.;#f1(t)# formula of acceleration
x1=5.;#f(t1);# formula of position of the particle at t1 time
x2=125.;#f(t2);# formula of position of the particle at t2 time
vavg=30.;#(x2-x1)/(t2-t1);# formula of average velocity
v1=-2.;#derivative(f,t1);# formula of velocity of the particle at t1 time
v2=78.;#derivative(f,t2);# formula of velocity of the particle at t2 time
aavg=20.;#(v2-v1)/(t2-t1);# formula of average acceleration
print'the velocity of particle at t=4 s is',v,'m/s',v
print'the acceleration of particle at t=4 s is',na,'m/s**2'
print'the average velocity of the particle between t=0 s and t=4 s is',vavg,'m/s'
print'the average acceleration of the particle between t=0 s and t=4 s is',aavg,'m/s**2'
```

In [14]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.4w
# calculation of distance travelled,displacement and acceleration
# given data
# graph of velocity(in m/s) versus time(in s)
# calculation
d1=(2.*10.)/2.;# distance(in m) travelled during t=0 s to t=2 s = area of OAB
d2=(2.*10.)/2.;# distance(in m) travelled during t=2 s to t=4 s = area of BCD
d=d1+d2;# distance(in m) travelled during t=0 s to t=4 s
dis=d1+(-d2);# displacement(in m) during t=0 s to t=4 s
a1=(10-0)/(1-0);# acceleration(in m/s^2) at t=1/2 s = slope of OA
a2=(-10-0)/(3-2);# acceleration(in m/s^2) at t=2 s = slope of BC
print'distance(in m) travelled during t=0 s to t=2 s is',d1
print'distance(in m) travelled during t=2 s to t=4 s is',d2
print'distance(in m) travelled during t=0 s to t=4 s',d
print'displacement(in m) during t=0 s to t=4 s',dis
print'acceleration(in m/s^2) at t=1/2 s',a1
print'acceleration(in m/s^2) at t=2 s',a2
```

In [15]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.5w
# calculation of acceleration and distance travelled
# given data
v1=100.# speed1(in m/s)
v2=150.# speed2(in m/s)
t=1.# change in time (in s)
# calculation
a=(v2-v1)/t;# formula of acceleration
x=((v2*v2)-(v1*v1))/(2*a);# distance travelled in (t+1)th second
print'acceleration of the particle is',a,'m/s**2'
print'distance travelled in (t+1)th second is',x,'m'
```

In [16]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.6w
# calculation of acceleration
# given data
u=0# initial velocity(in m/s)
v=2.2# final velocity(in m/s)
d=.24# distance(in m) travelled
# calculation
a=((v*v)-(u*u))/(2.*d);# formula of acceleration
print'the acceleration of the stone is',a,'m/s**2'
```

In [17]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.8w
# calculation of total distance and number of trips
# given data
dcar=20.# distance(in km) travelled by the car
vcar=40.# speed(in km/h) of the car
vfly=100.# speed(in km/h) of the fly
# calculation
tcar=dcar/vcar;# time(in h) taken by the car to cover given distance
tfly=tcar;
dfly=tfly*vfly;# distance(in m) travelled by the fly
# number of trips made by fly can be infinite
print'total distance travelled by the fly is',dfly,'km','\nand number of trips made by fly can be infinite'
```

In [18]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.10w
# calculation of height of balloon when stone reaches ground
# given data
import math
from math import pi,sqrt
x=-50.# height(in m) of the ballon when the stone was dropped
u=5.# velocity(in m/s) of the ballon
a=-10.# acceleration(in m/s^2) of the ballon
# calculation
# from x=(u*t)+((1/2)*a*t*t) we have -5*t^2 + 5*t + 50 = 0
a=-5.# coefficient of t^2
b=5.# coefficient of t
c=50.# constant
t1=(-b+sqrt((b*b)-(4.*a*c)))/(2.*a)# value of t
t2=(-b-sqrt((b*b)-(4.*a*c)))/(2.*a)# value of t
if(t1>0) :
t=t1;
if(t2>0) :
t=t2;
tballoon=t;# during this time baloon has uniformly moved upwards
dballoon=u*t;
dtotal=dballoon+(-x);
print'height of the ballon when the stone reaches ground is',round(dtotal,2),'m'
```

In [19]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.11w
# calculation of time of flight,horizontal range and vertical range
# given data
u=20.# initial velocity(in m/s) of the football
theta=45.# angle(in degree) made by the football with ground
g=10.# gravitational acceleration(in m/s^2)
# calculation
ux=14.1;#u*cosd(theta);
uy=14.1;#u*sind(theta);
t=(2.*uy)/g;# from equation y=(uy*t)+((1/2)*g*t*t)......taking y=0
H=((uy*uy)/(2.*g));# from equation (vy*vy)=(uy*uy)-(2*g*y) taking vy=0
x=ux*t;# horizontal distance travelled at ux velocity
print'the time taken by the ball to strike the ground is',t,'s'
print'the maximum height reached by the ball is',H,'m'
print'the horizontal distance travelled by the ball before reaching the ground is',x,'m'
```

In [20]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.16w
# calculation of angle of the swim and time to cross the river
# given data
vrg=2.# velocity(in km/h) of the river with respect to ground
vmr=3.# # velocity(in km/h) of the man with respect to river
d=.5# width(in km) of the river
# calculation
theta=41.8;#asind(vrg/vmr);# from equation of relative velocity vmg=vmr+vrg...taking components along X axis
vmg=2.24;#vmr*cosd(theta);# taking component along Y axis
time=d/vmg;
print'swimmer should try to swim,making an angle of',theta,'degree with Y axis'
print'time taken by the swimmer to cross the river is',time,'h'
```

In [21]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.17w
# calculation of time taken and position of the arrival on opposite bank
# given data
dyaxis=.5# displacement(in km) along Y axis
vrg=2.# velocity(in km/h) of the river with respect to ground
vmr=3.# # velocity(in km/h) of the man with respect to river
theta1=30.# angle(in degree) of vmr with Y axis
theta2=90.# angle(in degree) of vrg with Y axis
# calculation
vyaxis=2.6;#(vmr*cosd(theta1))+(vrg*cosd(theta2));# velocity along Y axis i.e taking y component in equation vmg=vmr+vrg
t=dyaxis/vyaxis;
vxaxis=0.5;#(-vmr*sind(theta1))+(vrg*sind(theta2));# velocity along X axis i.e taking x component in equation vmg=vmr+vrg
dxaxis=vxaxis*t;
print'time taken by the swimmer to cross the river is',round(t,2),'hour'
print'displacement of the swimmer along X axis is',round(dxaxis,2),'km'
```

In [22]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.18w
# calculation of speed of raindrops with respect to road and the moving man
# given data
vmg=10.# velocity(in km/h) of the man with respect to the ground
theta=30.# angle(in degree) made by vrg with Y axis
# calculation
vrg=20.;#vmg/sind(theta);# from equation of relative velocity vrg=vrm+vmg...taking horizontal components
vrm=17.3;#vrg*cosd(theta);# from equation of relative velocity vrg=vrm+vmg...taking vertical components
print'the speed of raindrops with respect to the ground is',vrg,'km/h','\nand with respect to the man is',vrm,'km/h'
```

In [23]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 3.19w
# calculation of speed and direction of rain with respect to the road
# given data
vmanroad=8.# velocity(in km/h) of the man with respect to the road
# calculation
# from equation of relative velocity vrainroad = vrainman + vmanroad
# taking horizontal components vrainroad*sind(aplha)=8 1
# taking components along line OA vrainroad*sind(30+alpha)=12*cosd(30) 2
# from 1 and 2
alpha=49.1;#acotd(sqrt(3)/2);
vrainroad=10.6;#vmanroad/sind(alpha);# from equation 2
print'the speed of the rain with respect to the road is',vrainroad,'km/h','\nand makes angle of',alpha,'degree with Y axis'
```