#!/usr/bin/env python # coding: utf-8 # $$u_t + \nabla \cdot \mathbf{F} = 0$$ # $$g(t) = u(x(t), y(t), t) \Longrightarrow 0 \equiv g'(t) = u_x x'(t) + u_y y'(t) + u_t$$ # $$\mathbf{F} = u \left[ \begin{array}{c} \beta_0 \\ \beta_1 \end{array}\right] # \Longrightarrow \nabla \cdot \mathbf{F} = \left(\beta_0 u\right)_x + # \left(\beta_1 u\right)_y \stackrel{?}{=} x'(t) u_x + y'(t) u_y$$ # $$x'(t) = \beta_0(y), \; y'(t) = \beta_1(x)$$ # $$\left[ \begin{array}{c} x'(t) \\ y'(t) \end{array}\right] = \left[ \begin{array}{c} \beta_0(y) \\ \beta_1(x) \end{array}\right]$$ # $$\left[ \begin{array}{c} x'(t) \\ y'(t) \end{array}\right] = \left[ \begin{array}{c} a \\ b \end{array}\right] \Longrightarrow \left[ \begin{array}{c} x(t) \\ y(t) \end{array}\right] = \left[ \begin{array}{c} x(0) \\ y(0) \end{array}\right] + t \left[ \begin{array}{c} a \\ b \end{array}\right]$$ # In[2]: get_ipython().run_line_magic('matplotlib', 'inline') from JSAnimation import IPython_display import matplotlib.animation from for_slides import example1 args, kwargs = example1() matplotlib.animation.FuncAnimation(*args, **kwargs) # $$\left[ \begin{array}{c} x'(t) \\ y'(t) \end{array}\right] = \left[ \begin{array}{c} -y \\ x \end{array}\right] \Longrightarrow \left[ \begin{array}{c} x(t) \\ y(t) \end{array}\right] = \left[ \begin{array}{c c} \cos t & - \sin t \\ \sin t & \cos t \end{array}\right] \left[ \begin{array}{c} x(0) \\ y(0) \end{array}\right]$$ # In[3]: from for_slides import example2 args, kwargs = example2() matplotlib.animation.FuncAnimation(*args, **kwargs) # In[4]: from for_slides import example4 example4() # In[5]: from for_slides import example5 example5() # $$\left.u\right|_{T_1} = f_1, \quad \left.u\right|_{T_6} = f_6, \quad \ldots$$ # $u "=" v$ when $$\int_{T} u \, \varphi \, dV = \int_T v \, \varphi \, dV$$ # # Galerkin projection # $$u = \sum_j u_j \varphi_j$$ # $$\int_{T} u \, \varphi_i \, dV = \int_{T \cap T_1} f_1 \, \varphi_i \, dV + \int_{T \cap T_6} f_6 \, \varphi_i \, dV + \cdots$$ # In[6]: from for_slides import example6 example6() # $$T \cap T_{28} = Q = D_1 \cup D_2$$ # $$\int_{T \cap T_{28}} f_{28} \, \varphi_i \, dV = \int_{D_1} f_{28} \, \varphi_i \, dV + \int_{D_2} f_{28} \, \varphi_i \, dV$$ # # DG or CG? # In[7]: from for_slides import example6a example6a() # In[8]: from for_slides import example7 example7() # In[9]: from for_slides import example8 example8() # In[10]: from for_slides import example9 example9() # # Thanks! # In[1]: # Custom styling, borrowed from https://github.com/ellisonbg/talk-2013-scipy from IPython import display # Make plots centered. H/T to http://stackoverflow.com/a/27168595/1068170 STYLE = """\ """ SLIDES_STYLE = """ """ STYLE = STYLE + '\n' + SLIDES_STYLE display.display(display.HTML(STYLE))