Recursives functions used in math machine learning course