Skip to content

Commit 28c700f

Browse files
committed
2 parents c319590 + e5157f8 commit 28c700f

33 files changed

Lines changed: 1631 additions & 1698 deletions

‎Week_0_python/Intro_assignment.ipynb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
"\n",
295295
"# List of names (creates a set)\n",
296296
"worked_with_names = {\"not filled out\"}\n",
297-
"# List of URLS W26 (creates a set)\n",
297+
"# List of URLS SP26 (creates a set)\n",
298298
"websites = {\"not filled out\"}\n",
299299
"# Approximate number of hours, including lab/in-class time\n",
300300
"hours = -1.5"
@@ -323,11 +323,14 @@
323323
"- Hit clear all outputs (this removes all the outputs)\n",
324324
"- Hit Restart (say yes when it asks if it's ok to blow everything away)\n",
325325
"- Hit 'Run All' to make sure that your code executes from top to bottom from scratch. \n",
326+
"- Make sure you SAVE the file\n",
327+
" Side note: if you click on the little gear in the lower left, pick settings, then search for \"auto\", you can change the autosave options to be \"infocus\" (instead of off) and that will make sure your code is always saved\n",
326328
"\n",
327329
"If you hand in a file without doing this we will deduct points (the little numbers to the left of the first cell should be 1 and all cells executed)\n",
328330
"\n",
329331
"- Make sure the file has saved (there is no little black dot to the right of the file name in the top bar)\n",
330332
"- Submit this .ipynb file to Gradescope. Do NOT submit the tutorial files - Gradescope expects 1, and only 1, file with an .ipynb extension.\n",
333+
"- if you right click on the file name and pick \"reveal in finder/explorer\" that will bring up the file in the file viewer (sometimes dragging from VSCode doesn't work)\n",
331334
"- Go get a cup of coffee (or tea or whatever). Come back and check that your autograder score is 5/5\n",
332335
"\n",
333336
"If the Gradescope autograder fails (you did not get 5/5 and you know everything worked), please check here first for common reasons for it to fail\n",

‎Week_0_python/a_start_here_libraries.ipynb‎

