I\'ve been trying to do this exercise for my friend. However, I\'m good with programming but not very good at math. Any one can help me doing it?
(a) Write a function