Skip to content

Commit 23bb142

Browse files
committed
Remove line-returns to fix equations
1 parent 596f10c commit 23bb142

File tree

3 files changed

+151
-113
lines changed

3 files changed

+151
-113
lines changed

lessons/09_Lesson09_flowOverCylinder.ipynb

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,9 @@
294294
"\n",
295295
"which leads to\n",
296296
"\n",
297-
"$$0 = U_\\infty \\cos\\beta_i + \\sum_{j=1}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\n",
298-
"\\left(x_{c_i}-x_j(s_j)\\right) \\frac{\\partial x_{c_i}}{\\partial n_i}\n",
299-
"+ \\left(y_{c_i}-y_j(s_j)\\right) \\frac{\\partial y_{c_i}}{\\partial n_i}\n",
300-
"}\n",
301-
"{\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j$$\n",
297+
"$$\n",
298+
"0 = U_\\infty \\cos\\beta_i + \\sum_{j=1}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\\left(x_{c_i}-x_j(s_j)\\right) \\frac{\\partial x_{c_i}}{\\partial n_i} + \\left(y_{c_i}-y_j(s_j)\\right) \\frac{\\partial y_{c_i}}{\\partial n_i}} {\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j\n",
299+
"$$\n",
302300
"\n",
303301
"where $\\beta_i$ is the angle that the panel's normal makes with the $x$-axis, so\n",
304302
"\n",
@@ -313,11 +311,9 @@
313311
"\n",
314312
"Finally, the boundary condition at the center point of the $i$-th panel gives\n",
315313
"\n",
316-
"$$0 = U_\\infty \\cos\\beta_i + \\frac{\\sigma_i}{2} + \\sum_{j=1,j\\neq i}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\n",
317-
"\\left(x_{c_i}-x_j(s_j)\\right) \\cos\\beta_i\n",
318-
"+ \\left(y_{c_i}-y_j(s_j)\\right) \\sin\\beta_i\n",
319-
"}\n",
320-
"{\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j$$\n",
314+
"$$\n",
315+
"0 = U_\\infty \\cos\\beta_i + \\frac{\\sigma_i}{2} + \\sum_{j=1,j\\neq i}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\\left(x_{c_i}-x_j(s_j)\\right) \\cos\\beta_i + \\left(y_{c_i}-y_j(s_j)\\right) \\sin\\beta_i} {\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j\n",
316+
"$$\n",
321317
"\n",
322318
"From the equation above, we understand that we will have to compute integrals using the SciPy function `integrate.quad()`. We define a function `integral_normal()` that will do the job."
323319
]
@@ -371,16 +367,14 @@
371367
"\n",
372368
"where\n",
373369
"\n",
374-
"$$A_{ij} = \\begin{cases}\n",
370+
"$$\n",
371+
"A_{ij} = \\begin{cases}\n",
375372
"\\begin{matrix}\n",
376373
"\\frac{1}{2} & \\mbox{, if } i=j \\cr\n",
377-
"\\frac{1}{2\\pi} \\int \\frac{\n",
378-
"\\left(x_{c_i}-x_j(s_j)\\right) \\cos\\beta_i\n",
379-
"+ \\left(y_{c_i}-y_j(s_j)\\right) \\sin\\beta_i\n",
380-
"}\n",
381-
"{\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} ds_j & \\mbox{, if } i\\neq j\n",
374+
"\\frac{1}{2\\pi} \\int \\frac{\\left(x_{c_i}-x_j(s_j)\\right) \\cos\\beta_i + \\left(y_{c_i}-y_j(s_j)\\right) \\sin\\beta_i} {\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} ds_j & \\mbox{, if } i\\neq j\n",
382375
"\\end{matrix}\n",
383-
"\\end{cases}$$\n",
376+
"\\end{cases}\n",
377+
"$$\n",
384378
"\n",
385379
"and\n",
386380
"\n",
@@ -462,11 +456,9 @@
462456
"\n",
463457
"which we can obtain as:\n",
464458
"\n",
465-
"$$u_{t_i} = -U_\\infty \\sin\\beta_i + \\sum_{j=1}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\n",
466-
"\\left(x_{c_i}-x_j(s_j)\\right) \\frac{\\partial x_{c_i}}{\\partial t_i}\n",
467-
"+ \\left(y_{c_i}-y_j(s_j)\\right) \\frac{\\partial y_{c_i}}{\\partial t_i}\n",
468-
"}\n",
469-
"{\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j$$\n",
459+
"$$\n",
460+
"u_{t_i} = -U_\\infty \\sin\\beta_i + \\sum_{j=1}^{N_p} \\frac{\\sigma_j}{2\\pi} \\int \\frac{\\left(x_{c_i}-x_j(s_j)\\right) \\frac{\\partial x_{c_i}}{\\partial t_i} + \\left(y_{c_i}-y_j(s_j)\\right) \\frac{\\partial y_{c_i}}{\\partial t_i}} {\\left(x_{c_i}-x_j(s)\\right)^2 + \\left(y_{c_i}-y_j(s)\\right)^2} {\\rm d}s_j\n",
461+
"$$\n",
470462
"\n",
471463
"with\n",
472464
"\n",
@@ -844,7 +836,7 @@
844836
"name": "python",
845837
"nbconvert_exporter": "python",
846838
"pygments_lexer": "ipython3",
847-
"version": "3.6.3"
839+
"version": "3.6.1"
848840
}
849841
},
850842
"nbformat": 4,

