add a function that calculates the phase