## Announcements:

Do not use the math library for anything.

It is perfectly fine to not have any functions in this project. The point of the project is to practice nested for loops. If you want to use functions that is fine, but it is not necessary to get a 100.

Use double variables to calculate the factorials. The numbers get too large for integer variables, too quickly.

## Hints for Project 2

In this section, we have some questions and comments from the students. As usual, names have been withheld to protect the innocent and the questions have been edited for spelling and grammar.

Prof. Chang,
I am unsure of how to calculate an exponent. If we can't use the math library and ** doesn't work, what do we do?

Dear Unsure,
Well, for x cubed you will have to multiply x three times. For x to the fifth you will have to multiply x five times. Hmmmm... sounds like a for loop in there somewhere. Not surprising that the objective of the project is to practice using nested for loops.

Prof. Chang,
I tried many values of PI, but I cannot get the same answer in my output as in your sample output.

For example, in my answer sin(360)= -0.0932502, but yours is -0.0932458.

Dear Perfectionist,
Unless you write exactly the same program as I did (in which case, I would start changing my passwords), some differences in the floating point values will creep in. It is OK, for your program to have slightly different output from the sample output in the handout.

Prof. Chang,
Project two is a bit confusing.

I understand how to get everything working except how to alternate the + and - signs in the formula. Could you give me just a few hints on how to go about it?

Thank You, Clueless.

P.S Is this really anonymous mail or you have a sneaky way of finding out who the author is?

Dear Paranoid One,
HINT: -1 * -1 = 1.

Another HINT: -1 * -1 * -1 = -1.

I have no interest in "exposing" people who send me anonymous mail. Ever since Sister Jacinta asked us to write down what we really think of her music class in 6th grade, I have a great respect for the value of keeping anonymous messages anonymous. (Yes, I did. Yes, they made me "apologize".)

Now, if it bothers you that it might be possible for someone to say a message is sent anonymously without it truly being anonymous, you can always use Netscape from a Macintosh or PC and not tell the machine who you are. If the machine doesn't know who you are, it can't tell who sent the message. The most that can be gathered from the message is where it was sent from and when.

Well, if you are really worried that someone is recording who is using which machine and when, you can always type up a note and shove it under my door when nobody is watching. Better yet, send a friend to shove it under my door.

Prof. Chang,
I was looking at the ditto explaining project two and I just don't get it. What is the x? Is it the degree value of the sine or what? And also, what are the radian values for numbers that are not multiples of fifteen? I've never seen them anywhere. If you could explain this to me I would be much obliged.

Sincerely, Haven't A Clue

Prof. Chang,
Hold it, hold it, hold it. Angles come in different sizes? Yes? Some are skinny, some are fat, and we can use a number to measure how skinny and how fat. Now, there are different ways to measure an angle, just like there are different ways to measure height (centimeters vs inches), weight (pounds vs kilograms), temperature (Centigrade vs Farenheit) and distance (miles vs kilometers).

Traditionally, people have used degrees to measure an angle. We all know that 90 degrees is a right angle, 180 degrees is a straight line, and 360 degrees turns you completely around. Why do we use 0 through 360? Well, there are historical reasons for this, but it is certainly not the only way. In fact, using degrees is not very convenient if you want to calculate the values of trigonometric functions (sine, cosine, tangent, etc).

An alternate way of measuring an angle, called radians, puts a value of PI/2 (roughly 1.57) on a right angle. It's the same right angle as before, we are just giving it a different number. It's like saying 1.6 kilometers is equal to 1 mile. Same distance, different number. So, an angle with 180 degrees has PI radians (roughly 3.14). An angle with 360 degrees has 2*PI radians (roughly 6.28), and so forth. The clincher is that the formula (Taylor series) for sin(x) given in the handout works when x is the measurement of the angle in radians. So to compute the value of sin(360 degrees), you should use the formula to find the value of sin(2*PI radians).

So, the formula for converting degrees to radians is (as written on the handout)

```     radians = PI * degrees/180
```
This allows you to convert degrees to radians for all angles, no matter if they are multiples of fifteen. For example, 33 degrees, is roughly 3.14 * 33 /180 which gives you around 0.576 radians.

Prof. Chang,
I just wanted to know the value of PI that you used in your program to get the sample run. I used PI = 3.14159265359.

Dear Student,
Yes, you are right. The value of PI would affect things a little. I doubt it would be that much. I think I used 10 digits, that is what my calculator does.