from pylab import *
# CS 190C Lab 4 example
# plot function f(p) = 1-(1-p^n)**n for selected values
# of n and values of p between 0 and 1
# using Matplotlib and showing plots for differentn in one window
# written by Sagar Mittal, 1/31/08
def plot_vertical_percolation(i):
p = arange(0, 1, .01)
fp = 1-(1-p**i)**i
plot (p, fp)
xlabel("Probability of being unblocked")
ylabel("Probability q of vertical percolation")
ti = title("Plotting vertical percolation probabilities")
if __name__ == "__main__":
n = 50
legends = []
for i in range (10,n+1,10):
legends.append("N = %i" % i)
plot_vertical_percolation(i)
legend(legends)
show()