Physics 305, Section 1, Fall 2009
Assignment 1
Due Monday, August 31

Homework 1
Due Monday, August 31, 10 pm

Assignment number 1 is to write, run and report on several simple programs. Remember that your homework submission is a report which should contain your programs, but must also explain what each program does, how you tested it, some sample input and output, and any conclusions that you reach. (In the future, you will also need to discuss the numerical methods that you use, but these will be trivial in this assignment.) Remember that your homework report should be the body of your email message or a plain text attachment (but not both). The graphs for questions 3 and 4 should be postscript files sent as attachments.

  1. Write and test a program to convert a temperature in degrees Fahrenheit into a temperature in Centigrade. This program only needs to read one number, and print one number for its output.

  2. Write and test a program to print the first twenty powers of two. That is, print the value of $2^1$ through $2^{20}$.

  3. Write and test a program to print x and sin(x) for values of x from 0 to $2\pi$ in steps of 0.1. The output should be a bunch of lines of text, each containing a value of x and the corresponding sin(x) Use ``Philsplot'', ``graph", or another program of your choice to make a graph of the output.

  4. Demonstrate the convergence of a Taylor expansion. Find the Taylor expansion around $x=0$ of $\exp(-x)$ up to fourth order in $x$. Write a program to make a table of the values of $\exp(-x)$ in the interval $0 \le x < 1$. Then make data files (separate) of the Taylor series to first order, to second order, third order and fourth order. You may do this by editing the program for each order that you want or by using scanf(). Then plot the function $\exp(-x)$ and each of the Taylor expansions on the same plot.





Doug Toussaint 2009-08-26