Python: An Introduction to Scientific Programming

I am learning the basics of Python and am putting notes together, these are still incomplete:


In these set of guides we will use the open-source Anaconda which is a Python distribution compiled for data scientists. It has the Spyder graphical user interface inbuilt as well as the numerical numpy, the fundamental package for scientific computing and matplotlib which is required for plotting.

Python Basics: 0 Order Indexing

Python uses 0 order indexing. When starting with Python (particularly if one is used to MATLAB). we need to spend a moment relearn how to count to get used to zero order indexing.

Python Basics Datatypes, Basic Maths and Basic Variables

In this guide we look at some of the fundamentals of core python such as datatypes. These are numerical – integers (whole numbers) and floats (numbers with a decimal point), strings (text input) and Boolean (logical – true or false). We also look at the assignment of variables and the use of elementary mathematics between scalars. Some basic functions are also introduced.

Scalars, Vectors and Matrices

In this guide we look further at some of the fundamentals of core python and examine numerical data in the form of a list. This list can be a scalar, vector, matrix, book or more complicated multi-dimensional array. We discuss some of the basics behind indexing and examining the dimensions of an array.

The IPython Console, the Variable Explorer and Python Scripts with Basic Custom Functions

A look into Spyder…

Numerical Python: NumPy (Basics)

This section looks at using the Numerical Python NumPy to create vectors and matrices of data. It looks at indexing of rows or columns from such data, which is of course a perquisite when it comes to plotting.

Numerical Python: Mathematical Operations

addition, subtraction,


mean, mode, min, max, std, var, covariance

Introduction to Pandas



2D Line Plot

2D Scatter Plot

Pie Chart

Exponential Function

This is a basic example to create a vector, for use in a mathematical formula to find the value of the exponential. Indexing of a row and column are also practiced:




Use interpolation of a point to practice array operations (division). Then use it to plot the original data as a scatter plot and the interpolated data as a line. Use linear, quadratic and cubic interpolation.

Differentiation and Integration


Use geometric shapes, right angle triangles on a circle to show the sin, cos and tan waveforms.

Polar Plots

For Loop

The Magic Square revisited. Use a for loop and the sum function.

The Exponential function revisited.