About the printer:
In Wilson 2-243 (upstairs) there is an HP Laserjet 5M printer which is shared by virtually everyone in the Mathematics department. It is therefore a very busy printer. Because it is shared, whenever you send something to the printer it may not come out for a few minutes. Occasionally a paper jam occurs. When this happens, the printer's display will read "Paper Jam". If that happens to you, leave it alone and walk away, or ask someone else about it (if anyone is in the room). Sometimes, the printer runs out of paper. Usually there is a ream of paper next to the printer which you can use to re-fill the "Default tray". That is the tray on the bottom. Simply pull the tray out (towards you), insert some paper and slide the tray back in. Make sure the paper is below the metal holder in the corner of the tray. Again, if other people before you have sent jobs to the printer these will come out first before yours. So, be patient and wait.
File types and formats:
We will deal with two file formats in this course:
On the main M441 web page ("back") you can download HW#3 as a "Postscript" file. If you do this, and then type the "list" command
ls
in the C-shell (xterm) window you will notice that a file named "HW_3.ps" is in the list. It is an example of a Postscript file. If you emacs the file you would notice a bunch of cryptic commands. That is the postscript language. Most printers read and understand postscript. The *.ps suffix indicates it is a postscript file.
Printing ASCII and Postscript files:
To print an ASCII or Postscript file the command is the same:
lpr filename
For instance,
lpr Bisect.m
would send the ASCII file "Bisect.m" to the printer. Likewise,
lpr HW_3.ps
would send "HW_3.ps" to the printer. What you see is not what you get with postscript files. For instance, if you editted HW_3.ps using
emacs HW_3.ps &
all those cryptic postscript commands get converted by the printer into what was handed out in class.
Printing Figures from within matlab:
If you enter matlab and executed:
>> x=-2:0.01:2;
>> plot(x,x.^2);
a graph of x versus x^2 would appear. The easy way to print it is to select "Print" from the "File" menu of the window in which the graph appears. When you do this, matlab creates a postscript file of the image and then sends that to the printer. You can save the file in postscript form from this menu but that feature is a little broken--- I don't advise it. If you want to save the figure another way would be to type:
>> print -deps filename.ps
Upon exiting matlab the figure will have been saved as "filename.ps" in your current directory. You could later print it as above by typing "lpr filename.ps".
Note: Since many of you may be printing similar graphs and files it may be a good idea to personalize each item you print. For example, add a title to your figures which includes your name so you don;t take someone else's by mistake. This can be done as follows:
>> x=-2:0.01:2;
>> plot(x,x.^2);
>> title('my plot...do not take!');
Previewing Postscript Files:
To preview a postscript file named "filename.ps" you can use the "ghostview" program. This is executed from the C-shell window in UNIX as:
ghostview filename.ps &
The program converts the postscript language into an screen image of what will be printed.
Keeping and printing a record of your matlab session:
Suppose you want to keep a record of all the commands you typed during a matlab session. Do the following:
1) Enter matlab
2) Execute the following commands

3) type
ls
There should now be an ASCII file named "session1" whose contents is the matlab session from the time the "diary" was turned on to the time it was turned off.
4) You can preview the file "session1" in 3) by executing:
emacs session1 &
or print it like any other ASCII file ( i.e., lpr session1).
Help in matlab:
Enter matlab and type:
>> helpwin
You should get a new window that looks like:

Matlab is huge! Each line is a table a topic with sub topics with sub sub topics leading to matlab commands. Try double clicking on the line
matlab/matfun
You would see a list of some of the matrix functions. Clicking on any one tells you more etc.
If you already know a command name but forget how to use it type the command name in the upper left box (just above the "Back" button) and hit return. Try:
for
.*
cond
demo
Note: The last command "demo" has some online tutorials. Try clicking on "Visualization" then "2-D Plots".
Computer Project 1 (Due Thursday Oct 28)
Create two M-files "Secant.m" and "F.m" which implement the secant root finding algorithm on the function F(x). Within matlab the command
>> Secant('F',x0,x1,tol)
should return the iterates xn to the screen. The variable "tol" is a tolerance parameter for terminating the iteration. Use the criteria that if |xn-xn-1| < tol, the iteration stops. Looking at "BisectF.m" may help you. Pick any nonlinear function F(x) whose root you know exactly.
Turn in the following: