How prices and herd mentality create market bubbles