hi in this video we'll explore elastic
collisions using a JavaScript graphic
simulation in physics a collision occurs
when two objects hit into one another
when a collision occurs both momentum
and kinetic energy are conserved when
used together these mathematical
equations can help us determine unknown
values in the scenario such as the
masses of the objects or how fast the
objects will be moving after the
collision for example if a car accident
occurred and we knew the masses of both
cars and their initial speeds before
they collided we can calculate the final
speeds of each car using these equations
plugging in the mass and initial speed
values for each car we would calculate
that the final speed of car 1 would be
50 1.8 km/h to the left and the final
speed of car 2 would be 38 kilometers
per hour to the right but calculating
these values by hand is tedious and
time-consuming so scientists program
computers to do these calculations for
them in this activity we'll be using an
elastic collision simulation which will
calculate final speeds and simulate a
collision between two objects where
their masses and initial speeds can be
altered if we explore the code
controlling the simulation we will see
that there are two calculations being
performed to calculate the final speed
of object one and object two there are a
few things we want to note about these
calculations you'll notice in our
program that there is no mass variable
this is because we are using the size of
the circle to represent the mass of the
object so when you see radius one equals
50 this means that the mass value is
also 50 it is also important to note
that objects moving right have positive
speeds while objects moving left have
negative speeds now let's take a look at
how we can alter values in our
simulation inside our code editor you'll
see our program written out on the left
side and when we click the run code
button the simulation will begin once
the objects collide their final speed
values will be printed below the console
you can stop your simulation by hitting
the stop button all of the variables we
can change inside our program are listed
at the top right here we can alter the
mass value being used by plugging in a
different number for the radius of each
object so if I want my red object to be
smaller and my blue object to be larger
I could change these values and I just
have to click run code to see how the
simulation is altered I could also
change the initial speed of each object
here but make sure you remember that
negative values mean the object is
moving left I can also change the color
of each object by typing a different
color name here just make sure to write
the name after the period and use all
lowercase letters click run code to see
how it's changed now it's your turn
throughout this activity you'll be
checking the accuracy of the final speed
values by comparing your own calculated
value with that of the simulation let's
get going