diff --git a/HW6/README.md b/HW6/README.md
index 1f3c86c..c72ba05 100644
--- a/HW6/README.md
+++ b/HW6/README.md
@@ -34,12 +34,14 @@ variable is failure (1=fail, 0=pass). Create a function called `cost_logistic.m`
takes the vector `a`, and independent variable `x` and dependent variable `y`. Use the
function, $\sigma(t)=\frac{1}{1+e^{-t}}$ where $t=a_{0}+a_{1}x$. Use the cost function,
- $J(a_{0},a_{1})=\sum_{i=1}^{n}\left[-y_{i}\log(\sigma(t_{i}))-(1-y_{i})\log((1-\sigma(t_{i})))\right]$
+ $J(a_{0},a_{1})=1/m\sum_{i=1}^{n}\left[-y_{i}\log(\sigma(t_{i}))-(1-y_{i})\log((1-\sigma(t_{i})))\right]$
and gradient
$\frac{\partial J}{\partial a_{i}}=
- 1/m\sum_{k=1}^{N}\left(\sigma(t_{k})-y_{k}\right)t_{k}$
+ 1/m\sum_{k=1}^{N}\left(\sigma(t_{k})-y_{k}\right)x_{k}^{i}$
+
+ where $x_{k}^{i} is the k-th value of temperature raised to the i-th power (0, and 1)
a. edit `cost_logistic.m` so that the output is `[J,grad]` or [cost, gradient]
diff --git a/lecture_17/octave-workspace b/lecture_17/octave-workspace
index c9ec2aa..8c437bb 100644
Binary files a/lecture_17/octave-workspace and b/lecture_17/octave-workspace differ
diff --git a/lecture_18/octave-workspace b/lecture_18/octave-workspace
index d40f9ac..8c437bb 100644
Binary files a/lecture_18/octave-workspace and b/lecture_18/octave-workspace differ
diff --git a/lecture_19/octave-workspace b/lecture_19/octave-workspace
index 4bd89dd..8c437bb 100644
Binary files a/lecture_19/octave-workspace and b/lecture_19/octave-workspace differ
diff --git a/lecture_20/octave-workspace b/lecture_20/octave-workspace
new file mode 100644
index 0000000..41ef164
Binary files /dev/null and b/lecture_20/octave-workspace differ
diff --git a/lecture_21/.ipynb_checkpoints/lecture_21-checkpoint.ipynb b/lecture_21/.ipynb_checkpoints/lecture_21-checkpoint.ipynb
new file mode 100644
index 0000000..2fd6442
--- /dev/null
+++ b/lecture_21/.ipynb_checkpoints/lecture_21-checkpoint.ipynb
@@ -0,0 +1,6 @@
+{
+ "cells": [],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/lecture_21/lecture_21.ipynb b/lecture_21/lecture_21.ipynb
new file mode 100644
index 0000000..c2547e6
--- /dev/null
+++ b/lecture_21/lecture_21.ipynb
@@ -0,0 +1,430 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "%plot --format svg"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "setdefaults"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "## Reduce Noise in derivative of data\n",
+ "\n",
+ "\n",
+ "\n",
+ "- Turn the volume down!\n",
+ "\n",
+ "- Use robust statistics like median and mean absolute deviation\n",
+ "\n",
+ "- Gauss quadrature\n",
+ "\n",
+ "- Put a filter on it\n",
+ "\n",
+ "- Take the average\n",
+ "\n",
+ "- Low-pass filter\n",
+ "\n",
+ "- Expand the Taylor series\n",
+ "\n",
+ "- Fit a function and derive that\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "error: subscript indices must be either positive integers less than 2^31 or logicals\n",
+ "ans =\n",
+ "\n",
+ " 1 100\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "image/svg+xml": [
+ ""
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "x=linspace(-pi,pi);\n",
+ "y_smooth=sin(x);\n",
+ "y_noise =y_smooth+rand(size(x))*0.1-0.05;\n",
+ "\n",
+ "% Smooth data\n",
+ "N=20; % average data between 10 points (forward/backward)\n",
+ "y_data=[y_noise(N/2:-1:1) y_noise y_noise(end:-1:end-N/2+1)];\n",
+ "y_filter=y_data;\n",
+ "for i=6:length(x)\n",
+ " y_filter(i)=mean(y_data(i-10:i));\n",
+ "end\n",
+ "y_filter=y_filter(N/2:end-N/2-1);\n",
+ "size(y_filter)\n",
+ "plot(x,y_filter,x,y_noise,'.')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Homework Review\n",
+ "\n",
+ "### HW #4\n",
+ "\n",
+ "\n",
+ "\n",
+ "$E_{total}=m x_C g\\sin(\\theta)+\\frac{K}{2}\\left(0.5 - \\sqrt{0.5^2+(0.5-x_C)^2}\\right)^{2}$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "```matlab\n",
+ "% Define function ...\n",
+ "function collar_potential_energy(x,theta)\n",
+ " % function to evaluate E_total\n",
+ " Etotal = m*x*g.*sin(theta)+K/2*(0.5-sqrt(0.5^2+(0.5-x).^2);\n",
+ "end\n",
+ "\n",
+ "% solve for x\n",
+ "\n",
+ "x=goldmin(@(x) collar_potential_energy(x,theta),xl,xu)\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## HW #5\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Initial Value Problem"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Octave",
+ "language": "octave",
+ "name": "octave"
+ },
+ "language_info": {
+ "file_extension": ".m",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "octave",
+ "version": "0.19.14"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/lecture_21/q1.png b/lecture_21/q1.png
new file mode 100644
index 0000000..3145b8d
Binary files /dev/null and b/lecture_21/q1.png differ
diff --git a/lecture_21/q2.png b/lecture_21/q2.png
new file mode 100644
index 0000000..2def4d3
Binary files /dev/null and b/lecture_21/q2.png differ
diff --git a/lecture_21/reduce_noise.png b/lecture_21/reduce_noise.png
new file mode 100644
index 0000000..5a67ad5
Binary files /dev/null and b/lecture_21/reduce_noise.png differ