merged math.cpp

merged file with updated code from akansha