1. Introduction
Just What Is Computation and Why Do Ecologists Need It?
Computation refers to the act of mathematical calculation and is important because it helps us to build, test, or implement theory. In the sciences, we leverage computers to do many calculations in a short period of time to solve hard problems. Recent advances in computing power and computer architecture are opening new opportunities for discovery in ecology using simulation based approaches, where just 5 or 10 years ago, your desktop computer would likely die of old age before solving the problem. Computation in ecology can be used to model individual based population dynamics, predict species ranges using biophysical calculations, predict the movement tracks of dispersing individuals, and the list goes on.

What Is Python?
Python is a scripting language that can be used for many purposes, including scientific computation. I won’t bore you with too many wonky details that you can read in any CS text, webpage, or list serve regarding the language, though these details will become more and more apparent as you proceed through this book. Python is an interpreted language, which simply means that once you type something, Python does it. There is no need to compile the code. The advantage of an interpreted language is that you can start doing things now. On the other hand, compiled languages are faster, but often require more debugging to get things running. If you will only complete a task once, or a few times, interpreted languages have much to offer. That said, later in the book, I will provide some examples where we can incorporate compiled code (or use packages like cython that turn Python into compiled C code) to speed up our programs. Also Python can handle procedural programming (what most folks are familiar with if they have any programming experience at all) as well as object oriented code (everything in Python is an object!). But again, did I say quick implementation? Who wants results now? If this is you, keep reading!

Why Not Other Languages?
Indeed, why not?! For me, Python feels natural, is fairly simple to read, is object oriented, and is freely available. Other languages fit these descriptors to various degrees. R is one such language that many people in ecology use. While it is a great language for statistical analysis, I don’t particularly care for the syntax (functions are just ugly) and though it can be coaxed to do object oriented computation, again, it’s ugly at best. But if R is your sort of thing, then by all means go for it. This book still might be helpful in terms of how to approach certain types of problems, but it won’t be of much use in generating code in R. Though as a side effect of Python, we can (and will) access functions from R to make our lives more simple.

Standing on the Shoulders of Giants
One of the great advantages of Python is that many libraries have already been written by experts to solve hard problems. So there is no need to start from scratch. A few of the libraries that we will use are:

As you will see, having these resources at hand will make your life much, much easier. You might even begin to wonder why you were paying for software to do certain ‘easy’ tasks.