Do you need to make an implementation, or do you just need a cosine function?

If you just need cosine for somthing else, then check the Math class. It contains a cos method.