add function calculation