CSC2310 Assignment 2 25 points due 9/11/01 Dr. Harrison Fall 2001

This project will exercise your skills with loops and objects. The goal is to write a program that will calculate a type of series known as a Fourier series. (The Fourier transform, and it's discrete analog the Fourier series are very useful mathematical tools that find application in areas ranging from digital signal processing and image enhancement to theoretical physics and quantum mechanics – and no you don't need to understand why the sums work to do the exercise).


The task:

calculate the sum sin(i x ) , cos(i x)/i, sin(i x)/i2 for 20 equally spaced points of x between 0 and 2à. Sum the first 50 values of i (i.e. Sin(x), sin(2x),... sin(50 x)). So you will need to use

two loops, one over x and one over i.


You will need to include the java Math routines (specifically Math.sin( double ), and Math.cos(double) ) and should write an object that has a method for each of the sums.


Print out a header line saying what each column is and then the sums.

It should look like


x sin(ix) cos(ix)/i sin(ix)/(i*i)

0 0 ? 0

... ... ... ...

6.2831853 ? ? ?





The sources for the programs and the output should be printed and the sources and class files should be supplied on a disk. Please label your work.