Skip to content

Commit

Permalink
cleaning up lesson 5
Browse files Browse the repository at this point in the history
  • Loading branch information
pmackenz committed Jul 29, 2024
1 parent 9c506d9 commit f97acfd
Showing 1 changed file with 40 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,51 @@
"$$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Algorithm\n",
"\n",
"INITIALIZATION:\n",
"\n",
" N = 0\n",
" sum = 0\n",
" sum2 = 0\n",
"\n",
"LOOP:\n",
"\n",
" N = N + 1\n",
" \n",
" $\\sum z_i$: sum[i] = sum[i-1] + zi \n",
" \n",
" $\\sum (z_i)^2$: sum2[i] = sum2[i-1] + zi*zi\n",
"\n",
"AFTER LOOP:\n",
"\n",
" mean = sum / N\n",
"\n",
" sig2 = sum2 / N = mean**2\n",
"\n",
" sig = sqrt(sig2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"f = open(\"exercise6_data.csv\",'r')\n",
"\n",
"# initialize \n",
"means = np.zeros(4)\n",
"sigs = np.zeros(4)\n",
"N = 0\n",
"\n",
"# collect data\n",
"for line in f:\n",
" print(line, end='')\n",
" print(type(line))\n",
" print(line*2)\n",
" \n",
" # YOUR CODE HERE\n",
"\n",
"# YOUR CODE HERE ...\n"
" break"
]
},
{
Expand Down Expand Up @@ -142,9 +171,7 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# YOUR CODE HERE ...\n"
]
"source": []
},
{
"cell_type": "markdown",
Expand All @@ -161,13 +188,6 @@
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -291,7 +311,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -305,7 +325,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit f97acfd

Please sign in to comment.