Computational Methods for Ecology:

A Primer Using Python

Michael W. Sears
Clemson University


Overview of the eBook
In this ebook, I will take the approach of teaching elements of computation and programming through a series of ecological case studies. We will progress from simple continuous models of populations to models that predict distributions of organisms through explicit time and space by gradually relaxing assumptions of our more simple models. During this progression, we will learn many powerful programming techniques that will provide the tools needed to solve various types of calculations commonly (and not so commonly) used by ecologists. Below is an outline for the book.

  1. Introduction
  2. A brief philosophy on the necessity of models in ecology
  3. The bare minimum Python to get started
    • 3.1 Python through the interpreter and at the terminal
    • 3.1.1 Python as a calculator
    • 3.2 Operators
    • 3.3 Data types
      • 3.3.1 Numerical types
      • 3.3.2 Sequence type
      • 3.3.2.1 Strings
      • 3.3.2.2 Lists
        • 3.3.2.2.1 indexing and slicing
        • 3.3.2.2.2 sorting
        • 3.3.2.2.3 popping
        • 3.3.2.2.4 appending
    • 3.4 Standard I/O
    • 3.5 Using libraries
    • 3.6 Control statements
      • 3.6.1 if/elif/else
      • 3.6.2 for loops
      • 3.6.3 while loops
    • 3.7 Functions
    • 3.8 File I/O
    • 3.9 Summary
  4. Putting it all together: Statistics
    • 4.1 Your first real program
    • 4.2 Case study 1: Basic descriptive statistics
    • 4.3 the random library
    • 4.4 Case study 2: Bootstrapping and Jack-knifing
  5. Exponential population growth
  6. Density-dependent population growth
    • Case study 5: Population Growth and Chaos
  7. Structured population growth
    • Age-structured populations
    • A brief overview of numpy and scipy
    • Case study 6: Projecting populations with the Leslie matrix
    • Case study 7: Solving the Euler equation
      • Iterative solutions: Root finding using the bisection method
      • Solutions using linear algebra
    • Case study 8: Feasible demography in turtles ipython notebook
  8. Multiple populations
    • Lotka-Volterra competition
    • Solving systems of ODEs
    • Predation
      • Case study 9: Lynx-hare cycles
    • Disease using SIR models ipython notebook
    • Case study 10: Immunization and disease
  9. Populations in explicit space, explicit time
    • Automata
      • Case study 11: Sources and Sinks
      • Case study 12: Habitat destruction
      • Case study 13: Disease
      • Case study 14: Predation
    • Individual-based approaches
      • Python classes
      • A review of trigonometry
      • Case study 15: Animal dispersal
      • Case study 16: Behavioral thermoregulation
      • Case study 17: A ‘simple’ individual-based population model
  10. Advanced topics: Optimization
    • Artificial Neural Networks
      • Case study 18:
    • Evolutionary Computation
      • Case study 19:
  11. Advanced topics: Interacting with R using rpy
    • Case study 20: Fitting nonlinear data
  12. Advanced topics: The need for Speed
    • Basic code optimization
    • Cython
    • Bringing in compiled code
    • PyPy