Home > Uncategorized > Introduction to collisions

Introduction to collisions

Here is the code that I showed in class: https://gist.github.com/rhettallain/10657928.  Download it and run it on your own computer.  Let me just point out a few important things.



This is just the set up.  Load the visual module and the graphing module.  The last three lines here set up three different functions to plot.



Here I just make two cars and then set up some constants.  In particular, you want to look at k.  This is the force constant. You will see this below, but I have a repulsive force between the two cars that has the following magnitude:


The value of k tells how strong this force can be.  You might want to try changing this to see what happens.

car_collisions_py_-__Users_rjallain_Dropbox_phys221_python_car_collisions_pyThis last part uses the momentum principle to model the motion of both carts.  The last three lines make a plot of momentum (x-component) for each cart and the total.

Things to try:

  • Is momentum conserved?  How do you know?
  • What happens if you make dt smaller or bigger?  Is momentum still conserved?
  • What happens if you change the interacting force to some other function?
  • Is kinetic energy conserved?  Can you make a plot of KE vs. time?
  • What if you change the masses of one or both carts?
  • What if both carts are initially moving?
  • How would you change this code to make a 2-d (or 3-d) collision?  Would momentum still be conserved?
  • Can you think of some way to make an interacting force so that the kinetic energy is not conserved in the collision?
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: