Python in Chemistry

Learning Python and Exploring Chemical Concepts using Jupyter Notebooks

Functions

This notebook will introduce the concept of **functions** in terms of the Python programming language. I will endevour to use examples of *chemistry* related problems, but occasionally examples from physics or mathematics will come through.

Like many other programming languages Python lets you utilise functions -- is to have you have to write less code.

The concept of a function should be familiar from mathematics, e.g.

\(f(x)\)

where, \(f(x)\) is some mathematical operation that acts on the argument, \(x\). An example of a function is,

\(f(x) = x^2.\)

Using this we can say that \(f(2) = 4\), \(f(3) = 9\), etc.

The use of functions is an important paradigm in programming -- the following Jupyter notebook gives a quick introduction to functions  and how they can be used.

Launch this notebook using Binder

Download this notebook.