#Illustrating the plotting library with some simulations
#involving coin-tossing.
#This code uses the pylab plotting functions together with some of the
#array manipulation tools that come along with matplotlib. You could achieve the
#same result in standard Python using lists, with matplotlib used only for the
#plotting tools.
#Caution: Some people object to importing the
#pylab package in this way. The advantage is that
#you do not have to write the library name every time
#you invoke a function, but you can sometimes run into
#the problem of colliding namespaces. It is probably
#more prudent to type 'import pylab' and invoke each
#function with the 'pylab.' prepended.
from pylab import *
#Simulated coin tosses: return a Python list of booleans, representing the
#result of n tosses of a coin with heads probability p.
#There is a fancier way do do this, using the array manipulation capabilities
#of numpy---simply return (rand(n)