Document and fix the sine function. Notice the meaning of theta changed with this commit.