In [1]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.4
# calculation of the maximum compression of the string
# given data
import math
m=1.# mass(in kg)
v=2.# speed of the block(in m/s)
k=50.# spring constant(in N/m)
# calculation
V=(m*v)/(m+m)# principle of conservation of linear momentum
ke1=(m*v*v/2.)# initial kinetic energy
ke2=(m*V*V/2.)+(m*V*V/2.)# final kinetic energy
x=math.sqrt(2.*(ke1-ke2)/k)# kinetic energy lost = elastic energy stored
print'the maximum compression of the string is',x,'m'
```

In [2]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.5
# calculation of the speed of combined mass
# given data
ma=50.# mass(in kg) of cart A
mb=20.# mass(in kg) of cart B
va=20.# velocity(in km/hr) of cart A
vb=10.# velocity(in km/hr) of cart B
# calculation
V=((ma*va)-(mb*vb))/(ma+mb)# principle of conservation of linear momentum
print'the speed of combined mass after collision is',round(V,2),'km/hr'
```

In [3]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.1w
# Locating the centre of maass of the system
# given data
m1=.50# mass(in kg) at point1
m2=1.# mass(in kg) at point2
m3=1.5# mass(in kg) at point3
x1=0# x coodinate (in cm) of point1
x2=4.# x coodinate (in cm) of point2
x3=0# x coodinate (in cm) of point3
y1=0# y coodinate (in cm) of point1
y2=0# y coodinate (in cm) of point2
y3=3.# y coodinate (in cm) of point3
# calculation
X=((m1*x1)+(m2*x2)+(m3*x3))/(m1+m2+m3)
Y=((m1*y1)+(m2*y2)+(m3*y3))/(m1+m2+m3)
print'The centre of mass is',round(X,2),'cm right and',Y,'cm left above the .5 kg paticle'
```

In [4]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.6w
# calculation of the acceleration of the centre of mass
# given data
M=2.5# mass(in kg) of the body
F1=6.# force(in N) acting at point 1
F2=5.# force(in N) acting at point 2
F3=6.# force(in N) acting at point 3
F4=4.# force(in N) acting at point 4
theta1=0# angle(in degree)
theta2=37.# angle(in degree)
theta3=53.# angle(in degree)
theta4=60.# angle(in degree)
# calculation
Fx=3.6;#(-F1*cosd(theta1))+(F2*cosd(theta2))+(F3*cosd(theta3))+(F4*cosd(theta4))# X component of resultant force
Fy=1.68;#(F1*sind(theta1))+(F2*sind(theta2))+(-F3*sind(theta3))+(F4*sind(theta4))# X component of resultant force
F=3.98;#sqrt((Fx*Fx)+(Fy*Fy))
theta=25.;#atand(Fy/Fx)
acm=1.59;#F/M# acceleration of centre of mass
print'the acceleration of the centre of mass is',acm,'m/s**2 and is in the direction of the resultant force'
```

In [5]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.8w
# calculation of the distance from launching point
# given data
u=100.# speed(in m/s) of the projectile
theta=37.# angle(in degree) of the projectile above horizontal
g=10.# gravitational acceleration(in m/s**2) of the earth
# calculation
xcm=961.;#(2.*u*u*sind(theta)*cosd(theta))/g# range of original projectile
# also xcm=((m1*x1)+(m2*x2))/(m1+m2)
# here m1=M/4 and m2=3*M/4
x1=xcm/2.# since small part falls from heighest point i.e half of range
x2=(4./3.)*((xcm*((1./4.)+(3./4.)))-(x1/4.))
print'the distance of landing of heavier piece from launching point is',round(x2,2),'m'
```

In [6]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.9w
# calculation of the distance moved by the bigger block
# given data
L=2.2# length(in m) of the base
n=10.# mass of bigger block is 'n' number of times the mass of smaller block
# calculation
# centre of mass at rest initially will remain in horizontal position thus
# M*(L-X)=10*M*X
X=L/(n+1.)
print'distance moved by the bigger block at the instant the smaller block reaches the ground is',X,'m'
```

In [7]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.10w
# calculation of the average force exerted by the hero on the machine gun
# given data
m=50.*10.**-3.# mass(in kg) of the bullet
v=1.*10.**3.# velocity(in m/s) of the bullet
n=20.# number of bullets fired
t=4.# time(in s) required in firing the bullets
# calculation
me=m*v# momentumof each bullet
f=me*n/t# force=rate of change of momentum
print'the average force exerted by the hero on the machine gun is',f,'N'
```

In [8]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.11w
# calculation of the fractional change in kinetic energy
# given data
vb=20.# speed(in m/s) of the block
v1=30.# velocity(in m/s) of one of the part
# calculation
M=1.# taking mass M=1 kg for solving the equation
v=(1./M)*((M*vb*2.)-(M*v1))# principle of conservation of linear momentum
deltake=(M*v1*v1/(2.*2.))+(M*v*v/(2.*2.))-(M*vb*vb/2.)# change in the kinetic energy
fdeltake=deltake/(M*vb*vb/2)# fractional change in the kinetic energy
print'the fractional change in the kinetic energy is',fdeltake
```

In [9]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.13w
# calculation of the final velocity of the shuttle
# given data
v1=4000.# speed(in km/hr) of shuttle with respect to the earth
v2=100.# speed(in km/hr) of the module with respect to the shuttle
# calculation
M=1.# taking mass M=1 kg for solving the equation
vdash=v1-v2# speed of module with respect to the earth
V=(1./5.)*((1.*v1*6.)-(vdash*1.))# principle of conservation of linear momentum
print'the final velocity of the shuttle is',V,'km/h'
```

In [10]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.14w
# calculation of the velocity with which the board recoils
# given data
m1=25.# mass(in kg) of the boy
m2=10.# mass(in kg) of the board
v1=5.# velocity(in m/s) of the boy
# calculation
v=(m1*v1)/m2# principle of conservation of linear momentum
vsep=v1+v# velocity of separation
print'the velocity with which the board recoils is',v,'m/s'
print'the velocity of separation of the boy and the board is',vsep,'m/s'
```

In [11]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.17w
# calculation of the speed of the bullet
# given data
import math
mb=50.*10.**-3.# mass(in kg) of the bullet
mp=450.*10.**-3.# mass(in kg) of the bob
h=1.8# height(in m) attained by the bob
g=10.# gravitational acceleration(in m/s**2) of the earth
# calculation
# using principle of conservation of linear momentum and equation of motion (v*v) = (u*u) + (2*a*x)
v=((mb+mp)*(math.sqrt(h*2.*g)))/mb
print'the speed of the bullet is',v,'m/s'
```

In [12]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 9.22w
# calculation of the loss of kinetic energy due to the collision
# given data
m=1.2# mass(in kg) of the block1
v=20.*10.**-2.# velocity(in m/s) of the approach
e=3./5.# value of coefficient of restitution
vdash=e*v# velocity (in m/s) of the separation
# calculation
# by principle of conservation of linear momentum ....v1 + v2 = v m/s.....(1)
# as the coefficient of restitution is 3/5............v2 - v1 = vdash m/s.....(2)
# from equation (1),we get.......v2=v-v1
# substituting v2 in equation (2),we get
v1=(v-vdash)/2.
v2=v-v1# from equation (1)
lke=(m/2.)*((v*v)-(v1*v1)-(v2*v2))
print'the loss of kinetic energy during the collision is',lke,'J'
```