lessons/11_Lesson11_Exercise.ipynb

Lines changed: 74 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28+
"$$\n",
2829
"\\begin{equation}\n",
2930
"\\begin{split}\n",
3031
"\\phi(x, y) \n",
3132
"&= \\phi_{uniform\\ flow}(x, y) \\\\ \n",
3233
"&+ \\phi_{source\\ sheet}(x, y) + \\phi_{vortex\\ sheet}(x, y)\n",
3334
"\\end{split}\n",
34-
"\\end{equation}"
35+
"\\end{equation}\n",
36+
"$$"
3537
]
3638
},
3739
{
@@ -45,6 +47,7 @@
4547
"cell_type": "markdown",
4648
"metadata": {},
4749
"source": [
50+
"$$\n",
4851
"\\begin{equation}\n",
4952
"\\begin{split}\n",
5053
"\\phi(x, y) &= xU_{\\infty}\\cos(\\alpha) + yU_{\\infty}\\sin(\\alpha) \\\\\n",
@@ -53,7 +56,8 @@
5356
"&-\n",
5457
"\\frac{1}{2\\pi} \\int_{sheet} \\gamma(s)\\tan^{-1} \\frac{y-\\eta(s)}{x-\\xi(s)}ds\n",
5558
"\\end{split}\n",
56-
"\\end{equation}"
59+
"\\end{equation}\n",
60+
"$$"
5761
]
5862
},
5963
{
@@ -83,6 +87,7 @@
8387
"source": [
8488
"If we discretize the sheet into $N$ panels, re-write the above equation using discretized integral. Assume $l_j$ represents the length of the panel $j$. And so that\n",
8589
"\n",
90+
"$$\n",
8691
"\\begin{equation}\n",
8792
"\\left\\{\n",
8893
"\\begin{array}{l}\n",
@@ -93,14 +98,18 @@
9398
"0\\le s \\le l_j\n",
9499
"\\right.\n",
95100
"\\end{equation}\n",
101+
"$$\n",
96102
"\n",
97103
"The following figure shows the panel $j$:\n",
98104
"\n",
99105
"<center> <img src=\"resources/Lesson11_Exercise_Fig.1.png\" width=360> </center>\n",
100106
"\n",
101-
"HINT: for example, consider the integral $\\int_0^L f(x) dx$, if we discretize the domain $0\\sim L$ into 3 panels, the integral can be writen as: \n",
102-
"$$\\int_0^L f(x) dx = \\int_0^{L/3} f(x)dx+\\int_{L/3}^{2L/3} f(x)dx+\\int_{2L/3}^{L} f(x)dx \\\\= \n",
103-
"\\sum_{j=1}^3 \\int_{l_j}f(x)dx$$"
107+
"HINT: for example, consider the integral $\\int_0^L f(x) dx$, if we discretize the domain $0\\sim L$ into 3 panels, the integral can be writen as:\n",
108+
"\n",
109+
"$$\n",
110+
"\\int_0^L f(x) dx = \\int_0^{L/3} f(x)dx+\\int_{L/3}^{2L/3} f(x)dx+\\int_{2L/3}^{L} f(x)dx \\\\\n",
111+
"= \\sum_{j=1}^3 \\int_{l_j}f(x)dx\n",
112+
"$$"
104113
]
105114
},
106115
{
@@ -159,6 +168,7 @@
159168
"cell_type": "markdown",
160169
"metadata": {},
161170
"source": [
171+
"$$\n",
162172
"\\begin{equation}\n",
163173
"\\begin{split}\n",
164174
"U_n &= \\frac{\\partial \\phi}{\\partial \\vec{n}} \\\\\n",
@@ -175,7 +185,8 @@
175185
"+\n",
176186
"\\frac{\\partial \\phi}{\\partial y}n_y\n",
177187
"\\end{split}\n",
178-
"\\end{equation}"
188+
"\\end{equation}\n",
189+
"$$"
179190
]
180191
},
181192
{
@@ -189,14 +200,16 @@
189200
"cell_type": "markdown",
190201
"metadata": {},
191202
"source": [
203+
"$$\n",
192204
"\\begin{equation}\n",
193205
"\\left\\{\n",
194206
"\\begin{array}{l}\n",
195207
"U_n(x, y)=\\frac{\\partial \\phi}{\\partial x}(x, y) n_x(x, y)+\\frac{\\partial \\phi}{\\partial y}(x, y) n_y(x, y) \\\\\n",
196208
"U_t(x, y)=\\frac{\\partial \\phi}{\\partial x}(x, y) t_x(x, y)+\\frac{\\partial \\phi}{\\partial y}(x, y) t_y(x, y)\n",
197209
"\\end{array}\n",
198210
"\\right.\n",
199-
"\\end{equation}"
211+
"\\end{equation}\n",
212+
"$$"
200213
]
201214
},
202215
{
@@ -245,42 +258,30 @@
245258
"cell_type": "markdown",
246259
"metadata": {},
247260
"source": [
261+
"$$\n",
248262
"\\begin{equation}\n",
249263
"\\begin{split}\n",
250264
"U_n(x_{c,i}, y_{c,i}) &= U_{n,i} \\\\\n",
251-
"&=\n",
252-
"b^n_i \n",
253-
"+ \n",
254-
"\\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN}\\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\end{matrix}\\right]\n",
255-
"+\n",
256-
"\\left(\\sum_{j=1}^N B^n_{ij}\\right)\\gamma \\\\\n",
257-
"&=\n",
258-
"b^n_i \n",
259-
"+ \n",
260-
"\\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right]\n",
265+
"&= b^n_i + \\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN}\\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\end{matrix}\\right] + \\left(\\sum_{j=1}^N B^n_{ij}\\right)\\gamma \\\\\n",
266+
"&= b^n_i + \\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right]\n",
261267
"\\end{split}\n",
262-
"\\end{equation}"
268+
"\\end{equation}\n",
269+
"$$"
263270
]
264271
},
265272
{
266273
"cell_type": "markdown",
267274
"metadata": {},
268275
"source": [
276+
"$$\n",
269277
"\\begin{equation}\n",
270278
"\\begin{split}\n",
271279
"U_t(x_{c,i}, y_{c,i}) &= U_{t,i} \\\\\n",
272-
"&=\n",
273-
"b^t_i \n",
274-
"+ \n",
275-
"\\left[\\begin{matrix} A^t_{i1} && A^t_{i2} && ... && A^t_{iN}\\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\end{matrix}\\right]\n",
276-
"+\n",
277-
"\\left(\\sum_{j=1}^N B^t_{ij}\\right)\\gamma \\\\\n",
278-
"&=\n",
279-
"b^t_i \n",
280-
"+ \n",
281-
"\\left[\\begin{matrix} A^t_{i1} && A^t_{i2} && ... && A^t_{iN} && \\left(\\sum_{j=1}^N B^t_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right]\n",
280+
"&= b^t_i + \\left[\\begin{matrix} A^t_{i1} && A^t_{i2} && ... && A^t_{iN}\\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\end{matrix}\\right] + \\left(\\sum_{j=1}^N B^t_{ij}\\right)\\gamma \\\\\n",
281+
"&= b^t_i + \\left[\\begin{matrix} A^t_{i1} && A^t_{i2} && ... && A^t_{iN} && \\left(\\sum_{j=1}^N B^t_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right]\n",
282282
"\\end{split}\n",
283-
"\\end{equation}"
283+
"\\end{equation}\n",
284+
"$$"
284285
]
285286
},
286287
{
@@ -303,12 +304,15 @@
303304
"source": [
304305
"Given the fact that (from the Fig. 1) \n",
305306
"\n",
307+
"$$\n",
306308
"\\begin{equation}\n",
307309
"\\left\\{\\begin{matrix} \\vec{n}_i=n_{x,i}\\vec{i}+n_{y,i}\\vec{j} = \\cos(\\beta_i)\\vec{i}+\\sin(\\beta_i)\\vec{j} \\\\ \\vec{t}_i=t_{x,i}\\vec{i}+t_{y,i}\\vec{j} = -\\sin(\\beta_i)\\vec{i}+\\cos(\\beta_i)\\vec{j} \\end{matrix}\\right.\n",
308310
"\\end{equation}\n",
311+
"$$\n",
309312
"\n",
310313
"we have\n",
311314
"\n",
315+
"$$\n",
312316
"\\begin{equation}\n",
313317
"\\left\\{\n",
314318
"\\begin{matrix}\n",
@@ -323,7 +327,8 @@
323327
"t_{y,i}=n_{x,i}\n",
324328
"\\end{matrix}\n",
325329
"\\right.\n",
326-
"\\end{equation}"
330+
"\\end{equation}\n",
331+
"$$"
327332
]
328333
},
329334
{
@@ -395,28 +400,26 @@
395400
"source": [
396401
"In our problem, there are $N+1$ unknowns, that is, $\\sigma_1, \\sigma_2, ..., \\sigma_N, \\gamma$. We'll need $N+1$ linear equations to solve the unknowns. The first $N$ linear equations can be obtained from the non-penetration condition on the center of each panel. That is\n",
397402
"\n",
403+
"$$\n",
398404
"\\begin{equation}\n",
399405
"\\begin{split}\n",
400406
"U_{n,i} &= 0 \\\\\n",
401-
"&=\n",
402-
"b^n_i \n",
403-
"+ \n",
404-
"\\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right] \\\\\n",
405-
"&,\\ \\ for\\ \n",
406-
"i=1\\sim N\n",
407+
"&= b^n_i + \\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right] \\\\\n",
408+
"&,\\ \\ for\\ i=1\\sim N\n",
407409
"\\end{split}\n",
408410
"\\end{equation}\n",
411+
"$$\n",
409412
"\n",
410413
"or\n",
411414
"\n",
415+
"$$\n",
412416
"\\begin{equation}\n",
413417
"\\begin{split}\n",
414-
"&\\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right]\n",
415-
"=-b^n_i \\\\\n",
416-
"&,\\ \\ for\\ \n",
417-
"i=1\\sim N\n",
418+
"&\\left[\\begin{matrix} A^n_{i1} && A^n_{i2} && ... && A^n_{iN} && \\left(\\sum_{j=1}^N B^n_{ij}\\right) \\end{matrix}\\right]\\left[\\begin{matrix} \\sigma_1 \\\\ \\sigma_2 \\\\ \\vdots \\\\ \\sigma_N \\\\ \\gamma \\end{matrix}\\right] =-b^n_i \\\\\n",
419+
"&,\\ \\ for\\ i=1\\sim N\n",
418420
"\\end{split}\n",
419-
"\\end{equation}"
421+
"\\end{equation}\n",
422+
"$$"
420423
]
421424
},
422425
{
@@ -425,9 +428,11 @@
425428
"source": [
426429
"For the last equation, we use Kutta-condition to obtain that.\n",
427430
"\n",
431+
"$$\n",
428432
"\\begin{equation}\n",
429433
"U_{t,1} = - U_{t,N}\n",
430-
"\\end{equation}"
434+
"\\end{equation}\n",
435+
"$$"
431436
]
432437
},
433438
{
@@ -574,20 +579,21 @@
574579
" margin-bottom: 0.5em;\n",
575580
" margin-top: 0.5em;\n",
576581
" display: block;\n",
577-
"}\t\n",
582+
"}\n",
583+
"\n",
578584
".text_cell_render h2 {\n",
579585
" font-family: 'Fenix', serif;\n",
580586
" font-size: 22pt;\n",
581587
" line-height: 100%;\n",
582588
" margin-bottom: 0.1em;\n",
583589
" margin-top: 0.3em;\n",
584590
" display: block;\n",
585-
"}\t\n",
591+
"}\n",
586592
"\n",
587593
".text_cell_render h3 {\n",
588594
" font-family: 'Fenix', serif;\n",
589595
" margin-top:12px;\n",
590-
"\tfont-size: 16pt;\n",
596+
" font-size: 16pt;\n",
591597
" margin-bottom: 3px;\n",
592598
" font-style: regular;\n",
593599
"}\n",
@@ -622,34 +628,36 @@
622628
" margin-top: 1px;\n",
623629
"}\n",
624630
"\n",
625-
" .CodeMirror{\n",
626-
" font-family: \"Source Code Pro\";\n",
627-
"\t\t\tfont-size: 90%;\n",
631+
".CodeMirror{\n",
632+
" font-family: \"Source Code Pro\";\n",
633+
" font-size: 90%;\n",
634+
"}\n",
635+
"\n",
636+
".warning{\n",
637+
" color: rgb( 240, 20, 20 )\n",
628638
" }\n",
629-
"/* .prompt{\n",
630-
" display: None;\n",
631-
" }*/\n",
632-
"\t\n",
633-
" \n",
634-
" .warning{\n",
635-
" color: rgb( 240, 20, 20 )\n",
636-
" } \n",
637639
"</style>\n",
640+
"\n",
638641
"<script>\n",
639642
" MathJax.Hub.Config({\n",
640643
" TeX: {\n",
641644
" extensions: [\"AMSmath.js\"], \n",
642645
" equationNumbers: { autoNumber: \"AMS\", useLabelIds: true}\n",
643646
" },\n",
644-
" tex2jax: {\n",
645-
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
646-
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
647-
" },\n",
648-
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
649-
" \"HTML-CSS\": {\n",
650-
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
651-
" }\n",
652-
" });\n",
647+
" tex2jax: {\n",
648+
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
649+
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
650+
" },\n",
651+
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
652+
" \"HTML-CSS\": {\n",
653+
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
654+
" }\n",
655+
" });\n",
656+
" MathJax.Hub.Queue(\n",
657+
" [\"resetEquationNumbers\", MathJax.InputJax.TeX],\n",
658+
" [\"PreProcess\", MathJax.Hub],\n",
659+
" [\"Reprocess\", MathJax.Hub]\n",
660+
" );\n",
653661
"</script>\n"
654662
],
655663
"text/plain": [
@@ -686,7 +694,7 @@
686694
"name": "python",
687695
"nbconvert_exporter": "python",
688696
"pygments_lexer": "ipython3",
689-
"version": "3.6.3"
697+
"version": "3.6.1"
690698
}
691699
},
692700
"nbformat": 4,

0 commit comments

Comments
 (0)