Logistic growth, Constant Harvesting

Exp growth, Amount of fish

from xxx import *

harvest_rates = [2e4, 5e4, 1e5, 2e5]

data = []

def logistic_growth():
	maximum_growth_rate = 0.5
	carrying_capacity = 2e6

	end_time = 10.
	h = 0.1
	num_steps = in(end_time / h)
	times = h * numpy.array(range(num_steps + 1))

	fish = numpy.zeros(num_steps + 1)
	fish[0] = 2e5

	for harvest_rate in harvest_rates:

		data.append(([time for time in times], [f for f in fish],
			str(harvest_rate)))

	return fish

fish = logistic_growth()

@show_plot
def plot_me():
    fish_plots = []
    for (times, fish, rate_label) in data:
        fish_plots.append(matplotlib.pyplot.plot(times, fish, label=rate_label))    
    matplotlib.pyplot.legend([str(rate) for rate in harvest_rates], loc='upper right')
    axes = matplotlib.pyplot.gca()
    axes.set_xlabel('Time in years')
    axes.set_ylabel('Amount of fish in tons')

plot_me()