# ROOT Histograms in Python

ROOT is a data analysis framework developed by CERN that is well-suited for the analysis of certain large scientific data sets such as particle collision events and astronomical data. One useful ROOT feature are the histograms. A simple program that histograms 100,000 Gaussian random numbers is shown here: It’s output is shown here: A second […]

Read the rest of this entry »
Posted in Python | Tagged as: ,

# ROOT’s TLorentzVector Class in Python

ROOT is a data analysis framework developed by CERN that is well-suited for the analysis of certain large scientific data sets such as particle collision events and astronomical data. One useful part of ROOT is their TLorentzVector class—objects that store and can work with relativistic four-vectors such as the space-time 4-vector or the energy-momentum 4-vector. […]

Read the rest of this entry »
Posted in Python | Tagged as: ,

# Barnsley Fern in Python

The Barnsley Fern is a beautiful fractal that can easily be generated in Python. If we zoom in on one branch, we see that the pattern is repeated: The python code follows.

Read the rest of this entry »
Posted in Python

# Prime Number Sieve in Python

This program computes all the prime numbers up to 10,000 using an efficient algorithm. Instead of checking if a number n is prime by dividing by all previous numbers, or even all previous primes, this program only divides by all previous primes less than or equal to the square root of n.

Read the rest of this entry »
Posted in Python

# Newton’s Cradle in Visual Python

This simple program shows an animation of a two-pendulum version of Newton’s cradle. One pendulum begins at some starting angle and the other pendulum is stationary. When the moving pendulum slams into the stationary one, its momentum is transferred to the other pendulum. If you want to include damping, you can change the line to […]

Read the rest of this entry »
Posted in Python

# Cannonball in Visual Python

Just a very basic example of projectile motion in Visual Python. The cannon fires when the mouse is clicked in the window.

Read the rest of this entry »
Posted in Python

# Simple Pendulum in Visual Python

Below is the code for a simple pendulum in visual python.

Read the rest of this entry »
Posted in Python

# Animated GIFs from Visual Python in Windows

One option for creating animated GIFs from your visual python program is add the pillow package that allows you to export images of your vpython window from within your program. You can then use GIMP to create an animation such as the one shown here. To use python’s image library, you can install the “pillow” […]

Read the rest of this entry »
Posted in Python

# Fancy Simple Pendulum in Visual Python

Here is the visual python code for a “fancy” pendulum exhibiting simple harmonic motion. Clicking anywhere in the window will reset the pendulum to that angle.

Read the rest of this entry »
Posted in Python

# My Class Notes

I am currently a student at Florida State University majoring in physics as well as applied and computational mathematics. I have posted most of my class notes at http://www.leonhostetler.com/classnotes/. If you are looking for math and science class notes, be sure to take a look at them.

Read the rest of this entry »
Posted in Uncategorized
Follow

### Follow Leon Hostetler.com

Get every new post on this blog delivered to your Inbox.

Join other followers: