CS-240 Data Structures
Project 3

Purpose:
The purpose of this laboratory exercise is two fold:
  1. a review of some trigonometry and introduction to basic numerical methods
  2. an exposure to the programming technique of recursion.
    Description:
    The trigonometric functions of sin, cos and tan can be approximated by the following series expansions:

    sin x = x - x3/3! + x5/5! - x7/7!.....

    cos x = 1 - x2/2! + x4/4! - x6/6!.....

    tan x = x + x3/6 + 2x5/15 + 17x7/315 + 62X9/2835 .....

    Notice that these functions, as expansions resemble our definition of things that are targets for recursive solutions; i.e. at each step of the expansion we are solving the same general problem (notice for sin the problem is always: sum + xn/n!) in numerical methods we learn that approximations such as the are best done by determinining the accuracy to which we need the function. For example if we want our accuracy to be 0.00001 we only need include in the calculation the terms that will produce a difference of +/- 0.00001 on adjacent calculations; i.e. if the difference between the calculations for the 8th and 9th terms of the expansion is 0.00001 then our answer is the expansion including the first 9 terms.

    Method:
    Write a program that will include three (3) recursive functions for calculating sin, cos and tan using the series expansions outlined above, the program should print out a table of sin, cos and tan for all angles between 0 and 2pi radians; in increments of 0.1 radians.

Last updated 10/17/2004 - rvs