Added the solve function, finished cosine functions. The program should be all done (but is untested).