One of those questions that Google gives you 1000 irrelevant answers for: Given N summed sine waves, all of frequency X, with N different phase shifts and amplitudes, what is the resulting amplitude? Integrating them in discrete steps over time and finding the maximum seems like a clumsy way of doing it.
I guess it would help to reword it to "find the new phase and amplitude given two summed sine waves" and then iterate over that.