Worksheet 7 - PHY201

Due: Oct 29, 2004

Physics 201 home

Read up to page 70 of Ortega.

Please use the syntax of Ortega in your programming: Put a comment statement at the top of each of your programs with your name in capital letters. All of your input should be preceded by a prompt, and the values that were input should be printed by the program.

PROBLEMS

1. From Ortega, do the following Exercises: 2.9.1, 2.9.2, 2.9.3, 2.9.4

2. You can make graphs using the graphics utility package xmgrace. To use this package, you first create a two-column file of the x and y values to be plotted. Here is a sample two column data set which you can download to practice with. If your data file is called foo.dat, the command xmgrace foo.dat should produce the plot. Alternatively, you can fire up the graphics package with the single command xmgrace and use the drop-down menus in the following sequence: ``data", ``import", ``ASCII"; then pick your file. Either way, you can then change the appearance of the plot using the drop-down menu options under ``plot".

Adapt your program for the cosine function from worksheet 4, to find the estimate of exp[x] obtained by keeping the first n terms in the power series, with x=4 and n ranging from 1 to 20. Save this data in two column format and plot it using xmgrace.

(You may be able to print the graph directly using the xmgrace menus. If not, you can print it by choosing the option ``device setup", and once in this area, choose ``print to file" with the ``postscript" option selected. Once you have done this, choose ``print" from the drop-down menu. This will write a postscript version of the file to your local directory (yourfile.ps). Then use the unix command   ``lpr yourfile.ps"   to print this file.) Hand in a copy of your graph.

3. Add this week's commands to your list of FORTRAN commands. Hand in a copy of your list.