Lines changed: 104 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,106 @@
11
{
2-
"cells": [
3-
{
4-
"cell_type": "markdown",
5-
"metadata": {},
6-
"source": [
7-
"## Ensuring the libararies are installed correctly\n",
8-
"\n",
9-
"Use this JN to check that all your libraries are installed correctly, and to install any that are not.\n",
10-
"\n",
11-
"First thing to note: See the \"Select Kernel\" in the upper-right hand corner? This needs to be set to the Python version you setup in the instructions:\n",
12-
"\n",
13-
"https://docs.google.com/document/d/1Cp4uuRHMWHfKTAbYAV14y2tMWslmj_-bv_xo3CxYGAo/edit?usp=sharing\n",
14-
"\n",
15-
"Presumably, if you are reading this, than you have already set up VSCode and done the library installs in the above document. \n",
16-
"\n",
17-
"Note: If you are using this file to \"fix\" library problems, first make sure that whatever you've selected in \"Select Kernel\" is the same for both JNs. \n"
18-
]
19-
},
20-
{
21-
"cell_type": "code",
22-
"execution_count": null,
23-
"metadata": {},
24-
"outputs": [],
25-
"source": [
26-
"# These are all the imports you'll need in the class; if you get a \"library not found\" then see the following cells for installing them\n",
27-
"\n",
28-
"# Note: You may get a pop-up that says \"ipykernel needed, install y/n\". Say yes. That's the library that lets you run cells in a JN.\n",
29-
"# For Mac users with Apple silicon: That install will likely Fail - you will need to follow the instructions to over-ride the\n",
30-
"# system checks (at least as-of spring 2025). Go back to the install doc (above) and follow the instructions for how to do that.\n",
31-
"# If you've already done it, then chances are that when you did Select Kernel you did not pick the same kernel as the one you\n",
32-
"# did the homebrew install with. Double check that they are the same by typing \"python3 --version\" into a terminal - that one\n",
33-
"# should be the same as the one you picked for Select Kernel\n",
34-
"import otter\n",
35-
"import numpy\n",
36-
"import matplotlib\n",
37-
"import scipy\n",
38-
"import json"
39-
]
40-
},
41-
{
42-
"cell_type": "markdown",
43-
"metadata": {},
44-
"source": [
45-
"If all of the above imports worked, then you're done! If not, you can use the following cell to force-install the missing libraries\n",
46-
"\n",
47-
"This may take awhile, btw"
48-
]
49-
},
50-
{
51-
"cell_type": "code",
52-
"execution_count": null,
53-
"metadata": {},
54-
"outputs": [],
55-
"source": [
56-
"import sys\n",
57-
"!{sys.executable} -m pip install otter-grader\n",
58-
"!{sys.executable} -m pip install numpy\n",
59-
"!{sys.executable} -m pip install matplotlib\n",
60-
"!{sys.executable} -m pip install scipy\n",
61-
"!{sys.executable} -m pip install json"
62-
]
63-
}
64-
],
65-
"metadata": {
66-
"kernelspec": {
67-
"display_name": "base",
68-
"language": "python",
69-
"name": "python3"
70-
},
71-
"language_info": {
72-
"codemirror_mode": {
73-
"name": "ipython",
74-
"version": 3
75-
},
76-
"file_extension": ".py",
77-
"mimetype": "text/x-python",
78-
"name": "python",
79-
"nbconvert_exporter": "python",
80-
"pygments_lexer": "ipython3",
81-
"version": "3.11.7"
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"## Ensuring the libararies are installed correctly\n",
8+
"\n",
9+
"Use this JN to check that all your libraries are installed correctly, and to install any that are not.\n",
10+
"\n",
11+
"First thing to note: See the \"Select Kernel\" in the upper-right hand corner? This needs to be set to the Python version you setup in the instructions:\n",
12+
"\n",
13+
"https://docs.google.com/document/d/1Cp4uuRHMWHfKTAbYAV14y2tMWslmj_-bv_xo3CxYGAo/edit?usp=sharing\n",
14+
"\n",
15+
"Presumably, if you are reading this, than you have already set up VSCode and done the library installs in the above document. \n",
16+
"\n",
17+
"Note: If you are using this file to \"fix\" library problems, first make sure that whatever you've selected in \"Select Kernel\" is the same for both JNs. \n"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"# These are all the imports you'll need in the class; if you get a \"library not found\" then see the following cells for installing them\n",
27+
"\n",
28+
"# Note: If you get a pop-up that says \"ipykernel needed, install y/n\" and you've run either the windows_install.bat or mac_install.sh,\n",
29+
"# chances are the problem is actually that you opened the wrong folder. If you look in the upper left it should say Intro or ROB456 or ROB514\n",
30+
"# - it should not say GIT. \n",
31+
"# If you have not run the installs, do so - but you can also just say yes and then do the cell below.\n",
32+
"import otter\n",
33+
"import numpy as np\n",
34+
"import matplotlib.pyplot as plt\n",
35+
"import scipy\n",
36+
"import json\n",
37+
"\n",
38+
"print(np.__version__)"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"If all of the above imports worked, then you're done! If not, you can use the following cell to force-install the missing libraries\n",
46+
"\n",
47+
"This may take awhile, btw"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"import sys\n",
57+
"!{sys.executable} -m pip install otter-grader\n",
58+
"!{sys.executable} -m pip install numpy\n",
59+
"!{sys.executable} -m pip install matplotlib\n",
60+
"!{sys.executable} -m pip install scipy\n",
61+
"!{sys.executable} -m pip install json"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": null,
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"import sys\n",
71+
"!{sys.executable} -m pip install --upgrade otter-grader\n",
72+
"!{sys.executable} -m pip install --upgrade numpy\n",
73+
"!{sys.executable} -m pip install --upgrade matplotlib\n",
74+
"!{sys.executable} -m pip install --upgrade scipy\n"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
82+
"source": []
83+
}
84+
],
85+
"metadata": {
86+
"kernelspec": {
87+
"display_name": "base",
88+
"language": "python",
89+
"name": "python3"
90+
},
91+
"language_info": {
92+
"codemirror_mode": {
93+
"name": "ipython",
94+
"version": 3
95+
},
96+
"file_extension": ".py",
97+
"mimetype": "text/x-python",
98+
"name": "python",
99+
"nbconvert_exporter": "python",
100+
"pygments_lexer": "ipython3",
101+
"version": "3.12.4"
102+
}
103+
},
104+
"nbformat": 4,
105+
"nbformat_minor": 2
82106
}
83-
},
84-
"nbformat": 4,
85-
"nbformat_minor": 2
86-
}

