Source: https://www.normalesup.org/~carpenti/Cours/PSY-L3-TDinfo-1-2003.pdf