Mathematics of the stock market