You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 28c700f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Week_0_python/Intro_assignment.ipynb
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -294,7 +294,7 @@
294
294
"\n",
295
295
"# List of names (creates a set)\n",
296
296
"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",
298
298
"websites = {\"not filled out\"}\n",
299
299
"# Approximate number of hours, including lab/in-class time\n",
300
300
"hours = -1.5"
@@ -323,11 +323,14 @@
323
323
"- Hit clear all outputs (this removes all the outputs)\n",
324
324
"- Hit Restart (say yes when it asks if it's ok to blow everything away)\n",
325
325
"- 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",
326
328
"\n",
327
329
"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",
328
330
"\n",
329
331
"- Make sure the file has saved (there is no little black dot to the right of the file name in the top bar)\n",
330
332
"- 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",
331
334
"- Go get a cup of coffee (or tea or whatever). Come back and check that your autograder score is 5/5\n",
332
335
"\n",
333
336
"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",
"## 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",
"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",
"## 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",
"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",
Copy file name to clipboardExpand all lines: Week_10_calculus/a_tutorial_integration.ipynb
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -49,15 +49,15 @@
49
49
"cell_type": "markdown",
50
50
"metadata": {},
51
51
"source": [
52
-
"# Trapz example\n",
52
+
"# Trapezoid example\n",
53
53
"\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",
55
55
"\n",
56
56
"Find the area under the curve from x = a to x = b\n",
57
57
"\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",
59
59
"\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",
61
61
"\n",
62
62
"GUIDE Change the integration limits - what do you get when the curve crosses the y=0 line?\n",
63
63
"\n",
@@ -79,8 +79,8 @@
79
79
"# Evaluate function\n",
80
80
"ys = my_func(xs)\n",
81
81
"\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"
84
84
]
85
85
},
86
86
{
@@ -110,7 +110,7 @@
110
110
"axs.legend()\n",
111
111
"axs.axis('equal')\n",
112
112
"\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}\")"
114
114
]
115
115
},
116
116
{
@@ -119,7 +119,7 @@
119
119
"source": [
120
120
"# Quad example\n",
121
121
"\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",
123
123
"\n",
124
124
"Find the area under the curve from **x = a** to **x = b**\n",
0 commit comments