need help with mathematical code