Probability and Programming
Introduction
In almost all modern applications of probability and statistics, software is used to ease and speed up the work. Hand-made calculations are often erroneous, since everything is written by error-prone humans. However by putting the equations into software, the errors decrease significantly, and the whole process speeds up enormously. Simple put, to work with probability in this time and age, knowledge of programming is crucial.
It is good to learn and explore probability with hand-written calculations to provide understanding, however to be efficient when working with it, software is necessary.
Programming languages
There are a lot of different programming languages, and all of them have their pros and cons. Low level programming languages gives the programmer more control over the memory and performance, and is often used in embedded systems where the processor is often low-performance. However for general purpose computers (PC’s), high-level languages such as Java, C++, C#, Python and other languages are often use. These give the programmer the opportunity to be much more time-efficient when writing code, to produce much more in a given time.
For probability and statistics, there are several suitable languages available.
Matlab
Matlab is used a lot in universities and research, and in some extend in industry as well. Matlab has a rather “human-readable” syntax, and it is easy to produce a lot of features relatively fast, since there are a lot of built-in functions and libraries. Just as an example, to create a matrix and do matrix manipulations (transposes, inverses, find eigenvalues etc) is extremely easy in Matlab, and only requires a few lines of code. However in other programming languages, this could possibly require a lot of work. The downside with Matlab is that it requires a licence, however universities usually provide their students with an academic version for free.
To view a Matlab tutorial about how to generate and manipulate random variables, view the Matlab tutorial
Python
Python is a very diverse and well used programming language both within university and at companies. There exists several libraries which extends python with a lot of functionality related to mathematics and statistics. SciPy is one of these. One good thing with Python, is that it is easy to use code written for websites, hence you could write a lot of functionality, and then rather simply, move this to your own website. This is something which would be harder to achieve with Matlab. Python is free and readily available online.
Python’s official website provide a Python tutorial:
https://docs.python.org/3/tutorial/
Link to SciPy’s official website:
R (programming language)
R is a programming language and software environment. It is used for computing problems involving statistics and probability. One great thing about R is that it is open source, that means that the source code is open to anyone to view and modify. The downside with R is that it primarily focused on just doing statistics and probability, it does not offer the same wide array of other possibilities as a general purpose programming language such as Python.