In [1]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.1
# calculation of the work done by the spring force
# given data
k=50.# spring constant(in N/m) of the spring
x=1.*10.**-2.# compression(in m) from natural position
# calculation
W=(k*x*x)/2.# work done in compressing a spring
print'the work done by the spring force is',W,'J'
```

In [2]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.2
# calculation of the work done by force of gravity
# given data
m=20.*10.**-3.# mass(in kg) of the particle
u=10.# speed(in m/s) of the particle
g=9.8# gravitational acceleration(in m/s**2) of the earth
# calculation
# from equation of motion.....(v*v)=(u*u)-(2*g*h)......take v=0 we get
h=(u*u)/(2.*g)
W=-m*g*h# law of conservation of energy
print'the work done by force by gravity is',W,'J'
```

In [3]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.5
# calculation of the speed of the pendulum of bob when it makes an angle of 60 degree with the vertical
# given data
v0=3.# speed(in m/s)of the bob in its lowest position
theta=60.# angle(in degree)made by the pendulum with vertical
l=.5# length(in m) of the pendulum
g=10.# gravitational acceleration(in m/s**2) of the earth
# calculation
# from the law of conservation of energy
# (m*v0*v0/2) - (m*v1*v1/2) = m*g*l*(1-cosd(theta))
v1=2.;#sqrt((v0*v0)-(2*g*l*(1-cosd(theta))))
print'the speed of the pendulum of bob when it makes an angle of 60 degree with the vertical is',v1,'m/s'
```

In [4]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.1w
# calculation of the work done by the porter on the suitcase
# given data
m=20.# mass(in kg) of suitcase
h=2.# height(in m) above the platform
g=9.8# gravitational acceleration(in m/s**2) of the earth
# calculation
W=-m*g*h# work done by gravity
# the work done by the porter = negative of the work done by gravity
print'the work done by the porter on the suitcase is',-W,'J'
```

In [5]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.2w
# calculation of the value of minimum horsepower of the motor to be used
# given data
m=500.# mass(in kg) of the elevator
v=.20# velocity(in m/s) of the elevator
g=9.8# gravitational acceleration(in m/s**2) of the earth
# calculation
P=m*g*v# power = force*velocity
print'the value of minimum horsepower of the motor to be used is',P/746,'hp'
```

In [6]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.3w
# calculation of the power delivered by the pulling force and average power
# given data
m=2.# mass(in kg)
theta=30.# angle(in degree)
a=1.# acceleration(in m/s**2) of the block
t=4.# time(in s)
g=9.8# gravitational acceleration(in m/s**2) of the earth
# calculation
F=11.8;#(m*g*sind(theta))+(m*a)# resolving the forces parallel to the incline
v=a*t
P=F*v# equation of power
d=a*t*t/2# from equation of motion
W=F*d
pavg=W/t# average power delivered
print'the power delivered by the pulling force at t=4 s is',P,'W'
print'the average power delivered by the pulling force between t=0 s to t=4 s is',pavg,'W'
```

In [7]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.4w
# calculation of the work done by the given force
# given data
#function F=f(x)
# F=(10+(.50*x))
#endfunction
x1=0# initial position(in m) of the particle
x2=2# final position(in m) of the particle
# calculation
W=21.;#integrate('f','x',x1,x2)# work done
print'the work done by the given force for the given displacement is',W,'J'
```

In [8]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.11w
# calculation of the speed of the particle at a given point
import math
# given data
hA=1.# height(in m) of point A
hB=.5# height(in m) of point B
g=10.# gravitational acceleration(in m/s**2) of the earth
# calculation
# potential energies at point A and B are
# UA = M*g*hA
# UB = M*g*hB..............(1)
# principle of conservation of energy
# UA + KA = UB + KB........(2)
vB=math.sqrt(2.*g*(hA-hB))
print'the speed of the particle at a B point is',vB,'m/s'
```

In [9]:

```
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 8.12w
# calculation of the maximum compression of the spring
import math
# given data
k=400.# spring constant(in N/m)
m=40.*10.**-3.# mass(in kg)
h=4.9# height(in m)
g=9.8# gravitational acceleration(in m/s**2) of the earth
# calculation
# m*g*h = (k*x*x/2)
x=math.sqrt((2.*m*g*h)/k)
print'the maximum compression of the spring is',x,'m or',x*10.**2.,'cm'
```