Assigned Friday, Sept. 26, 2008, due Wednesday, Oct. 1, 2008
General Comments
The purpose of this assignment is to have you become familiar with compiling, running and viewing output data from
a program written in C++.
If you don't remember how to use Visual C++, you can refresh your memory with the pages Using
Visual Studio C++ (2003) or Using Visual Studio C++ (2005).
If you are using a Linux/Unix based system then you may want to refresh your memory about how to use the
C++ compiler and make tools. There is a sample "make" file for this assignment, but the programs that you will be creating and working with will involve many separate files, and it is recommended that you obtain and learn how to use an integrated development environment (IDE) that works with Linux/Unix based platforms. Eclipse is a good choice, although, depending on your version of Linux/Unix, there may be others available at no cost, or that have already been installed (e.g. Kdevelop).
Since we are going to be working with functions of two independent variables, it is very important to be able to
create contour and surface plots. I've created routines that output data in a form that works with GNUplot ---
a widely used, freely available, graphics package. I've also created routines that output the data in a form that Matlab (or Octave) can read. However, you can use whatever graphics package you want; but
you'll probably have to write a small routine that outputs the data in a form that your package understands.
GNUplot is already on most Linux/Unix systems. For PC users, or for those whose Linux/Unix machines don't have it installed, the program is available over the web, see the "About Gnuplot" page.
The assignment files and support files will be provided via Mercurial managed code repositories. There are two ways to download the requisite files, one is to go to the repository web site and download a zipped version of the files (links to the repositories will be included in the assignments) and the other is to use the Mercurial program and create your own, local version, of the repository files. The latter process requires the use of the Mercurial program, "hg". Versions of this program can be obtained from the Mercurial site. In particular, stand-alone binary versions are available for a number of platforms, including Windows. See the Mercurial Binary Package site for details.
Problem [1]
[i] Create a course directory for the class assignments and support files.
[ii] Download the array class files from the 270eSupport/ArrayClasses repository into subdirectories of your course directory.
hg clone https://www.math.ucla.edu/~anderson/Courses/270eSupport/ArrayClasses/
[iii] Download the Assign1 files from the 270eSupport/Assign1 repository to an Assign1 subdirectory of your course directory.
hg clone https://www.math.ucla.edu/~anderson/Courses/270eSupport/Assign1/
[v] Compile these .cpp files into a single executable ("build" in VC7, "make -f Assign1gnu.mk" or "make -f Assign1matlab.mk" with Linux/Unix).
[vi] Run the program. Depending on which output format you choose to work with a file called GNUplotTest2D.dat or MatlabPlotTest2D.dat will be created. Using GNUplot or Matlab as appropriate, view the data
contained in these files as both a contour plot and a surface plot . Create a hardcopy of the plots and turn them in.