Added functions.cpp/h with basic mathematical functions and tonelli's + jacobi's formulas