# Sage Math Tutorial - Stochastics

This page contains interactive Sage widgets - edit and re-evaluate them!

Typically, chemical engineers can make use of the so-called 'Law of Mass Action' to predict the behaviours of large populations of atoms in dynamic equilibrium. This is what enables us to use concepts like 'reaction rate constants' to get meaningful answers to real-world chemical problems. But consider a single particle that can flip-flop between two different forms. What does a rate constant have to do with the probability that this particle will be in a given state at a given time? If there is a probability of flipping states over a given time period, how long might you expect to wait between flips? How do the behaviors of small groups of particles and the probability of their actions, the 'stochastic world', connect to the macroscopic phenomena that we observe in large systems?

In this example, we simulate a small collection of particles (50) as they flip-flop between two different states; in parallel, we simulate a large collection of the same particles that follow the 'Law of Mass Action'. Then, we graph them on top of eachother and observe the 'stochastic noise' that occurs in systems with few actors.