


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Concurrent Programming; Subject: Computer Science; University: Drexel University; Term: Unknown 1989;
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Log into your queen UNIX account. Perform the following steps, starting out in your home directory. The steps are numbered to help you keep track.
The goal of this programming assignment is to write your first Java program, if you have not already done so.
mkdir asmt
chmod 700 asmt
cd asmt
Write Java classes to integrate functions using “Adaptive Quadrature” method. Adaptive quadrature is a numerical integration procedure in which the interval of integration is recursively subdivided until an error tolerance is met for the approximate integral on each subinterval. The error estimate for a given subinterval is based on the difference between two different quadrature rules applied on the subinterval. The two quadrature rules used in this module are the midpoint and trapezoid rules, and the recursion tree can be traversed in depth-first or breadth-first order, or in any other order you may choose.
a. The midpoint method : evaluate the function at the midpoint of the interval and multiply it by the width of the sub-interval.
b. The trapezoid method : evaluate the function at the ends of the internal and compute the average of these 2 values. Multiply that average by the width of the sub-interval.
Evaluate the midpoint rule, and trapezoid rule, for the current subinterval, as well as the magnitude of their difference. If the two quadrature rules differ by less than the selected tolerance, or if the subinterval width falls below some minimum allowed value [ make it a constant 10^(-5) in your program ] , then that subinterval is declared "completed".
The number of subdivisions required to converge to within a given tolerance depends on the nature of the integrand function. In particular, a region where the integrand function has an abrupt change, sharp peak, cusp, or discontinuity will require many more subdivisions (and hence function evaluations) than a region where the integrand function is well behaved. The assigned integrand functions are listed in rough order of difficulty, from easiest to hardest.
You will need to define an interface class Function with the following methods:
public float evaluate();
Implement the Function interface and then implement following concrete functions:
Write a driver AdaptiveQuadrature that reads from a command line following arguments:
Create three different tests for each function and divert their output into test output files with following inputs:
tar xf - < asmt1.tar
Submit your work via webct: log onto webct (webct.drexel.edu) and give the webct userid and password that you received from the instructor. Click on the assignments link of the cs361 home page. Click on the assignment 1 link of the assignments page. Then follow the directions on the resulting page for submitting asmt1.tar.gz. More than one file can be submitted through the “Student file” button, but once you hit the “submit assignment” button webct will not accept anything further.
All submissions are timestamped by the system when they are submitted. Only the latest version of a student file is stored by the system. The older versions of the file are erased.
It is your responsibility to make your portable (eliminating file names that only work on your computer, for example), so that the grader can test the program should they choose to do so.
Grading
7 points correctness, avoidance of awkward or grossly inefficient programming. :"Correctness" in this case includes: a) correctly integrating the example functions, b) correct implementation of the Function interface.
3 points, good documentation -- methods appropriately commented, header information explaining how program works/is to be used)
(Extra credit: up to 3 points, graders' choice)