Skip to content

Commit df65eac

Browse files
committed
more formatting
1 parent 32f1769 commit df65eac

1 file changed

Lines changed: 14 additions & 28 deletions

File tree

content/02-numpy/numpy-basics.ipynb

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"source": [
2121
"````{note}\n",
2222
" \n",
23-
"Note that the traditional way to import numpy is to rename it np. This saves on typing and makes your code a little more compact.\n",
23+
"Note that the traditional way to import numpy is to rename it `np`. This saves on typing and makes your code a little more compact.\n",
2424
"````"
2525
]
2626
},
@@ -205,13 +205,11 @@
205205
"cell_type": "markdown",
206206
"metadata": {},
207207
"source": [
208-
"<div class=\"alert alert-block alert-warning\">\n",
209-
" \n",
210-
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
208+
"````{admonition} Quick Exercise\n",
211209
"\n",
212210
"Analogous to `linspace()`, there is a `logspace()` function that creates an array with elements equally spaced in log. Use `help(np.logspace)` to see the arguments, and create an array with 10 elements from $10^{-6}$ to $10^3$.\n",
213211
"\n",
214-
"</div>"
212+
"````"
215213
]
216214
},
217215
{
@@ -303,13 +301,11 @@
303301
"cell_type": "markdown",
304302
"metadata": {},
305303
"source": [
306-
"<div class=\"alert alert-block alert-warning\">\n",
307-
" \n",
308-
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
304+
"````{admonition} Quick Exercise\n",
309305
"\n",
310306
"What do you think `1./a` will do? Try it and see\n",
311307
"\n",
312-
"</div>"
308+
"````"
313309
]
314310
},
315311
{
@@ -372,13 +368,11 @@
372368
"cell_type": "markdown",
373369
"metadata": {},
374370
"source": [
375-
"<div class=\"alert alert-block alert-warning\">\n",
376-
" \n",
377-
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
371+
"````{admonition} Quick Exercise\n",
378372
"\n",
379373
"`sum()` takes an optional argument, `axis=N`, where `N` is the axis to sum over. Sum the elements of `a` across rows to create an array with just the sum along each column of `a`.\n",
380374
"\n",
381-
"</div>"
375+
"````"
382376
]
383377
},
384378
{
@@ -460,16 +454,14 @@
460454
"cell_type": "markdown",
461455
"metadata": {},
462456
"source": [
463-
"<div class=\"alert alert-block alert-warning\">\n",
464-
" \n",
465-
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
457+
"````{admonition} Quick Exercise\n",
466458
"\n",
467459
"We will often want to write our own function that operates on an array and returns a new array. We can do this just like we did with functions previously&mdash;the key is to use the methods from the `np` module to do any operations, since they work on, and return, arrays.\n",
468460
"\n",
469461
"Write a simple function that returns $\\sin(2\\pi x)$ for an input array `x`. Then test it \n",
470462
"by passing in an array `x` that you create via `linspace()`\n",
471463
"\n",
472-
"</div>"
464+
"````"
473465
]
474466
},
475467
{
@@ -739,9 +731,7 @@
739731
"cell_type": "markdown",
740732
"metadata": {},
741733
"source": [
742-
"<div class=\"alert alert-block alert-warning\">\n",
743-
" \n",
744-
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
734+
"````{admonition} Quick Exercise\n",
745735
"\n",
746736
"Consider the array defined as:\n",
747737
"\n",
@@ -758,7 +748,7 @@
758748
" * using slice notation, create an array that consists of only the `4`'s in `q` (this will be called a _view_, as we'll see shortly)\n",
759749
" * zero out all of the elements in your view\n",
760750
" * how does `q` change?\n",
761-
"</dov> "
751+
"````"
762752
]
763753
},
764754
{
@@ -1205,6 +1195,7 @@
12051195
"metadata": {},
12061196
"source": [
12071197
"Now we want to construct a derivative, \n",
1198+
"\n",
12081199
"$$\n",
12091200
"\\frac{d f}{dx}\n",
12101201
"$$"
@@ -1225,9 +1216,11 @@
12251216
"metadata": {},
12261217
"source": [
12271218
"We want to do this without loops&mdash;we'll use views into arrays offset from one another. Recall from calculus that a derivative is approximately:\n",
1219+
"\n",
12281220
"$$\n",
12291221
"\\frac{df}{dx} = \\frac{f(x+h) - f(x)}{h}\n",
12301222
"$$\n",
1223+
"\n",
12311224
"Here, we'll take $h$ to be a single adjacent element"
12321225
]
12331226
},
@@ -1249,13 +1242,6 @@
12491242
"source": [
12501243
"dfdx"
12511244
]
1252-
},
1253-
{
1254-
"cell_type": "code",
1255-
"execution_count": null,
1256-
"metadata": {},
1257-
"outputs": [],
1258-
"source": []
12591245
}
12601246
],
12611247
"metadata": {

0 commit comments

Comments
 (0)