A guide using simple Python code.

In my previous story (https://oscarnieves100.medium.com/simulating-correlated-random-variables-in-python-c3947f2dbb10) I discussed how to simulate correlated random numbers from a normal probability distribution. We focused on a normal distribution because it is well known, and standard methods of sampling exist.

But what if you wanted to create your own probability distribution? What if I told you that you don’t need to be constrained by any of the well-known probability distributions out there? Where there is a will, there is a way, and what I am about to show you is very simple yet very powerful.

First, let us establish…

In my previous Medium story (https://oscarnieves100.medium.com/simulating-normal-random-numbers-in-python-18a2a21a1329) I discussed how to simulate normal random numbers with specific mean and variance properties by using something called the Box-Muller method. The idea was to take a set of independently sampled uniform random numbers, and convert them into normal random numbers by using a transformation involving polar coordinates, giving us two uncorrelated normal variables X and Y.

This is all good and fun, however when sampling numbers like this in a computer program, we always get “uncorrelated” variables. Correlation is a measure of how well a variable Y is described by a variable X…

Using the Box-Muller method

In my previous Medium story: https://oscarnieves100.medium.com/how-to-simulate-random-numbers-dad35905ecdb I discussed how to simulate random numbers in Python by using a little mathematical method known as “the inverse sampling theorem”. In it, I demonstrated how using nothing but uniformly distributed random numbers in the interval [0, 1] we could produce a set of random numbers from an exponential distribution, as shown in the Figure below:

A gentle introduction

Random numbers are used in a lot of applications. They are more predominantly used in areas like statistics, probability theory, data science, signal processing, statistical physics, machine learning, actuarial science, quantitative finance, and more. Yet they can be a bit challenging to understand due to their… well, random nature.

First, we need to come clean about something. Random numbers generated in computers are not truly random, in fact they are referred to as “pseudo-random” numbers. The reason for this is that they are basically constructed from a huge number of digit sequences which are then converted into…

Students of science and engineering often only learn a bit of Excel in the context of doing simple data analysis, plotting and calculations involving single cells or scalar values (e.g. basic statistics). However, there are many ways in which Excel can be used for a lot of other calculations, including things like linear algebra, regression analysis, probability computations, and even numerical solutions to differential equations. We can do a lot of these things without even knowing a thing about VBA programming.

In this short tutorial, I will go over some important functions in Excel which can be used for performing…

And understand it properly.

Statistics is a huge field of study. Most people only come across some statistics in school, and perhaps at university. Unless you have done a dedicated degree in data science, mathematics/statistics, quantitative finance or actuarial science; chances are you probably know very little. In fact, so little that you don’t know how to make use of the knowledge you have, which kind of defeats the purpose of knowing any statistics at all.

But it’s not people’s fault. I mean, I have qualifications in physics and even then my knowledge of statistics is extremely limited. I have…

Gaussian integrals occur quite often in science, statistics, and probability theory. In fact, if you have ever come across the normal distribution in statistics — also known as the “Bell curve” — you probably know what a Gaussian function is, or at least what it looks like.

A Gaussian integral is essentially the area under the Gaussian function, between set limits along the horizontal axis. …

And how far to go with it.

Physics is a difficult thing to study. Not just because it requires a lot of mathematics, but also because it requires a lot of patience, dedication and time. Most people only learn physics in high school, and never touch on the subject again, perhaps they don’t need it, or they go into a profession which doesn’t require any knowledge of physics. Whichever the case may be, there are certainly wrong and right approaches to learning physics. In this short article, I will explain how to get the most out of your learning. This…

with the power of stochastic modelling and MATLAB.

**Prerequisites**

In order to follow along this tutorial, you will need to be familiar with basic probability and statistics, and concepts such as mean, variance, standard deviation, random variables (discrete and/or continuous), and the notion of the normal distribution (e.g. Gaussian distribution). Some knowledge of programming (particularly in Matlab) is advised, but not entirely necessary.

**Simple random walks**

A random walk is one of the most basic types of stochastic processes we can simulate. Essentially, it is a discrete process by which the position of a particle or object, denoted by **x**…

And why you are probably doing it wrong.

Stochastic calculus, as its name suggests: is an area of mathematics concerned with the calculus (e.g. derivatives, integrals, limits, etc.) of stochastic processes (also known as random processes, effectively sequences of random numbers which possess certain properties). It is a natural extension of ordinary calculus to functions of a random variable, which are not deterministic over time, but rather random: each value of a function X(t) in time t is in itself a random variable. …

Oscar a physicist and software enthusiast. He is currently completing a PhD in Theoretical Physics with a focus on photonics and stochastic dynamics.