cool math homework assignment

This is a discussion on cool math homework assignment within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Well you can move this to whatever board you want. Anyway I'm taking a course called 'engineering mathematics.' It's kind ...

cool math homework assignment

Well you can move this to whatever board you want. Anyway I'm taking a course called 'engineering mathematics.' It's kind of the equivalent of a linear algebra course. My professor is an eccentric old lady that is way too smart to teach math to humans.

Our assignment over the weekend was to write in excel a command to evaluate the series for 'e' and 'pi' and to see how many terms in the series it took to get a certain number of decimal places accuracy. She suggested trying a couple of hundred terms, so of course I wrote a program that evaluates PI using 50 million terms. Kind of neat. Here are the results, the series for 'e' converged pretty quickly, not true for PI.

Your series for e will converge extremly fast because the terms get really small very fast (factorial in the denominator).

Since the series you're using for pi is an alternating one, it is very easy to give an estimation how close to pi you are. After the first term your estimation is too big and after the second one it is too small and so on. So an upper bound of the error is the last term you added. That way you can know for sure how many digits are correct.

*Select two random numbers in the interval [-1...1]
*Count the number of times you end up within the unit disc. sqrt(x^2 + y^2) <= 1
*The ratio between this number and the total amound tends to the ratio of the unit disc to the area of the square (4).

Yeah, I saw the method that you suggested, I think on wikipedia. Glad you posted the source. She wanted us to use this particular method to demonstrate the idea in Sang drax's first reply, that the estimate goes above and then below, oscillating (it tied into this week's lecture).