#!/usr/bin/env python # coding: utf-8 # Homework Guidelines # ==== # # Homework should always be done as a jupyter notebook, like this one. Problems not following guidelines will lose 25% if the issues are small (like sparsely commented code) or if serious (equations are in plain text, no work shown) the problem will not be graded and receive a 0. Read more about notebooks [here](https://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/examples_index.html). Here is an [example of a well-constructed notebook](http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Trapezoid%20Rule.ipynb). The following guidelines for homework apply: # # * Work must be shown for any credit. Use common sense here. You don't need to write out very easy steps, but you also shouldn't be writing down answers to questions without any work shown. Refer to the homework solutions for examples. # * All writing should be done in markdown. Go [here](http://daringfireball.net/projects/markdown/syntax) for a description of how to use Markdown # * All symbolic math should be done in a Markdown cell by either enclosing an equation in the '\$' symbol or use '\$\$' for longer equations that should be displayed on their own line. Go [here](http://en.wikibooks.org/wiki/LaTeX/Mathematics) to find out how to enter math, which follow the LaTeX syntax. # * Your python code should always be well documented by lines that start with the '#' key. # * Plots should always have labeled axes and legends when applicable # * If asked to answer symbolically, you should plug in numbers and evaluate/simplify as far as possible while using LaTeX Equations. You should not use Python code for such problems. # # # This cell is an example of Markdown. The raw markdown is shown below. # # Markdown Example Homework Guidelines ==== Homework should always be done as a jupyter notebook, like this one. Problems not following guidelines will lose 25% if the issues are small (like sparsely commented code) or if serious (equations are in plain text, no work shown) the problem will not be graded and receive a 0. Read more about notebooks [here](https://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/examples_index.html). Here is an [example of a well-constructed notebook](http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Trapezoid%20Rule.ipynb). The following guidelines for homework apply: * Work must be shown for any credit. Use common sense here. You don't need to write out very easy steps, but you also shouldn't be writing down answers to questions without any work shown. Refer to the homework solutions for examples. * All writing should be done in markdown. Go [here](http://daringfireball.net/projects/markdown/syntax) for a description of how to use Markdown * All symbolic math should be done in a Markdown cell by either enclosing an equation in the '\$' symbol or use '\$\$' for longer equations that should be displayed on their own line. Go [here](http://en.wikibooks.org/wiki/LaTeX/Mathematics) to find out how to enter math, which follow the LaTeX syntax. * Your python code should always be well documented by lines that start with the '#' key. This cell is an example of Markdown. The raw markdown is shown below. # # Python Example # In[2]: #This is a python example #First we enable plotting for the notbook. This statement is specific to notebooks #and note a part of python. get_ipython().run_line_magic('matplotlib', 'inline') #Now we important the libraries we need. #The `as` keyword allows us to shorten their names when used #below. import matplotlib.pyplot as plt import numpy as np #make our plot look fun and cartoony plt.xkcd() #The `from` keyword allows us to import only certain items from math import pi #Create a set of points from -2pi to 2pi spaced by 0.01 and calculate the sine of them x = np.arange(-2*pi, 2*pi, 0.01) #notice that np refers to numpy due to the `as` statement. y = np.sin(x) #Make the plot and set x-limit plt.plot(x,y) plt.xlim(-2*pi, 2*pi) #show the plot plt.show() # # Equation Example # This is a small equation: $\ln x^2$. This equation has sub/super scripts: $P_e(s) = b^i$ This one has a sum: $\sum_i^N f_i(s)$. This is a big equation: # # $$\frac{\partial V(\vec{s})}{\partial s_j} = \frac{\frac{\partial f(\vec{s})}{\partial s_j} - \frac{f(\vec{s})}{g_j(s_j)}\frac{\partial g_j(s_j)}{\partial s_j}}{\prod_i^N g(\vec{s})}$$ This is a small equation: $\ln x^2$. This equation has sub/super scripts: $P_e(s) = b^i$ This one has a sum: $\sum_i^N f_i(s)$. This is a big equation: $$\frac{\partial V(\vec{s})}{\partial s_j} = \frac{\frac{\partial f(\vec{s})}{\partial s_j} - \frac{f(\vec{s})}{g_j(s_j)}\frac{\partial g_j(s_j)}{\partial s_j}}{\prod_i^N g(\vec{s})}$$