Lesson goal: Adding numbers to compute the sine

Previous: Rotate a parabola | Home | Next: Introduction

If you've taken trigonometry, you probably know about taking the sine of a number. Like $\sin 45^\circ=0.701$. You probably also learned that $\sin$ (and $\cos$) can be found using the unit circle.

Well, did you know that the sin of any number can also be found by adding together a bunch of numbers in a particular way? That's right, the sin of a number can come from a big addition problem. The sum (or big addition problem) to find $\sin$ looks like this: $\sin(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+...$

Using a for-loop to handle the sum, test the results of this sum for $\sin(x)$ vs. the built in math.sin(x) function. Feel free to take many more terms that just 4 in the sum.

We've provided the factorial function for you already.

Now you try. Fix up the contents of the for-loop to find the sin of x using the big sum.

Type your code here:

See your results here: