add comments and logs to understand sine function