elastic collision with c++
Post on 28-Oct-2014
179 Views
Preview:
TRANSCRIPT
Submitted to:
Sir zohaib
Prepared by:
Qudsia tariq
Reg no:
UW-08-PHY-Msc-013
Discipline:
M.Sc physics (3rd semester)
“Department of
Phsics”
“Contents”
Abstract
Collision
Inelastic collision
Elastic collision
Inelastic collision in one dimension
Implementation of inelastic collision in c++
C++ program
conclusion
Abstract:
The purpose of this project is the “implementation of inelastic collision” including
four cases in object oriented programming language i-e c++. For this purpose firstly I
have explained the inelastic collision in detail. I have also derived the formulas for
velocities after collision (final velocities) of two bodies. For this purpose all four cases
are discussed briefly. Advantage of this implementation is to make calculations easy
using computers.
Collision:
A collision is an isolated event in which two or more moving bodies (colliding
bodies) exert relatively strong forces on each other for a relatively short time.
Term collision is used to represent an event during which 2 particles come close to each
other and interact by means of forces. Time interval during which the velocities of the
particles change from initial to final values is assumed to be short. The interaction forces
are assumed to be much greater than any external forces present.
For example when two particles of masses m1 and m2 collide, the impulsive forces may
vary in time in complicated ways.
The two particles form an isolated system, and the momentum must be conserved that is:
“The total momentum of an isolated system just before a collision equals to the
momentum of the system just after the collision”.
&
“The total kinetic energy of the system, may or may not be conserved, depending on
the type of the collision”.
Collisions involve forces (there is a change in velocity). Collisions can be elastic,
meaning they conserve energy and momentum, inelastic, meaning they conserve
momentum but not energy, or totally inelastic (or plastic), meaning they conserve
momentum and the two objects stick together.
Inelastic collision:
“An inelastic collision is a collision in which kinetic energy is not conserved”.
In most collision in the real world, the kinetic energy of the system is not conserved
because some of the energy is converted to internal energy and some of it transferred
away by means of sound.
“Total kinetic energy of the system before the collision is not the same as after the
collision”.
The kinetic energy is not completely lost, but is converted into other forms of energy
according to the principle of conversion of energy.
However,” The momentum of the collision is still conserved”. The total momentum of
the involved bodies is conserved, regardless whether the collision is elastic or inelastic.
When two objects stick together after collision, the collision is said to be perfectly
inelastic. All collisions between real objects are more or less inelastic.
Elastic collision:
“An elastic collision is a collision in which the total kinetic energy of the
colliding bodies after collision is equal to their total kinetic energy before collision”.
Elastic Collision is the collision in which colliding objects rebound without lasting
deformation or heat generation.
Law of conservation of momentum also holds for elastic collision:
“Total linear momentum before collision is equal to the total linear momentum after
collision”.
Elastic collisions occur only if there is no net conversion of kinetic energy into other
forms. During the collision kinetic energy is first converted to potential energy associated
with a repulsive force between the particles, then this potential energy is converted back
to kinetic energy The collisions of atoms are elastic.
In elastic collision for one dimension :
Let us consider two rigid non rotating spheres moving on a smooth
horizontal surface along the same straight line joining their centers. Let m1, m2
be there masses and u1, u2 be their velocities before collision (initial velocities).
Now let the two bodies suffer head-on collision and v1, v2 be their velocities after
collision (final velocities). The colliding bodies, exerts impulsive forces on each
other during the collision along the initial line of motion so that the final motion is
along the same line.
For the collision to occur, the initial velocity u1 of sphere m1 should be greater
than the initial velocity u2 of sphere of mass m2 so that the sphere of mass m1
overtakes the sphere of mass m2 and collide with it. We assume the positive
direction of the momentum and velocity directed to the right.
From the conservation of momentum,
Total linear momentum after collision = total linear momentum before
collision
Since we are dealing with elastic collision, the kinetic energy is also coserved
and we get,
Total kinetic energy after collision = total kinetic energy before collision
Derivation:
Using the kinetic energy we can write
Rearrange momentum equation:
Dividing kinetic energy equation by the momentum equation we
get:
That is, the relative velocity of approach before collision is equal and opposite to the
relative velocity of recession (separation).
From above two equations we get:
These are the final velocities after collision, Where m1, m2 are the masses of two
colliding bodies.v1,v2 are the velocities of bodies after collision and u1,u2 are the
velocities of bodies before collision.
Now we discuss the following cases:
Case 1:
When colliding particles are of the same mass (m1=m2), the objects
exchange velocities after collision:
v1=u2 and v2 = u1
Case 2:
When the target partical of mass m2 is at rest, that is:
u2=0,
we get:
v1= (m1-m2/m1+m2) u1
v2= (2m1/m1+m2) u1.
Moreover if the colliding particles are of equal masses i-e, m1=m2=m(say), we
get:
V1=0 and v2=u1.
The incident particle stopped & the target particle takes off with the initial velocity
of incident particle.
Case 3:
When lighter incident particle collide with heavier target particle which is at rest
that is, m1<<m2 and u2=0
then,
v1= -u1 and v2=0.
The lighter incident particle bounces back with same velocity while the massive
particle remain at rest.
Case 4:
When massive projectile collides with a lighter target at rest that is,
If m1>>m2, u2=0
We get:
V1=u1 and v2=2u1
After collision, the heavy object continues its motion with the same velocity. The
light object moves off with a velocity which is twice the initial velocity of the heavy
object.
“Implementation of Inelastic collision in c++”:
the aim is to calculate the velocities after collision (final velocities) which are v1 &
v2.we have the following formulas which are derived using law of conservation of
momentum and kinetic energy:
Where,
m1 = mass of first spherical body.
m2 = mass of second spherical body.
u1 = velocity of m1 before collision.
u2 = velocity of m2 before collision.
v1 = velocity of m1 after collision.
v2 = velocity of m2 after collision.
C++ Program:
#include<iostream.h>
#include<conio.h>
main( )
{
int m1,m2;
float v1, v2, u1, u2;
char inelastic;
clrscr( );
v1=(m1-m2/m1+m2)u1+(2m2/m1+m2)u2;
v2=(2m1/m1+m2)u1+(m1-m2/m1+m2)u2;
cout<<”select one case according to your choice.”<<endl;
cout<<”1:when both masses are equal.”<<m1= =m2<<endl;
cout<<”2:target particle is at rest.”<<u2= =0<<endl;
cout<<”3:massive target at rest.”<<(m1<<m2)<<u= =0<<endl;
cout<<”4:massive projectile.”<<(m1>>m2)<<u2= =0<<endl;
cin>>enter required case;
switch(inelstic)
{
case ‘1’:
m1= =m2;
cout<<”enter the value of m1 & m2.”<<endl;
cin>>m1>>m2;
cout<<”enter the value of initial velocity of mass m1.”<<endl;
cin>>u1;
cout<<”enter the value of initial velocity of mass m2.”<<endl;
cin>>u2;
v1=u2;
v2=u1;
cout<<”final velocity of body having mass m1=”<<v1<<endl;
cout<<”final velocity of body having mass m2=”<<v2<<endl;
break;
case ‘2’:
v2= =0;
cout<<”enter the value of masses m1 & m2.”<<endl;
cin>>m1>>m2;
cout<<”enter the value of initial velocity of mass m1.”<<endl;
cin>>u1;
if(m1=m2)
{
v1=0;
v2=u1;
cout<<”final velocity of body having mass m1=”<<v1<<endl;
cout<<”final velocity of body having mass m2=”<<v2<<endl;
}
else
{
v1=(m1-m2/m1+m2)u1;
v2=(2m1/m1+m2)u1;
cout<<”final velocity of body having mass m1=”<<v1<<endl;
cout<<”final velocity of body having mass m2=”<<v2<<endl;
}
break;
case’3’:
m1<<m2,u2= =0;
cout<<”enter the value of masses m1 & m2.”<<endl;
cin>>m1>>m2;
cout<<”enter the value of initial velocity of mass m1.”<<endl;
cin>>u1;
v1=-u1;
v2=0;
cout<<”final velocity of body having mass m1=”<<v1<<endl;
cout<<”final velocity of body having mass m2=”<<v2<<endl;
break;
case’4’:
m1>>m2,u2= =0;
cout<<”enter the value of masses m1 & m2.”<<endl;
cin>>m1>>m2;
cout<<”enter the value of initial velocity of mass m1.”<<endl;
cin>>u1;
v1=u1;
v2=2u1;
cout<<”final velocity of body having mass m1=”<<v1<<endl;
cout<<”final velocity of body having mass m2=”<<v2<<endl;
break;
default:
cout<<”invalid input”
break;
}
getch( );
}
Conclusion:
From above whole procedure it is concluded that using Object-oriented
programming language i-e c++ is a completely different approach to
programming than the more traditional procedural approach: it is particularly well
suited to large projects involving many people. By this whole procedure we come
to know that how computers can enable us to both broaden and deepen our
understanding of physics by vastly increasing the range of mathematical
calculations which we can conveniently perform. We can simplify our larger
calculations using c++ tool.
top related