Study of Classical Mechanics is a very important and elaborate part of physics curricula since
school level. Simply by applying Newton’s laws, we arrive at various scenarios. We can
enumerate the path of a particle when the nature of the force is known. The path of a projectile
under the constant force of gravity acting downwards, the orbit of a planet under the central
force of inverse square law nature are all know to us. The mathematical calculations are not
difficult and the students can find them in any text book of mechanics or basic physics. It will
be, however, interesting to obtain the trajectories by directly invoking the law of force and
initial conditions. Here I would like to present the FORTRAN programs for two problems
(projectile motion and nature of orbit of a particle under central force) with algorithmic steps
followed by the figures obtained from the numerical data. Hope, this will be a good
demonstration for graduate or advanced level school students who can write the programs on
their personal desktops and play around with them!
2
Projectile Motion
Algorithm:
Components of forces:
Components of initial velocity: ,
Change in velocity components: ,
New velocity components: ,
Change in position coordinates: ,
New position coordinates: ,
FORTRAN Program:
C Projectile Motion of a partile
C
open(1,file='proj.dat')
write(*,*)'Angle (in deg) and initial speed?'
read(*,*)theta,v0
dt=0.00001
g=980
theta=3.14/180*theta
fx=0
fy=-g
vx=v0*cos(theta)
vy=v0*sin(theta)
x=0
y=0
10 dvx=fx*dt
dvy=fy*dt
vx=vx+dvx
vy=vy+dvy
dx=vx*dt
dy=vy*dt
x=x+dx
y=y+dy
write(1,*)x,y
if(y.gt.0.0)go to 10
stop
end
3
Algorithm:
Components of Force: ,
√
Change in velocity components: ,
New velocity components: ,
New position coordinates: ,
FORTRAN Program:
Harmonic Oscillator
Algorithm:
FORTRAN Program:
C Harmonic Oscillator
C
open(1,file='harmonic.dat')
x=0.0
t=0
v=1.0
dt=0.000001
k=500000000
ncount=0
10 dv=-k*x*dt
v=v+dv
dx=v*dt
x=x+dx
t=t+dt
write(1,*)t,x
ncount=ncount+1
if(ncount.lt.1000)go to 10
stop
end
7