Simple Python Assignment


This assignment is designed to test your Python installation and give you a first taste (if needed) of doing computations and plotting in Python.

The assignment is to duplicate this plot, using equation 6.1 from the book. Use a font size of 15 for the axis labels, and duplicate the use of Greek characters and superscripts, annotation, title (include your own name rather than mine), etc.
Please turn in both your plot and a printout of your Python code (if you use jupyter notebook, you can export the program to a standard *.py file for printing).
Hints:

  • My program used 23 lines of actual code, not counting comments.
  • You will need the following standard import statements:
    import matplotlib.pyplot as plt
    import numpy as np
  • You will probably want the np.arange() function and the following matplotlib.pyplot functions: plot, xlabel, ylabel, legend, annotate, title, and savefig
Although not mandatory, I strongly encourage you to learn to use the “jupyter notebook” (formerly “ipython notebook”) environment for interactive writing and testing of Python, scratch calculations, etc. You will need to install jupyter in addition to the numpy and matplotlib packages; e.g., “conda install jupyter”. Midway down the following page is a list of Python references and resources that I know about: http://sleet.aos.wisc.edu/~gpetty/wp/?page_id=573 In addition, you can often google specific questions and quickly find information online.