EG H167 1:30 Sec. Winter 2001 Daily Assignment D11Advanced
For the D11 Advanced assignment:
1. Complete the regular D11 assignment which introduces user written functions in C.
2. Complete the following as additions to your program in Step 1 above:
a). Use the C math library function, "cos", to also calculate the value of each of the angles in the regular assignment and determine the amount of "error" between result given by the C math library function and result from the first five terms of the Taylor Series expansion. Print out this "error" value along with the other results requested in the regular assignment.
b). Implement an algorithm to calculate the "cos x" value using a Taylor Series expansion with just enough terms (not too many, not too few, but just right--a "Goldilocks" answer) to achieve a result that is within 1.0x10-6 of the value provided by the C math library. Print out the number of terms required in the Taylor Series to achieve the comparison within the stated tolerance value along with your other results. (Hint: You may need to do the computations with variables which are declared "double" instead of "float").
c). Explain why you might have needed to use "double" instead of "float".