‎Week_10_calculus/a_tutorial_integration.ipynb‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@
4949
"cell_type": "markdown",
5050
"metadata": {},
5151
"source": [
52-
"# Trapz example\n",
52+
"# Trapezoid example\n",
5353
"\n",
54-
"In this example, we \"manually\" chop of the function ourselves, and pass the samples to trapz to do the calculation.\n",
54+
"In this example, we \"manually\" chop of the function ourselves, and pass the samples to trapezoid to do the calculation.\n",
5555
"\n",
5656
"Find the area under the curve from x = a to x = b\n",
5757
"\n",
58-
"**trapz** wants either a **dx** value (spacing between the samples) OR actual **x** values (useful if the x values are not evenly spaced)\n",
58+
"**trapezoid** (was trapz) wants either a **dx** value (spacing between the samples) OR actual **x** values (useful if the x values are not evenly spaced)\n",
5959
"\n",
60-
"So pick some **x** values, evaluate the function at those **x** values **y = f(x)**, then send both the **y** and **x** values to **trapz** (note that **trapz** takes the **y** values then the **x** OR **d** values)\n",
60+
"So pick some **x** values, evaluate the function at those **x** values **y = f(x)**, then send both the **y** and **x** values to **trapezoid** (note that **trapezoid** takes the **y** values then the **x** OR **d** values)\n",
6161
"\n",
6262
"GUIDE Change the integration limits - what do you get when the curve crosses the y=0 line?\n",
6363
"\n",
@@ -79,8 +79,8 @@
7979
"# Evaluate function\n",
8080
"ys = my_func(xs)\n",
8181
"\n",
82-
"# Use trapz to get area - notice that y and x are swapped\n",
83-
"area_under_curve = np.trapz(ys, xs)\n"
82+
"# Use trapezoid to get area - notice that y and x are swapped\n",
83+
"area_under_curve = np.trapezoid(ys, xs)\n"
8484
]
8585
},
8686
{
@@ -110,7 +110,7 @@
110110
"axs.legend()\n",
111111
"axs.axis('equal')\n",
112112
"\n",
113-
"axs.set_title(f\"Area under curve: box is {(b-a) * np.max(ys)}, trapz {area_under_curve:0.4f}\")"
113+
"axs.set_title(f\"Area under curve: box is {(b-a) * np.max(ys)}, trapezoid {area_under_curve:0.4f}\")"
114114
]
115115
},
116116
{
@@ -119,7 +119,7 @@
119119
"source": [
120120
"# Quad example\n",
121121
"\n",
122-
"In this example, we pass the function itself in and let the **quad** function decide how many samples to use. This is, in general, better than **trapz**, because **quad** tries to find a balance between number of samples and accuracy.\n",
122+
"In this example, we pass the function itself in and let the **quad** function decide how many samples to use. This is, in general, better than **trapezoid**, because **quad** tries to find a balance between number of samples and accuracy.\n",
123123
"\n",
124124
"Find the area under the curve from **x = a** to **x = b**\n",
125125
"\n",
@@ -286,7 +286,7 @@
286286
],
287287
"metadata": {
288288
"kernelspec": {
289-
"display_name": "Python 3",
289+
"display_name": "base",
290290
"language": "python",
291291
"name": "python3"
292292
},
@@ -300,7 +300,7 @@
300300
"name": "python",
301301
"nbconvert_exporter": "python",
302302
"pygments_lexer": "ipython3",
303-
"version": "3.13.1"
303+
"version": "3.12.4"
304304
}
305305
},
306306
"nbformat": 4,

0 commit comments

Comments
 (0)