text:
\documentclass[a4paper,12pt]{article}
%\usepackage{latexsym}
%\usepackage[MeX]{polski}
%\usepackage[latin2]{inputenc}% ew. utf8 lub cp1250
\usepackage{enumitem}
%\usepackage{nopageno}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{xcolor}
\usepackage[square,sort&compress,comma,numbers]{natbib}
\usepackage{iopams}
\usepackage{amsmath}
\usepackage[ruled,vlined]{algorithm2e}
\newgeometry{tmargin=1.5cm, bmargin=1.5cm, lmargin=2.5cm, rmargin=2.5cm}
\newcommand{\rmd}{\mathrm{d}}
\bibliographystyle{sms}
% Zdefiniowanie autora i~tytułu:
\author{Piotr Fiborek}
%\date{}
\title{Numerical analysis of Guided Waves propagation in Honeycomb Sandwich Composites\\
(\textit{Analiza numeryczna propagacji fal prowadzonych w wielowarstwowych materia\l{}ach przek\l{}adkowych z rdzeniem o strukturze plastra miodu})}
\begin{document}
\maketitle
\thispagestyle{empty}
\section{Introduction}
\label{sec:intro}
Honeycomb Sandwich Composite~(HSC) is a type of multi-layered structure, which
is composed of the mid-core with the geometry of honeycomb sandwiched between
thin skins.
They are widely used in the aerospace, marine and automotive industries due to
the high strength-to-weight ratio, high energy absorption capability and
effective acoustic insulation. However, these complex structures are exposed to
a risk of different types of failures, e.g. hidden disbonds between the skin
and the core.

The most common numerical modelling of the phenomenon of GW in CHSP found in
the literature is a calculation of the effective material properties of the
honeycomb structure by the homogenisation process~\cite{qi2008ultrasonic,
mustapha2011assessment, baid2015dispersion, sikdar2016guided}.
However, this method is not able to adequately present the phenomenon of
propagation of elastic waves in such material.
A more accurate model will be achieved if the real geometry of the hexagonal
cell is retained.
Ruzzenne et al. conducted a parametric study through the finite element model
of the unit cell and the application of the theory of periodic structures
\cite{ruzzene2003wave}.
Recently, the simulations of the wave propagation in HSC have been conducted
with the commercially available finite element code~\cite{song2009guided,
hosseini2013numerical, tian2015wavenumber, zhao2018wave}.
However, finite element simulations (FEM) of GW are inefficient as they require
significant amounts of memory and are time-consuming.

This paper presents a new model of propagating GW in HSC using the time-domain
spectral element method (SEM).
The SEM was originally developed for the numerical solution of the fluid flow
in a channel by Patera~\cite{patera1984spectral} but has also been successfully
implemented for elastic wave propagation~\cite{ostachowicz2011guided}.
SEM combines the flexibility of the FEM and accuracy of the techniques based on
Fourier transform.

In order to reduce a global number of degree of freedom (DOF) in the
simulation, skins, adhesive layers and each wall composing a hexagonal cell of
the core are modelled by two-dimensional (2D) spectral elements.
The displacements of the cell are calculated in the local coordinate system,
and then, through the transformation matrix, they are transformed into the
global coordinate system. Subsequently, the core is connected to the skin
plates so that displacements of common geometrical points of both elements are
the same in each direction of the main axes.
This type of connection is implemented by means of interface elements based on
Lagrange multipliers, which are interpreted as forces responsible for
determining the appropriate displacements of nodes.
By using the interface, it is possible to model skin plates with 2D elements.
This type of approach will reduce the number of degrees of freedom, which in
turn will shorten the calculation time and reduce the need for operational
memory.

Wave excitation was realised by the piezoelectric (PZT) transducer, which was
modelled by a three-dimensional (3D) spectral element with the
electromechanical coupling.
\section{The time-domain spectral element method formulation}
\label{sec:time_SEM}
\subsection{The spectral element method}
\label{sec:sem}
The idea of the SEM is similar to the FEM.
Both methods use a division of the modelled domain into finite elements.
Also, imposition of the arbitrary boundary conditions and external forces in
particular nodes is similar.
The main difference between those methods is a distribution of nodes in
elements and approximation function describing changes of displacements.
The element nodes in SEM are non-uniformly distributed, and they are obtained
as the roots of Eq.~(\ref{eq:nodes}).

\begin{eqnarray}
(1-\xi^2)P'_{p-1}(\xi)=0,\ (1-\eta^2)P'_{q-1}(\eta)=0,\ (1-\zeta^2)P'_{r-1}(\zeta)=0
	\label{eq:nodes}
\end{eqnarray}
where $\xi,\eta,\zeta\in[-1,1]$, $P_{p-1},P_{q-1}$ and $P_{r-1}$ are Legendre polynomials of degree (p-1), (q-1) and (r-1), respectively and symbol $'$ denotes the first derivative. 3D shape functions are constructed as a tensor product of the 1D shape functions $\textbf{N}_m(\xi)$, $\textbf{N}_n(\eta)$ and $\textbf{N}_l(\zeta)$ defined by the Lagrange interpolating polynomials of order $p-1$, $q-1$ and $r-1$, respectively.

The element matrices are obtained according to Gauss-Lobatto-Legrendre (GLL) integration scheme where the integration points coincide with the element nodes and associated weights ${w}_m$, ${w}_n$ and ${w}_l$ are computed as:
\begin{eqnarray}
{w}_m &=& \frac{2}{p(p-1)(P_{p-1}(\xi_m))^2},\nonumber\\
{w}_n &=& \frac{2}{q(q-1)(P_{q-1}(\eta_n))^2},\nonumber \\
{w}_l &=& \frac{2}{r(r-1)(P_{r-1}(\zeta_l))^2},
\label{eq:weights}
\end{eqnarray}
Due to utilised GLL integration scheme and the orthogonality of shape functions obtained mass matrix is diagonal.
\subsection{2D spectral element formulation}
\label{sec:2D_SEM}
2D spectral elements are formulated according to the first-order shear
deformation theory~\cite{reissner1945effect, mindlin1951influence} so that
three displacement components \textbf{u}, \textbf{v} and \textbf{w}, can be
expressed as:
\begin{eqnarray}
\left [ \begin{array}{c}
\textbf{u}^e(\xi,\eta,\zeta) \\
\textbf{v}^e(\xi,\eta,\zeta) \\
\textbf{w}^e(\xi,\eta,\zeta)
\end{array} \right] =
\left [ \begin{array}{c}
\textbf{u}_0^e(\xi,\eta) + z\boldsymbol{\varphi}_x^e(\xi,\eta)\\
\textbf{v}_0^e(\xi,\eta) + z\boldsymbol{\varphi}_y^e(\xi,\eta)\\
\textbf{w}_0^e(\xi,\eta) \\
\end{array} \right]
\end{eqnarray}
where $\textbf{u}_0^e$, $\textbf{v}_0^e$ and $\textbf{w}_0^e$ denote the
displacements of a point on the mid-plane, $\boldsymbol{\varphi}_x^e$,
$\boldsymbol{\varphi}_y^e$ are the rotations of the normal to the mid-plane
with respect to axes \textit{x} and \textit{y}, respectively.
\begin{eqnarray}
\left [ \begin{array}{c}
\textbf{u}_0^e(\xi,\eta) \\
\textbf{v}_0^e(\xi,\eta) \\
\textbf{w}_0^e(\xi,\eta) \\
\boldsymbol{\varphi}_x^e(\xi,\eta) \\
\boldsymbol{\varphi}_y^e(\xi,\eta)
\end{array} \right]
& = & \textbf{N}^e(\xi,\eta)\widehat{\textbf{d}}^e\nonumber\\
& = & \sum_{n=1}^q\sum_{m=1}^p\textbf{N}_m^e(\xi)\textbf{N}_n^e(\eta)
\left [ \begin{array}{c}
\widehat{\textbf{u}}_0^e \\
\widehat{\textbf{v}}_0^e \\
\widehat{\textbf{w}}_0^e \\
\widehat{\boldsymbol{\varphi}}_x^e \\
\widehat{\boldsymbol{\varphi}}_y^e
\end{array} \right]
\end{eqnarray}
The bending strain components can be written as~\cite{ferreira2008matlab}:
\begin{eqnarray}
\bepsilon_b^e(\xi,\eta)=\textbf{B}_b^e\widehat{\textbf{d}}^e
\end{eqnarray}
where $\textbf{B}_b^e$ is curvature-displacement matrix calculated as:
\begin{eqnarray}
\textbf{B}_b^e=\textbf{L}_b\textbf{N}^e(\xi,\eta)
\end{eqnarray}
\begin{eqnarray}
	\textbf{L}_b=\left [
	\begin{array}{ccccc}
		\frac{\partial }{\partial x} & 0 & 0 & 0 & 0\\
		0 & \frac{\partial }{\partial y} & 0 & 0 & 0\\
		\frac{\partial }{\partial y} & \frac{\partial }{\partial x} & 0 & 0 & 0\\
		0 & 0 & 0 & -\frac{\partial }{\partial x} & 0\\
		0 & 0 & 0 & 0 & -\frac{\partial }{\partial y}\\
		0 & 0 & 0 & -\frac{\partial }{\partial y} & -\frac{\partial }{\partial x}
	\end{array} \right],\ \\
  \left [
	\begin{array}{c}
		\frac{\partial }{\partial x}\\
		\frac{\partial }{\partial y}
	\end{array} \right] =\textbf{J}^{-1}
	\left [
	\begin{array}{c}
		\frac{\partial }{\partial \xi}\\
		\frac{\partial }{\partial \eta}
	\end{array} \right], \
	\textbf{J}=\left [
	\begin{array}{cc}
		\partial_\xi x & {\partial_\xi y} \\
		\partial_\eta x & {\partial_\eta y}
	\end{array} \right] \nonumber
\end{eqnarray}
The shear strain components can be written as~\cite{ferreira2008matlab}:
\begin{eqnarray}
\bepsilon_s^e(\xi,\eta)=\textbf{B}_s^e\widehat{\textbf{d}}^e
\end{eqnarray}
where $\textbf{B}_s^e$ is curvature-displacement matrix calculated as:
\begin{eqnarray}
\textbf{B}_s^e=\textbf{L}_s\textbf{N}^e(\xi,\eta)
\end{eqnarray}
\begin{eqnarray}
\textbf{L}_s=\left [
\begin{array}{ccccc}
0 & 0 & \frac{\partial }{\partial x} & -1 & 0 \\
0 & 0 & \frac{\partial }{\partial y} & 0 & -1
\end{array} \right]
\end{eqnarray}
\subsection{3D model of the PZT transducer}
\label{sec:3D_SEM}
The displacements of the PZT transducer are defined by three displacement components \textbf{u}, \textbf{v} and \textbf{w}, and can be express in a form:
\begin{eqnarray}
\left [ \begin{array}{c}
\textbf{u}^e(\xi,\eta,\zeta) \\
\textbf{v}^e(\xi,\eta,\zeta) \\
\textbf{w}^e(\xi,\eta,\zeta)
\end{array} \right]
& = & \textbf{N}^e(\xi,\eta, \zeta)\widehat{\textbf{d}}^e\nonumber\\
& = & \sum_{l=1}^r\sum_{n=1}^q\sum_{m=1}^p\textbf{N}_m^e(\xi)\textbf{N}_n^e(\eta)\textbf{N}_l^e(\zeta)
\left [ \begin{array}{c}
\widehat{\textbf{u}}^e(\xi_m,\eta_n,\zeta_l) \\
\widehat{\textbf{v}}^e(\xi_m,\eta_n,\zeta_l) \\
\widehat{\textbf{w}}^e(\xi_m,\eta_n,\zeta_l)
\end{array} \right]
\label{eq:3D_displ}
\end{eqnarray}
where $\widehat{\textbf{u}}^e$, $\widehat{\textbf{v}}^e$ and $\widehat{\textbf{w}}^e$ are nodal values.
Six components of the strain matrix are approximated as follow
\cite{kudela20093d}:
\begin{eqnarray}
\bepsilon^e(\xi,\eta,\zeta)=\textbf{B}_{d}^e\widehat{\textbf{d}}^e
\end{eqnarray}
where $\textbf{B}_{d}^e$ is strain-nodal displacement matrix calculated as:
\begin{eqnarray}
\textbf{B}_{d}^e=\textbf{L}\textbf{N}^e(\xi,\eta,\zeta)
\end{eqnarray}
\begin{eqnarray}
\textbf{L}=\left [
\begin{array}{ccc}
\frac{\partial }{\partial x} & 0 & 0\\
0 & \frac{\partial }{\partial y} & 0\\
0 & 0 & \frac{\partial }{\partial z}\\
0 & \frac{\partial }{\partial z} & \frac{\partial }{\partial y}\\
\frac{\partial }{\partial z} & 0 & \frac{\partial }{\partial x}\\
\frac{\partial }{\partial y} & \frac{\partial }{\partial x} & 0
\end{array} \right],\
\left [
\begin{array}{c}
\frac{\partial }{\partial x}\\
\frac{\partial }{\partial y}\\
\frac{\partial }{\partial z}
\end{array} \right] =\textbf{J}^{-1}
\left [
\begin{array}{c}
\frac{\partial }{\partial \xi}\\
\frac{\partial }{\partial \eta}\\
\frac{\partial }{\partial \zeta}
\end{array} \right], \
\textbf{J}=\left [
\begin{array}{ccc}
\partial_\xi x & {\partial_\xi y} & {\partial_\xi z}\\
\partial_\eta x & {\partial_\eta y} & {\partial_\eta z}\\
\partial_\zeta x & {\partial_\zeta y} & {\partial_\zeta z}
\end{array} \right]
\end{eqnarray}

The electromechanical coupling is governed by the linear constitutive equation
of piezoelectric material according to~\cite{giurgiutiumicromechatronics} and
it is expressed by:
\begin{eqnarray}
\left [
\begin {array}{c}
\bsigma\\
\textbf{D}
 \end{array}\right ]=
\left [
\begin{array}{cc}
\textbf{c}^E & -\textbf{e}^T \\
\textbf{e} & \bepsilon^S
\end{array} \right ]
\left[
\begin{array}{c}
\textbf{S}\\
\textbf{E}
\end{array} \right ]
\end{eqnarray}
where \textbf{c}$^E$, \textbf{e} and $\bepsilon^S$ are tensors of elastic,
piezoelectric and dielectric constants, respectively, \textbf{E} and \textbf{D}
are the electric field and electric displacement, $\bsigma$ and \textbf{S} are
stress and strain.
The superscripts E and S indicate that quantities are measured at zero electric
fields and zero strain, respectively and the subscript T denotes transpose
matrix.
Electric field vector can be expressed as:
\begin{eqnarray}
\textbf{E}^e=-\textbf{B}_\phi^e \widehat{\bphi}^e
\end{eqnarray}
where \textbf{B}$_\phi^e$ is electric-nodal potential matrix calculated as:
\begin{eqnarray}
\textbf{B}_\phi^e=
\left[ \begin{array}{c}
\frac{\partial }{\partial \xi}\\
\frac{\partial }{\partial \eta}\\
\frac{\partial }{\partial \zeta}
\end{array} \right]\textbf{N}^e(\xi,\eta,\zeta)
\end{eqnarray}

\subsection{Displacements coupling at the substructures interface}
\label{sec:interface}
The present model of the sandwich panel consists of 2D and 3D elements.
Moreover, there are non-matching grids between two adjacent substructures.
These involve connecting them by imposing the compatibility of the
displacements at the interface, see Fig.~\ref{fig:interface}. The coupling can
be expressed as:
\begin{eqnarray}
\left\{\begin{array}{c}
	\textbf{u}\\
	\textbf{v}\\
	\textbf{w}
	\end{array}\right\}_{s_{i1}}^{\Gamma^i}-
	\left\{\begin{array}{c}
	\textbf{u}\\
	\textbf{v}\\
	\textbf{w}
	\end{array}\right\}_{s_{i2}}^{\Gamma^i}=
	\left\{\begin{array}{c}
	\textbf{0}\\
	\textbf{0}\\
	\textbf{0}
	\end{array}\right\}
\label{eq:coupling}
\end{eqnarray}
\begin{figure}
	\begin{center}
		\includegraphics[width=1\linewidth]{../../../figures/png/interface_honeycomb.png}
	\end{center}
	\caption{Interface setup: a) interface coupling, b) the substructures and
	the interface degree of freedom, c) all the nodes of honeycomb wall except
	bottom layer nodes, d) the nodes of the 3D substructure at the bottom
	layer, e) the interface nodes projected to the bottom layer of the 3D
	substructure, f) the interface nodes, g) the interface nodes projected to
	mid-surface of the 2D substructure, h) the nodes of the 2D substructure}
	\label{fig:interface}
\end{figure}
For the whole structure, equation~\ref{eq:coupling} can be written in the
matrix form:
\begin{eqnarray}
\textbf{G}\textbf{d}=\textbf{0}
\label{eq:cond_disp}
\end{eqnarray}
where \textbf{G} is the coupling matrix which contains the equations to interpolate the substructures displacements at the interfaces, and $\textbf{d}$ is a global vector of displacements for $nS$ number of substructures, composed as:
\begin{eqnarray}
\textbf{d} = \left\{\begin{array}{cccc}
\textbf{d}_1, & \textbf{d}_2, &\ldots, & \textbf{d}_{nS}
\end{array}\right\}^T
\label{eq:displacements}
\end{eqnarray}

General formulation of the matrix \textbf{G} is proposed in Algorithm
\ref{alg:G_matrix}.
The main task of the algorithm is to calculate shape functions for each
adjacent substructures at the points $X_p=(x_p^k,y_p^k)$, which are projections
of the interface nodes onto these substructures.
The shape function can be calculated after finding an owner element and local
coordinates of the points. Owner element is a spectral element in domain of the
substructure $s_{ij}$ which contains interface node, for example interface node
$k=6$ (see Fig.~\ref{fig:interface}a)) is located in element $e^I$ and
$e^{III}$ for the substructures $s_{i1}$ and $s_{i2}$, respectively.
It can be found within two ways: using Matlab's built-in function
\verb+inpolygon+ or more efficient procedure proposed by Silva et al.
\cite{silva2009exact} which was used in the current implementation.
The transformation from global to local coordinates was realized by the
iterative method presented in the work of Li et al.~\cite{li2014efficient}.

\begin{algorithm}[H]
	\SetAlgoLined
	\KwResult{coupling matrix \textbf{G}}
	create empty $nI \times nS$ cell array: $\mathbf{G} = cell(nI,nS)$\;
	\For{i = 1 \KwTo nI}{
		find two common structures of interface $\Gamma^i$: $s_i = (s_{i1},s_{i2})$\;
		\For{j = 1 \KwTo 2}{
			create $n^{\Gamma^i}\times n^{s_{ij}}$ null matrix $\mathbf{G}^{s_{ij}}_i$,\\
			\For{k = 1 \KwTo $n^{\Gamma^i}$} {
				find $ownerElement^{s_{ij}}_k$ in the structure $s_{ij}$ containg interface node $k$ with global coordinates vector: $X_p=(x^k_p,y^k_p)$\;
				assign vector $X_e=(x_e,y_e)$ of coordinates of all nodes in $ownerElement^{s_{ij}}_k$\;
				assign initial coordinates $X_{\kappa}=(x^k_{\kappa},y^k_{\kappa})$ to the nearest node in $ownerElement^{s_{ij}}_k$ to node $k$\;
				transform global coordinates $X_{\kappa}$ to local coordinate system $\xi_{\kappa}=\xi(X_{\kappa});\quad \eta_{\kappa}=\eta(X_{\kappa})$\;
				\While{$\left|X_p-X_{\kappa}\right|>tol$}{
					$\xi_{\kappa+1}=\xi_{\kappa}+(J^{-1}_{\kappa})_{11}.*(x^k_p-x_{\kappa}^k)+(J^{-1}_{\kappa})_{12}.*(y^k_p-y_{\kappa}^k)$\;
					$\eta_{\kappa+1}=\eta_{\kappa}+(J^{-1}_{\kappa})_{21}.*(x^k_p-x_{\kappa}^k)+(J^{-1}_{\kappa})_{22}.*(y^k_p-y_{\kappa}^k)$\;
					$X_{\kappa}=N(\xi_{\kappa+1},\eta_{\kappa+1})X_e$\;
				}
				$\xi^k_p\approx \xi_{\kappa+1},\quad \eta^k_p\approx \eta_{\kappa+1}$\;
				$\mathbf{G}^{s_{ij}}_i(k,nX_e)=N(\xi^k_p,\eta^k_p)$\;
			}
			\uIf{elements of $s_{ij}$ are 3D} {
				$
				\mathbf{G}\{i,s_{ij}\}=\left[\begin{array}{ccc}
				\mathbf{G}^{s_{ij}}_i & \mathbf{0} & \mathbf{0}\\
				\mathbf{0} & \mathbf{G}^{s_{ij}}_i & \mathbf{0}\\
				\mathbf{0} & \mathbf{0} & \mathbf{G}^{s_{ij}}_i
				\end{array} \right]
				$\;
			}
			\ElseIf{elements of $s_{ij}$ are 2D} {
				$
				\mathbf{G}\{i,s_{ij}\}=\left[\begin{array}{ccccc}
				\mathbf{G}^{s_{ij}}_i & \mathbf{0} & \mathbf{0} & \frac{h_{ij}}{2}\mathbf{G}^{s_{ij}}_i & \mathbf{0}\\
				\mathbf{0} & \mathbf{G}^{s_{ij}}_i & \mathbf{0} & \mathbf{0} & \frac{h_{ij}}{2}\mathbf{G}^{s_{ij}}_i\\
				\mathbf{0} & \mathbf{0} & \mathbf{G}^{s_{ij}}_i & \mathbf{0} & \mathbf{0}
				\end{array} \right]
				$\;	}

		}
	}
	fill empty cells of array $\mathbf{G}$ with null matrices, and convert $\mathbf{G}$ to single matrix.
	\caption{Matrix G formulation}
	\label{alg:G_matrix}
\end{algorithm}
where $nI$ and $nS$ are number of the interfaces and the structures, respectively; $n^{\Gamma^i}$ and $n^{s_{ij}}$ are number of nodes of the interface $i$, and the structure $s_{ij}$, respectively; $\eta^k_p$ and $ \xi^k_p$ are local coordinates of $X_p$, respectively; $J_{\kappa}$ is Jacobians evaluated at $(\xi_{\kappa+1},\eta_{\kappa+1})$ and $N(\xi_{\kappa+1},\eta_{\kappa+1})$ is a shape function evaluated at $(\xi_{\kappa+1},\eta_{\kappa+1})$, $nX_e$ is a vector of global order numbers of all nodes in the $ownerElements^{s_{ij}}_k$, $h_{ij}$ is a thickness of the structure $s_{ij}$ and $tol$ is a termination criterion for iterations.

The computational effectiveness of the algorithm~\ref{alg:G_matrix} can be
easily improved if certain precautions are taken.
Firstly, the mesh of the interface has to be based on the mesh from one of the
substructures $s_i1$, $s_i2$, which may be referred to as a slave. So, the
shape function takes only the values of one and zeros. Moreover, the code can
be implemented in vectorized form rather than using a for-loops.

\subsection{Elementary governing equations of motion}
\label{sec:motion}
The elementary governing equations of motion with Lagrange multipliers can be written in the matrix form:
\begin{eqnarray}
\left[
\begin{array}{ccc}
\textbf{M}_{dd} & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{array} \right]
\left \{
\begin{array}{c}
\ddot{\widehat{\textbf{d}}}\\
\ddot{\widehat{\bphi}}\\
0
\end{array} \right \}+
\left[
\begin{array}{ccc}
\textbf{C}_{dd} & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{array} \right]
\left \{
\begin{array}{c}
\dot{\widehat{\textbf{d}}}\\
\dot{\widehat{\bphi}}\\
0
\end{array} \right \}+\nonumber\\
+\left[
\begin{array}{ccc}
\textbf{K}_{dd} & \textbf{K}_{d\phi} & {\textbf{G}}^T\\
\textbf{K}_{\phi d} & \textbf{K}_{\phi \phi} & 0\\
\textbf{G} & 0 & 0
\end{array} \right]
\left \{
\begin{array}{c}
\widehat{\textbf{d}}\\
\widehat{\bphi}\\
\blambda
\end{array} \right \}=
\left \{
\begin{array}{c}
\textbf{F}\\
\textbf{Q}\\
0
\end{array} \right \}
\label{eq:motion}
\end{eqnarray}
where $\textbf{M}_{dd}$, $\textbf{C}_{dd}$, $\textbf{K}_{dd}$ are structural
mass, damping and stiffness matrices, respectively; $\textbf{K}_{\phi
d}={\textbf{K}_{d\phi}}^T$ are piezoelectric coupling matrix; $\textbf{K}_{\phi
\phi}$ is the dielectric permittivity matrix, $\widehat{\textbf{d}}$ is the
nodal displacements and $\widehat{\bphi}$ is the electric potential;
$\textbf{F}$ the nodal external force vector, $\textbf{Q}$ is the nodal
externally applied charge vector, $\blambda$ is the vector of Lagrange
multipliers, and $\textbf{G}$ is the Lagrange multiplier matrix; $(\dot{\
})=\frac{\partial}{\partial t}$. The formulae of matrices are provided
in~\ref{app:matrices}.
The coupling is realized by imposing the traction forces, represented by a vector of Lagrange multipliers.

\subsection{Time integration of the equation of motion}
\label{sec:time_integration}
Using a central difference scheme, equation (\ref{eq:motion}) can be rewritten as follow:
\begin{eqnarray}
\left(\frac{1}{\Delta t^2}\textbf{M}_{dd}+\frac{1}{2\Delta t}\textbf{C}_{dd} \right)\widehat{\textbf{d}}_{t+\Delta t}=
\textbf{F}_t+\textbf{K}_s\bphi_t^P-\left( \textbf{K}_{dd}-\textbf{K}_a\right)\widehat{\textbf{d}}_t\nonumber\\
+\frac{2}{\Delta t^2}\textbf{M}_{dd}\widehat{\textbf{d}}_t-\left(\frac{1}{\Delta t^2}\textbf{M}_{dd}-\frac{1}{2\Delta t}\textbf{C}_{dd}\right)\widehat{\textbf{d}}_{t-\Delta t}-\textbf{G}^T\blambda_t
\label{eq:CDE}
\end{eqnarray}
where  $\textbf{K}_s=\textbf{K}_{d\phi}^A{\textbf{K}_{\phi \phi}^{A,A}}^{-1}\textbf{K}_{\phi \phi}^{A,P}-\textbf{K}_{d\phi}^P$,
$\textbf{K}_a=\textbf{K}_{d \phi}^A{\textbf{K}_{\phi \phi}^{A,A}}^{-1}\textbf{K}_{\phi d}^A$,
and $\Delta t$ is the time increment.
$\textbf{K}_{d \phi}^A$ and $\textbf{K}_{d\phi}^P$ are sub-matrices of matrix
$\textbf{K}_{d\phi}$,
while $\textbf{K}_{\phi \phi}^{A,P}$ and $\textbf{K}_{\phi \phi}^{A,A}$ are the
sub-matrices of matrix $\textbf{K}_{\phi \phi}$.
Their formulation is realized by discarding appropriate rows and columns
according to imposed electrical boundary conditions. $\textbf{K}_{d \phi}^P$
contains columns selected from $\textbf{K}_{d\phi}$ by vector \textbf{P}, and
$\textbf{K}_{d\phi}^A$ contains columns selected from $\textbf{K}_{d\phi}$ by
vector \textbf{A}. $\textbf{K}_{\phi \phi}^{A,P}$ contains columns from
$\textbf{K}_{\phi \phi}$ selected by vector \textbf{P} and rows from the same
matrix selected by vector \textbf{A}, and $\textbf{K}_{\phi \phi}^{A,A}$
contains rows and columns selected from $\textbf{K}_{\phi \phi}$ by vector
\textbf{A}. Where \textbf{P} is a list of nodes assigned to the electrodes, and
\textbf{A} is a complement of \textbf{P} in the set of all nodes of the PZT.

Unknown Lagrange multiplier vector $\blambda_t$ is dependent on the load acting on the structure, and it is calculated for each time step from Eq. (\ref{eq:CDE}) by imposing the constraint Eq. (\ref{eq:cond_disp}).
\begin{eqnarray}
\blambda_t &= &{\left(\textbf{G}\textbf{L}_+^{-1}\textbf{G}^T \right)}^{-1}\textbf{G}\textbf{L}_+^{-1} \Bigg[ \textbf{F}_t+\textbf{K}_s\bphi_t^P\nonumber\\
& & +\left.\left(\frac{2}{\Delta t^2}\textbf{M}_{dd}-\textbf{K}_{dd}+\textbf{K}_a\right)\textbf{d}_t -\textbf{L}_-\textbf{u}_{t-\Delta t} \right]
\end{eqnarray}
where $\textbf{L}_+=\frac{1}{\Delta t^2}\textbf{M}_{dd}+\frac{1}{2\Delta t}\textbf{C}_{dd}$ and $\textbf{L}_-=\frac{1}{\Delta t^2}\textbf{M}_{dd}-\frac{1}{2\Delta t}\textbf{C}_{dd}$.

\section{Numerical simulations}
\label{sec:numerical}
\subsection{Sample configuration}
\label{sec:sample}
The sample consists of aluminum honeycomb attached between two carbon fiber
reinforced polymer (CFRP) plates by the adhesive layers
(Fig.~\ref{fig:honeycomb}a)).
Material properties used in the simulations are gathered in
Appendix~\ref{app:properties}. One pair of circular PZT transducers were
mounted on the top skin to generate and receive of guided waves signals.
Glue under the transducers were not considered.

In the middle of the structure, the circular area of the adhesive layer between
the bottom skin and core was removed to simulate the disbonds in the HSC.
The size of the disbond was the subject of the parametric study aiming at
finding the damage effect on GW propagation.

The following dimensions and parameters were assumed:
\begin{itemize}
	\item CFRP skins --- L = 500, W = 314, H = 1 mm, fibers volume fraction 50\%, stacking sequence $[0^\circ,90^\circ,0^\circ,90^\circ,0^\circ,90^\circ,0^\circ,90^\circ]$,
	\item Core --- $\Phi$ = 19, h = 10, w = 0.07 mm (Fig.~\ref{fig:honeycomb}b)),
	\item Adhesive --- L = 500, W = 314, H = 0.5 mm,
	\item PZT --- $\Phi$ = 10, h = 0.5 mm, location \#1 $(x_1,y_1)=(-80,0)$ mm, \#2 $(x_2,y_2)=(80,0)$ mm,
	\item Disbonds $\Phi$ = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50].
\end{itemize}

\begin{figure}
	\begin{center}
		\includegraphics[width=1\linewidth]{../../../figures/png/honeycomb.png}
	\end{center}
	\caption{Sample configuration: a) top view of the sample, b) honeycomb sandwich substructures, c) detail of the honeycomb cell, d) nodes in the spectral element}
	\label{fig:honeycomb}
\end{figure}

\subsection{Simulation parameters}
\label{sec:simulation}
The meshes take into account the damage which was modelled at the bottom skin
and PZTs attached to the top skin.
The meshes were generated by using external GMSH software
\cite{geuzaine2009gmsh}.
The meshes were composed of $6 \times 6$ nodes elements.
The mesh density has been chosen to ensure at least 6 nodes per wavelength.
In case of the honeycomb core, one $6 \times 6$ spectral element was used for
each wall of the cell.

The analysis was made with 15 kHz frequency sine pulse modulated by the Hann
window.
Total calculation time was set to 800 $\mu$s with time increment $\Delta t=8$
ns.
Within this period full pulse of $A_0$ mode passed through the snesnor \#2.
\subsection{Results}
\label{sec:results}
to be continued...
\begin{figure}
	\begin{center}
		\includegraphics[width=1\linewidth]{../../../figures/png/hilbert.png}
	\end{center}
	\caption{Hilbert}
	\label{fig:hilbert}
\end{figure}
\begin{figure}
	\begin{center}
		\includegraphics[width=1\linewidth]{../../../figures/png/madif.png}
	\end{center}
	\caption{madif}
	\label{fig:madif}
\end{figure}
\section{Conclusions}
to be continued...
\appendix
\section{}
\label{app:matrices}
The formulae of matrices for 3D elements are:
\begin{eqnarray}
\textbf{M}_{dd}^e & = & \int_{V_e}\textbf{N}^T\rho \textbf{N}\rmd V_e\\
\textbf{K}_{dd}^e & = & \int_{V_e}{\textbf{B}_d^e}^T\textbf{c}\textbf{B}_d^e\rmd V_e
\end{eqnarray}
where \textbf{c} and $\rho$ is the elasticity matrix and mass density, respectively and $\int_{V_e}dV_e$ is a volume integral.

The formulae of matrices for 2D elements are:
\begin{eqnarray}
\textbf{M}_{dd}^e & = & \int_{\Omega_e}\textbf{N}^T\rho
\left [
\begin{array}{ccccc}
h & 0 & 0 & 0 & 0\\
0 & h & 0 & 0 & 0\\
0 & 0 & h & 0 & 0\\
0 & 0 & 0 & \frac{h^3}{12} & 0\\
0 & 0 & 0 & 0 & \frac{h^3}{12}
\end{array} \right]
\textbf{N}\rmd \Omega_e\\
\textbf{K}_{dd}^e & = & \int_{\Omega_e}{\textbf{B}_b^e}^T
\left[
\begin{array}{cc}
\textbf{A} & \textbf{B}\\
\textbf{B} & \textbf{D}
\end{array} \right]
\textbf{B}_b^e\rmd \Omega_e+\int_{\Omega_e}{\textbf{B}_s^e}^T\textbf{A}^{\ast}\textbf{B}_s^e\rmd \Omega_e
\end{eqnarray}
where h is the element thickness and $\int_{\Omega_e}d\Omega_e$ is a surface integral and:
\begin{eqnarray}
\textbf{A} & = & \textbf{c}_{ij}(h_t-h_b)\qquad i,j=1,2,6\nonumber\\
\textbf{B} & = & \frac{1}{2}\textbf{c}_{ij}(h_t^2-h_b^2)\qquad i,j=1,2,6\nonumber\\
\textbf{D} & = & \frac{1}{3}\textbf{c}_{ij}(h_t^3-h_b^3)\qquad i,j=1,2,6\nonumber\\
\textbf{A}^{\ast} & = & \kappa \, \textbf{c}_{ij}\left[h_a-4/3\left(h_t^3-h_b^3\right)/h_a^2\right]\qquad i,j=4,5\nonumber
\end{eqnarray}
where the $h_t$ and $h_b$ are the distance from mid-plane to the top and bottom
layer of the element, respectively and the $\kappa=5/4$ is a shear correction
factor.

The dielectric conductivity matrix $\textbf{K}_{\phi \phi}^e$ and piezoelectric coupling matrix $\textbf{K}_{u \phi}^e$ are defined:
\begin{eqnarray}
\textbf{K}_{d\phi}^e & = & \int_{V_e}{\textbf{B}_d^e}^T\textbf{e}^T \textbf{B}_{\phi}^e\rmd V_e\\
\textbf{K}_{\phi \phi}^e & = & -\int_{V_e}{\textbf{B}_{\phi}^e}^T {\textbf{$\bepsilon$}^S}^T \textbf{B}_{\phi}^e\rmd V_e
\end{eqnarray}

\section{}
\label{app:properties}

Mechanical properties of carbon fibres, epoxy resin and adhesive layer are
presented in table~\ref{tab:properties} and evaluated effective elastic
properties for single layer in table~\ref{tab:properties_layer}.
\begin{table}
\centering
\caption{\label{tab:properties}Material properties of carbon fibres, epoxy resin and adhesive layer}
\begin{tabular}{ccccc}\hline
Material & $E_{11}$ &  $E_{33}$ & $\nu_{12}$ & $\rho$ \\
 & [GPa] &  [GPa] & [-] & [kg/m$^3$]\\
\hline
Carbon & 275.6 & 27.6 & 0.2 & 1900\\
Epoxy & 3.43 & 3.43 & 0.35 & 1250\\
Adhesive & 1.7 & 1.7 & 0.34 & 1200\\
\end{tabular}
\end{table}

\begin{table}
\centering
\caption{\label{tab:properties_layer}Effective material properties of single layer}
\begin{tabular}{cccccccc}
\hline
 $E_{11}$ & $E_{22}$ & $E_{33}$ & $G_{12}$ & $G_{23}$ & $\nu_{12}$ & $\nu_{23}$ & $\rho$ \\
$[$GPa] & [GPa] & [GPa] & [GPa] & [GPa] & [-] & [-] & $[kg/m^3$]\\
\hline
137 & 8.7 & 8.7 & 3.61 & 3.19 & 0.28 & 0.37 & 1569\\
\hline
\end{tabular}
\end{table}

Material properties of the PZT transducer:
\begin{eqnarray}
\textbf{c}^E=\left [
\begin{array}{cccccc}
134 & 88.9 & 90.9 & 0 & 0 & 0 \\
88.9 & 134 & 90.9 & 0 & 0 & 0 \\
90.9 & 90.9 & 121 & 0 & 0 & 0 \\
0 & 0 & 0 & 20.5 & 0 & 0 \\
0 & 0 & 0 & 0 & 20.5 & 0 \\
0 & 0 & 0 & 0 & 0 & 22.4 \nonumber \\
\end{array}
\right ] \left [ GPa \right ]
\end{eqnarray}
\begin{eqnarray}
\textbf{e}=\left[
\begin{array}{cccccc}
0 & 0 & 0 & 0 & 13.7 & 0\\
0 & 0 & 0 & 13.7 & 0 & 0\\
-6.06 & -6.06 & 17.2 & 0 & 0 & 0\nonumber \\
\end{array}
\right] \left[C\ m^{-2}\right]
\end{eqnarray}
\begin{eqnarray}
\bepsilon^S_r=\left[
\begin{array}{ccc}
906 & 0 & 0\\
0 & 906 & 0\\
0 & 0 & 823\nonumber \\
\end{array}
\right] \left[ - \right]
\end{eqnarray}
\begin{eqnarray}
\rho=7850\ [kg\ m^{-3}] \nonumber
\end{eqnarray}

\bibliography{../../../../../BibTex/Rozprawa}{}
\end{document}

max_stars_repo_name: pfiborek/model-hc

max_issues_repo_name: pfiborek/model-hc

max_forks_repo_name: pfiborek/model-hc


text:
\documentclass[a4paper,fleqn,11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{mdframed}
\usepackage{lipsum}

\usepackage{libertine}
\usepackage[scaled=0.80]{DejaVuSans}
\usepackage[libertine,cmintegrals]{newtxmath}
\renewcommand\ttdefault{lmvtt}

\usepackage{geometry}
\geometry{a4paper,left=34mm,right=34mm,top=30mm,bottom=40mm}

\usepackage{color}
\definecolor{c1}{RGB}{0,40,80}
\definecolor{gray1}{RGB}{80,80,80}
\usepackage[colorlinks=true,linkcolor=c1]{hyperref}
% \usepackage[colorlinks=true,linkcolor=black]{hyperref}

\newcommand{\strong}[1]{\textsf{\textbf{#1}}}

\newtheoremstyle{rmbox}%
  {0pt}% space above
  {0pt}% space below
  {}% bodyfont
  {}% indent
  {\sf\bfseries}% head font
  {\\[2pt]}% punctuation between head and body
  {0pt}% space after theorem head
  {\thmname{#1}\;\thmnumber{#2}.\;\thmnote{#3.}}

\theoremstyle{rmbox}
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}

\definecolor{greenblue}{rgb}{0.0,0.32,0.4}
\definecolor{grayblue}{rgb}{0.2,0.2,0.4}

\surroundwithmdframed[topline=false,rightline=false,bottomline=false,%
  linecolor=greenblue, linewidth=3.5pt, innerleftmargin=6pt,%
  innertopmargin=2pt, innerbottommargin=6pt,%
  innerrightmargin=0pt%
]{definition}

\newcommand{\framedtheorem}[1]{%
\surroundwithmdframed[topline=false,rightline=false,bottomline=false,%
  linecolor=grayblue, linewidth=3.5pt, innerleftmargin=6pt,%
  innertopmargin=2pt, innerbottommargin=6pt,%
  innerrightmargin=0pt%
]{#1}}

\framedtheorem{theorem}
\framedtheorem{lemma}
\framedtheorem{corollary}

\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\R}{\mathbb R}
\newcommand{\C}{\mathbb C}
\newcommand{\ui}{\mathrm i}
\newcommand{\ee}{\mathrm e}
\newcommand{\defiff}{\;:\Longleftrightarrow\;}

\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\sur}{sur}
\DeclareMathOperator{\real}{Re}
\DeclareMathOperator{\imag}{Im}

\begin{document}
\thispagestyle{empty}

\noindent
{\huge\strong{Fundamentals}}

\tableofcontents

\section{Sets and mappings}

\subsection{Set operations}

\begin{definition}[Union]
Given two sets $A$ and $B$, the set
\begin{equation}\label{eq:cup}
A\cup B := \{x\mid x\in A\lor x\in b\}
\end{equation}
is called the \emph{union} of them.
\end{definition}

\subsection{Preimage}

\begin{definition}[Preimage]
The \emph{preimage} of a set $M$ under a mapping
$f\colon A\to B$ is defined as
\begin{equation}\label{eq:preimage}
f^{-1}(M) := \{x\mid f(x)\in M\}.
\end{equation}
\end{definition}

\begin{theorem}
For any mapping $f\colon A\to B$ it is true that
\begin{equation}
f^{-1}(A\cup B) = f^{-1}(A)\cup f^{-1}(B).
\end{equation}
\end{theorem}

\noindent
\strong{Proof.} According to \eqref{eq:preimage} and \eqref{eq:cup}
the following holds:
\begin{align}
&x\in f^{-1}(A\cup B)\iff f(x)\in A\cup B
\iff f(x)\in A\lor f(x)\in B\\
&\iff x\in f^{-1}(A)\lor x\in f^{-1}(B)
\iff x\in f^{-1}(A)\cup f^{-1}(B).\;\Box
\end{align}

\end{document}

ext: tex


text:
\section{Green Odem Flame}\label{perk:greenOdemFlame}
\textbf{Cost:} Varies, see "\nameref{ch:odemPerks}"\\
\textbf{Requirements:}\nameref{perk:odemCurse} I\\
\textbf{Active, Repeatable}\\
You can call forth the power of compassion inside of you, producing a green, flame-like substance from your hands.\\
Any melee weapon attacks you do while this flame is active deal an additional 1d4 radiation damage.\\
When dealing this radiation damage, you gain the same amount as temporary health.\\
While you have temporary health and the Green Odem Flame active, you can take 2 AP and touch a willing creature, redistributing as many of your temporary health as you want to them.
Any temporary health gained or redistributed by this feature are reduced first.\\
While the effect is active, each action costs you an additional 1 Stamina per Action Points spent.\\
You can end this effect at any given time\\
This effect also ends early if you take damage.\\
You can only use the green flame once every 24 hours.\\
While activating a Green Odem Flame, you can not call forth any other Odem Flames.\\
\\
Level Progression:\\
\\
II: You can call it forth once every 12 hours.
It also deals an additional 1d4 radiation damage.\\
III: It doesn't end anymore if you take damage.
It also deals an additional 1d4 radiation damage.\\
IV: You can call it forth once every 6 hours.
It also deals an additional 1d4 radiation damage.\\
V: It only costs 1 Stamina per attack you use the flame with, not per AP.
It also deals an additional 1d4 radiation damage.\\

max_stars_repo_name: NTrixner/RaggedLandsPenAndPaper

max_issues_repo_name: NTrixner/RaggedLandsPenAndPaper

max_forks_repo_name: NTrixner/RaggedLandsPenAndPaper


text:
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}

\section*{Meaning of typographic changes and symbols}

Table \ref{tab:pre_typog} describes the type changes and symbols used in this book.

\begin{table}[h]
\centering
\begin{tabular}{+l^l^l}
\hline
\rowstyle{\bfseries}
Typeface or Symbol & Meaning & Example \\
\hline
 \execout{AaBbCc123} &  The names of commands, & Edit your \execout{.bashrc} \\
 &  files, and directories; & Use \execout{ls -a} to list all files. \\
 & on-screen computer output & \execout{host\$ You have mail!}. \\
 \exec{AaBbCc123} & What you type, contrasted & \execout{host\$} \exec{su} \\
 & with on-screen computer & \\
 & output & \\
 \execsub{AaBbCc123} & Command line placeholder: & To delete a file, type  \\
 & replace with a real name & \execout{rm} \execsub{filename} \\
 & or value & \\
 \hline
\end{tabular}
\caption{Typographic Conventions}
\label{tab:pre_typog}
\end{table}


text:
\subsection{Endomorphisms}

An endomorphism maps a vector space onto itself.

\( end (V)=\hom (V, V)\)

max_stars_repo_name: adamdboult/nodeHomePage

max_issues_repo_name: adamdboult/nodeHomePage

max_forks_repo_name: adamdboult/nodeHomePage


text:
\section{section}

\subsection{subsection}

\subsubsection{subsection}

\paragraph{paragraph}

max_stars_repo_name: ljpengelen/latex-phd-thesis

max_issues_repo_name: ljpengelen/latex-phd-thesis

max_forks_repo_name: ljpengelen/latex-phd-thesis


text:
\documentclass{beamer}

\usepackage{fontspec}
\usepackage{xeCJK}
\setCJKmainfont{DFFN_R3.TTC}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\linespread{1.3}
\allowdisplaybreaks

\newcommand{\weib}{\CJKfamily{weib}}
\newcommand{\hkss}{\CJKfamily{hkss}}
\newcommand{\hksy}{\CJKfamily{hksy}}
\newcommand{\lth}{\CJKfamily{lth}}
\usepackage{color}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{pgfplotstable}
\pgfplotsset{width=12cm}
\pgfplotsset{height=7cm}
\pgfplotsset{compat=1.13}

\usetheme{EastLansing}
\usetikzlibrary{positioning}
\useinnertheme{rectangles}
\usefonttheme{professionalfonts}

\newcommand{\lw}{0.8mm}
\setbeamercovered{transparent}

%\AtBeginSection[]
%{
  %\begin{frame}<beamer>
	%\frametitle{報告大綱}
	%%\frametitle{RoadMap}
    %\tableofcontents[currentsection]
  %\end{frame}
%}

\title{Paper Introduction}
\subtitle{\textcolor[rgb]{0.00,0.50,1.00}{{Speech Processing \& Machine Learning Laboratory}}}
\author{徐瑞陽}
\date{2019/03/20}
\begin{document}

\begin{frame}
\maketitle
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}

\section{Interesting Facts about Adversarial Attack/Defense}
\subsection{Background Knowledge}
\begin{frame}{Amount of Information Adversary had}
    \begin{itemize}
      \item White-Box: Adversary has \textbf{full-access} to the model (structure, weight)
      \item Black-Box: Labels assigned by the \textbf{Oracle} for chosen input (e.g API call)
    \end{itemize}
\end{frame}

\begin{frame}{Optimization View on Adversarial Robustness}
  \begin{block}{Objective}
    \[ \min_\theta \mathbb{E}_{(x,y) \sim \mathcal{D}}[\max_{\delta \sim \mathcal{S}}L(x+\delta,y|\theta)]\]
  \end{block}
  \begin{itemize}
    \item $\mathcal{S}$: allowed pertubations of adversary
    \item $\theta$: weights of classifier model
  \end{itemize}
\end{frame}

\begin{frame}{Allowed Pertubations of Adversary}
  \begin{itemize}
    \item Distance metric
      \begin{itemize}
        \item $L_0$: \# of pixel can change
        \item $L_2$: move within Euclidean ball with radius $\epsilon$
        \item $L_\infty$: every pixel has $\epsilon$ budget to move around
      \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}{Optimization Methods of Adversary}
  How to find the most adversarial point within $\mathcal{S}$?
  \begin{itemize}
    \item Gradient (First Order Adversary), the most common one
    \item Mixed Integer Programming \\
      $\rightarrow$ \href{https://openreview.net/forum?id=HyGIdiRqtm}{Evaluating Robustness of Neural Networks with Mixed Integer Programming, ICLR2019}

    \item And more...
  \end{itemize}
\end{frame}
\begin{frame}{One Adversary Instance - FGSM}
  \textit{Fast Gradient Sign Method} is an \color{blue}{$L_\infty\text{-bounded}$}  \color{purple}{first-order} \color{black}{adversary}
  \[
    \tilde{x} = x + \epsilon \, \texttt{sgn} \nabla_xL(x,y|\theta)
  \]

  Some variants as follows
  \begin{itemize}
    \item multi-step (possibly w/ projection)
    \item ensemble
  \end{itemize}
\end{frame}

\subsection{Obfuscated Gradients Give a False Sense of Security}
\begin{frame}{Obfuscated Gradients Give a False Sense of Security}
  \includegraphics[width=\textwidth]{fig/ob-grad/ob-grad-title.png}
  \center ICML 2018
\end{frame}

\begin{frame}{Some Highlights}
  \begin{itemize}
    \item Provide a method to identify so-called \textbf{Obfuscated Gradients}
    \item Identify 7/9 of defenses proposed in ICLR 2018 succeed defensing by this pheonemon
    \item \textbf{Provide simple algorithms to beat those defenses} \href{https://github.com/anishathalye/obfuscated-gradients}{$\rightarrow$ github}\\
      (within pertubations $\mathcal{S}$ they claim they can defend under white-box setting)
  \end{itemize}
\end{frame}

\begin{frame}{It's Da Lian Time}
  \includegraphics[width=\textwidth]{fig/ob-grad/table.png}
\end{frame}

\begin{frame}{Obfuscated Gradients}
  In brief, provide useless gradient to adversary, then they cannot exploit it to find adversarial example.
\end{frame}

\begin{frame}{Intuition of Obfuscated Gradients}
  \includegraphics[width=\textwidth]{fig/ob-grad/effect-of-gradient-masking.png}

  \textbf{Note}: $L(\hat{x},y|\theta)$ is still high within $\mathcal{S}$
\end{frame}

\begin{frame}{How to identify them}
  \begin{itemize}
    \item One-step attacks perform better that iterative attacks
    \item Partial random-step attacks perform better
    \item Black-box attacks perform better (see next slide)
    \item Increasing pertubation budget $\epsilon$ doesn't increase success rate pretty much
  \end{itemize}
\end{frame}

\begin{frame}{Why black-box attack can perform better}
  \includegraphics[width=\textwidth]{fig/ob-grad/black-box-attack.png}
\end{frame}

\begin{frame}{Types of Obfuscated Gradients}
  \begin{itemize}
    \item Shattered Gradients
      \begin{itemize}
        \item non-differentiable operation (\textit{nonexistent})
        \item provide \textit{incorrect} gradient to make adversary stuck in local
      \end{itemize}
    \item Random Gradients
        \begin{itemize}
          \item randomize the network
          \item add some random processing to input
        \end{itemize}
      \item Exploding/Vanishing Gradients (?)
  \end{itemize}
\end{frame}

\begin{frame}{Proposed Attack Algorithms}
  \begin{itemize}
    \item Backward Pass Differentiable Approximation (\textit{BPDA})
      \begin{itemize}
        \item Circumvent shattered gradients
        \item $\nabla_xf(g(x))|_{x = \hat{x}} \approx \nabla_xf(x)|_{x = g(\hat{x})}$
      \end{itemize}

    \item Expectation over Transformations (\textit{EOT})
      \begin{itemize}
        \item Circumvent random gradients
        \item $\nabla\mathbb{E}_{t \sim T}f(t(x)) = \mathbb{E}_{t \sim T} \nabla f(t(x))$
        \item In brief, ensemble
      \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}{Some Thoughts}
  \begin{itemize}
    \item No free lunch, additional cost of
      \begin{itemize}
        \item calculate $g(\cdot)$ many steps
        \item parallel computation cost of ensemble
      \end{itemize}
    \item Succeed attack alg. can be used as defense alg. (remember the minmax objective)
    \item If we make $\epsilon$ larger?
  \end{itemize}
\end{frame}

\subsection{Robustness May Be At Odds With Accuracy}
\begin{frame}{Robustness May Be At Odds With Accuracy}
  \includegraphics[width=\textwidth]{fig/p2/title.png}
  \center ICLR 2019
\end{frame}

\begin{frame}{Some Highlights}
  \begin{itemize}
    \item Prove trade-off between standard accuracy and robustness \\
      Is adversarial training $\in$ Data Augmentation?
    \item Identify robust and non-robust features
    \item Interpretable gradients thru adversarial training
  \end{itemize}
\end{frame}

\begin{frame}{Example}
  \includegraphics[width=\textwidth]{fig/p2/example.png}
  \begin{itemize}
    \item $x_1$: moderately correlated feature
    \item $x_2 \sim x_{d+1}$: weakly correlated feature, but...
  \end{itemize}
\end{frame}

\begin{frame}{Accumulation of weakly features}
  Consider the following linear classifier
  \includegraphics[width=0.8\textwidth]{fig/p2/lc.png}

  if $d$ is large enough
  \includegraphics[width=\textwidth]{fig/p2/lc-prob.png}

  \center{The ``meta-feature'' is strongly correlated}
\end{frame}

\begin{frame}{Adversarially robust classification}
  Consider $L_\infty$-bounded adversary with $\epsilon=2\eta$\\
  (You can imagin that two distributions are switched)

  \begin{block}{Theorem: Robustness-accuracy trade-off}
    Any classifier attains at least $1 - \delta$ standard accuracy on $\mathcal{D}$ (the distributions mentioned above) has robust accuracy at most $\frac{p}{1-p}\delta$ against $L_\infty$ bounded adversary with $\epsilon \geq 2\eta$
  \end{block}
\end{frame}

\begin{frame}{Discussion of robust/non-robust features}
  In above case
  \begin{itemize}
    \item $x_1$: robust feature (something invariant)
    \item $x_2 \sim x_{d+1}$: non-robust feature
  \end{itemize}
  \begin{block}{Claim}
    Standard classifier assigns weight to even weakly correlated features, \\but robust classifier doesn't assign any weight beyond a certain thrshold
  \end{block}
\end{frame}

\begin{frame}{Experiments: Binary classifier on MNIST (5 vs 7)}
  \center{\includegraphics[width=0.8\textwidth]{fig/p2/cu.png}}\\
  Right figure: \\Both accuracy is trained using \textbf{standard} training with subset of features \\
(w/ decreasing relation between label, calculated thru $\mathbb{E}_{(x,y) \sim \mathcal{D}}[yx_i]$)
\end{frame}

\begin{frame}{Interpretable gradients}
  Loss gradients in the input space align well with human eyes
  \includegraphics[width=\textwidth]{fig/p2/int-grad.png}
\end{frame}

\begin{frame}{Some Thoughts}
  \begin{itemize}
    \item By encoding appropriate prior into set of pertubations $\mathcal{S}$, adversarial training can provide interpretable gradients
  \end{itemize}
\end{frame}

%\section{Interesting Facts on Vision}
%\subsection{Approximating CNNs with Bag-of-local-Features models works surprisingly well on ImageNet}
%\begin{frame}{Approximating CNNs with Bag-of-local-Features models}
  %\includegraphics[width=\textwidth]{fig/p3/title.png}
  %\center ICLR 2019
%\end{frame}

%\begin{frame}{Idea: Image Classification Task for Example}
  %Use \textbf{patch} information of images independently (instead of whole image), then do majority voting to do image-level decision.
%\end{frame}

%\begin{frame}{Idea of BagNet}
  %\center \includegraphics[width=0.7\textwidth]{fig/p3/idea.png}
%\end{frame}

%\begin{frame}{Difference between CNN}
  %\begin{itemize}
    %\item CNN: Aggregate low-level local features to global high-level information (見樹見林)
    %\item BagNet: Consider local features independently (見樹不見林)
  %\end{itemize}
%\end{frame}

%\begin{frame}{How does each frame look like}
  %\center \includegraphics[width=\textwidth]{fig/p3/size.png}
%\end{frame}

%\begin{frame}{Accuracy}
  %\center \includegraphics[width=0.7\textwidth]{fig/p3/acc.png}
%\end{frame}

%\begin{frame}{Some Thoughts}
  %\begin{itemize}
    %\item Is current task \textbf{difficult} enough to use global information?
    %\item Better interpretability (W/ trading some accuracy)
      %\begin{itemize}
        %\item Each patch acts as unit in heatmap (ignoring background but focusing on shape and edge)
        %\item Know why adversarial sample is misclassified
      %\end{itemize}
  %\end{itemize}
%\end{frame}
%\section{Elements}
%\subsection{Fonts}
%\begin{frame}[t]{Fonts}
  %\begin{itemize}
    %\item Regular
    %\item \textit{Italic}
    %\item \textsc{SmallCaps}
    %\item \textbf{Bold}
    %\item \textbf{\textit{Bold Italic}}
    %\item \textbf{\textsc{Bold SmallCaps}}
    %\item \texttt{Monospace}
    %\item \texttt{\textit{Monospace Italic}}
    %\item \texttt{\textbf{Monospace Bold}}
    %\item \texttt{\textbf{\textit{Monospace Bold Italic}}}
  %\end{itemize}
%\end{frame}

%\subsection{Lists}
%\begin{frame}{Lists}
  %\begin{columns}[T,onlytextwidth]
    %\column{0.33\textwidth}
      %Items
      %\begin{itemize}
        %\item Milk \item Eggs \item Potatos
      %\end{itemize}

    %\column{0.33\textwidth}
      %Enumerations
      %\begin{enumerate}
        %\item First, \item Second and \item Last.
      %\end{enumerate}

    %\column{0.33\textwidth}
      %Descriptions
      %\begin{description}
        %\item[PowerPoint] Meeh. \item[Beamer] Yeeeha.
      %\end{description}
  %\end{columns}
%\end{frame}
%\begin{frame}{Animation}
  %\begin{itemize}[<+- | alert@+>]
    %\item \alert<4>{This is\only<4>{ really} important}
    %\item Now this
    %\item And now this
  %\end{itemize}
%\end{frame}

%\subsection{Math}
%\begin{frame}{Math}
  %\begin{equation*}
    %e = \lim_{n\to \infty} \left(1 + \frac{1}{n}\right)^n
  %\end{equation*}
%\end{frame}
\section{MISC}
\begin{frame}
	\begin{center}
    %\weib{\LARGE{謝謝聆聽！}}
    \LARGE{Questions?}
	\end{center}
\end{frame}

\subsection{Interesting papers}
\begin{frame}{Interesting papers about adversarial attack}
  \begin{itemize}
    \item \textit{Towards Deep Learning Models Resistant to Adversarial Attacks} [\href{https://arxiv.org/abs/1706.06083}{link}]
      \begin{itemize}
        \item Survive from attack mentioned above
        \item \textbf{Interesting experiments and insights}
        \item Unreasonable effectiveness of \textbf{Projected} Gradient Descent (PGD)
      \end{itemize}
    \item Universal Pertubations
      \begin{itemize}
        \item \textit{Universal Adversarial Pertubations} [\href{https://arxiv.org/pdf/1610.08401.pdf}{link}], CVPR2017
        \item \textit{Playing The Game Of Universal Adversarial Perturbations} [\href{https://arxiv.org/abs/1809.07802}{link}], rejected by ICLR2019
        \item Quickly reaches high fooling rate, even when the perturbation magnitude $\epsilon$ is small (compared to per-sample pertubation)
      \end{itemize}
  \end{itemize}
\end{frame}

\subsection{Appendix}
\begin{frame}{BPDA}
  \includegraphics[width=\textwidth]{fig/ob-grad/bpda-fact.png}
\end{frame}

\begin{frame}{Universal Pertubations}
  \center \includegraphics[height=\textheight]{fig/universal-pertubation.png}
\end{frame}
\end{document}

max_stars_repo_name: sunprinceS/ReportHub

max_issues_repo_name: sunprinceS/ReportHub

max_forks_repo_name: sunprinceS/ReportHub


text:
% This is part of the TFTB Reference Manual.
% Copyright (C) 1996 CNRS (France) and Rice University (US).
% See the file refguide.tex for copying conditions.

\markright{momttfr}
\section*{\hspace*{-1.6cm} momttfr}

\vspace*{-.4cm}
\hspace*{-1.6cm}\rule[0in]{16.5cm}{.02cm}
\vspace*{.2cm}

{\bf \large \sf Purpose}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
Time moments of a time-frequency representation.
\end{minipage}
\vspace*{.5cm}

{\bf \large \sf Synopsis}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
\begin{verbatim}
[fm,B2] = momttfr(tfr,method)
[fm,B2] = momttfr(tfr,method,fbmin)
[fm,B2] = momttfr(tfr,method,fbmin,fbmax)
[fm,B2] = momttfr(tfr,method,fbmin,fbmax,freqs)
\end{verbatim}
\end{minipage}
\vspace*{.5cm}

{\bf \large \sf Description}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
        {\ty momttfr} computes the time moments of order 1 and 2 of a
        time-frequency representation\,:
\[f_m(t) = \frac{1}{E}\ \int_{-\infty}^{+\infty} f\ \mbox{tfr}(t,f)\ df\ \
;\ \ B^2(t) = \frac{1}{E}\ \int_{-\infty}^{+\infty} f^2\ \mbox{tfr}(t,f)\ df -
f_m(t)^2.\]

\hspace*{-.5cm}\begin{tabular*}{14cm}{p{1.5cm} p{8.5cm} c}
Name & Description & Default value\\
\hline
        {\ty tfr}   & time-frequency representation (size {\ty (N,M)})\\
        {\ty method}& chosen representation (name of the corresponding M-file). \\
        {\ty fbmin} & smallest frequency bin & {\ty 1}\\
        {\ty fbmax} & highest  frequency bin & {\ty M}\\
        {\ty freqs} & true frequency of each frequency bin. {\ty freqs} must be of
                length {\ty fbmax-fbmin+1} & auto\footnote{{\ty freqs} goes
		from 0 to 0.5 or from -0.5 to 0.5 depending on {\ty method}.}\\
 \hline {\ty fm}    & averaged frequency     (first order moment)\\
        {\ty B2}    & squared frequency bandwidth (second order moment)\\

\hline
\end{tabular*}

\end{minipage}
\vspace*{1cm}

{\bf \large \sf Examples}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
\begin{verbatim}
         sig=fmlin(200,0.1,0.4); tfr=tfrwv(sig);
         [fm,B2]=momttfr(tfr,'tfrwv');
         subplot(211); plot(fm); subplot(212); plot(B2);
         freqs=linspace(0,99/200,100); tfr=tfrsp(sig);
         [fm,B2]=momttfr(tfr,'tfrsp',1,100,freqs);
         subplot(211); plot(fm); subplot(212); plot(B2);
\end{verbatim}
\end{minipage}

%\newpage

\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
The first order moment represents an estimation of the instantaneous
frequency, and the second order moment the variance of this estimator. We
can see that the estimation is better around the time center position than
at the edges of the observation interval. Besides, the second estimator
(using the spectrogram) has a lower variance than the first one (using the
Wigner-Ville distribution), but presents an important bias.
\end{minipage}
\vspace*{1cm}

{\bf \large \sf See Also}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
\begin{verbatim}
momftfr, margtfr.
\end{verbatim}
\end{minipage}

max_stars_repo_name: sangyoonHan/extern

max_issues_repo_name: sangyoonHan/extern

max_forks_repo_name: sangyoonHan/extern


text:
\subsection*{\codingRule{}}

Variables with automatic storage duration shall be initialized before use.

\subsubsection{Reasoning}

The value of an automatic variable that is not initialized is undefined. Explicit initialization shall hence be done before using the variable, either when declaring the variable or just before the variable is used for the first time.

\noindent
\begin{minipage}[t]{\codelstwidth\linewidth}
	\begin{lstlisting}[
        xleftmargin = 3.4pt,
		title = {Non-Compliant}
	]
int foo(void)
{
	uint32_t i;
	return i;
}
\end{lstlisting}
\end{minipage}
\hfill
\begin{minipage}[t]{\codelstwidth\linewidth}
\begin{lstlisting}[title={Compliant}]
int foo(void)
{
	uint32_t i = 0;
	return i;
}
\end{lstlisting}
\end{minipage}

max_stars_repo_name: HenrikSamuelsson/c-coding-standard

max_issues_repo_name: HenrikSamuelsson/c-coding-standard

max_forks_repo_name: HenrikSamuelsson/c-coding-standard


text: \section{Additional Plots}


text:
\chapter{Interlude: eighteen examples of affine schemes}
\label{ch:spec_examples}
To cement in the previous two chapters,
we now give an enormous list of examples.
Each example gets its own section,
rather than having page-long orange boxes.

One common theme you will find as you wade through
the examples is that your geometric intuition may
be better than your algebraic one.
For example, while studying $k[x,y] / (xy)$ you will say
``geometrically, I expect so-and-so to look like other thing'',
but when you write down the algebraic statements
you find two expressions that are don't look equal to you.
However, if you then do some calculation you will
find that they were isomorphic after all.
So in that sense, in this chapter you will learn to begin drawing
pictures of algebraic statements --- which is great!

As another example, all the lemmas about
prime ideals from our study of localizations
will begin to now take concrete forms:
you will see many examples that
\begin{itemize}
	\ii $\Spec A/I$ looks like $\VV(I)$ of $\Spec A$,
	\ii $\Spec A[1/f]$ looks like $D(f)$ of $\Spec A$,
	\ii $\Spec A_\kp$ looks like $\OO_{\Spec A, \kp}$ of $\Spec A$.
\end{itemize}

In everything that follows, $k$ is any field.
We will also use the following color connotations:
\begin{itemize}
	\ii The closed points of the scheme are drawn in blue.
	\ii Non-closed points are drawn in red,
	with their ``trails'' dotted red.
	\ii Stalks are drawn in green, when they appear.
\end{itemize}

\section{Example: $\Spec k$, a single point}
This one is easy: for any field $k$,
$X = \Spec k$ has a single point,
corresponding to the only proper ideal $(0)$.
There is only way to put a topology on it.

As for the sheaf,
\[ \OO_X(X) = \OO_{X,(0)} = k. \]
So the space is remembering what field it wants to be over.
If we are complex analysists,
the set of functions on a single point is $\CC$;
if we are number theoerists,
maybe the set of functions on a single point is $\QQ$.

%%fakechapter One-dimensional
\section{$\Spec \CC[x]$, a one-dimensional line}
The scheme $X = \Spec \CC[x]$ is our beloved one-dimensional line.
It consists of two types of points:
\begin{itemize}
	\ii The closed points $(x-a)$, corresponding to each
	complex number $a \in \CC$, and
	\ii The \emph{generic} point $(0)$.
\end{itemize}
As for the Zariski topology, every open set contains $(0)$,
which captures the idea it is close to everywhere:
no matter where you stand, you can still here the buzzing of the fly!
True to the irreducibility of this space,
the open sets are huge:
the proper \emph{closed sets} consist of finitely many closed points.

Here is a picture:
for lack of better place to put it,
the point $(0)$ is floating around just above the line in red.
\begin{center}
	\begin{asy}
		size(8cm);
		pair A = (-8,0); pair B = (8,0);
		draw(A--B, blue, Arrows);
		dot("$(x)$", (0,0), dir(-90), blue);
		dot("$(x-3)$", (3,0), dir(-90), blue);
		dot("$(x+i)$", (-4,0), dir(-90), blue);
		dot("$(0)$", (0,1), dir(90), red);
		draw( (-6,0)..(-3,0.5)..(-1,1)--(1,1)--(3,0.5)--(6,0), dotted+red );
		label("$\operatorname{Spec} \mathbb C[x]$", A, dir(-90), blue);
	\end{asy}
\end{center}

The notion of ``value at $\kp$'' works as expected.
For example, $f = x^2+5$ is a global section of $\CC[x]$.
If we evaluate it at $\kp = x-3$,
we find $f(\kp) = f \pmod \kp = x^2+5 \pmod{x-3} = 14 \pmod{x-3}$.
Indeed, \[ \kappa(\kp) \cong \CC \]
meaning the stalks all have residue field $\CC$.
As \[ \CC[x] / \kp \cong \CC \qquad \text{by $x \mapsto 3$} \]
we see we are just plugging $x=3$.

Of course, the stalk at $(x-3)$ carries more information.
In this case it is $\CC[x]_{(x-3)}$.
Which means that if we stand near the point $(x-3)$,
rational functions are all fine as long as no $x-3$
appears in the denominator.
So, $\frac{x^2+8}{(x-1)(x-5)}$ is a fine example of a germ near $x=3$.

Things get more interesting if we
consider the generic point $\eta = (0)$.

What is the stalk $\OO_{X, \eta}$?
Well, it should be $\CC[x]_{(0)} = \CC(x)$,
which is the again the set of \emph{rational} functions.
And that's what you expect.
For example, $\frac{x^2+8}{(x-1)(x-5)}$
certainly describes a rational function on ``most'' complex numbers.

What happens if we evaluate the global section
$f = x^2+5$ at $\eta$?
Well, we just get $f(\eta) = x^2+5$ ---
taking modulo $0$ doesn't do much.
Fitting, it means that if you want to be able to evaluate
a polynomial $f$ at a general complex number,
you actually just need the whole polynomial
(or rational function).
We can think of this in terms of the residue field being $\CC(x)$:
\[ \kappa( (0) ) = \Frac \left( \CC[x] / (0) \right)
	\cong \Frac \CC[x] = \CC(x). \]

\section{$\Spec \RR[x]$, a one-dimensional line
with complex conjugates glued (no fear nullstellensatz)}

Despite appearances, this actually
looks almost exactly like $\Spec \CC[x]$,
even more than you expect.
The main thing to keep in mind is that now $(x^2+1)$
is a point, which you can loosely think of as $\pm i$.
So it almost didn't matter that $\RR$ is not algebraically closed;
the $\CC$ is showing through anyways.
But this time, because we only consider
real coefficient polynomials,
we do not distinguish between ``conjugate'' $+i$ and $-i$.
Put another way, we have folded $a+bi$ and $a-bi$ into a single point:
$(x+i)$ and $(x-i)$ merge to form $x^2+1$.

To be explicit, there are three types of points:
\begin{itemize}
	\ii $(x-a)$ for each real number $a$
	\ii $(x^2-ax+b)$ if $a^2 < 4b$, and
	\ii the generic point $(0)$, again.
\end{itemize}
The ideals $(x-a)$ and $(x^2-ax+b)$
are each closed points:
the quotients with $\RR[x]$ are both fields
($\RR$ and $\CC$, respectively).

We have been drawing $\Spec \CC[x]$ as a one-dimensional line,
so $\Spec \RR[x]$ will be drawn the same way.
\begin{center}
	\begin{asy}
		size(8cm);
		pair A = (-8,0); pair B = (8,0);
		draw(A--B, blue, Arrows);
		dot("$(x)$", (0,0), dir(-90), blue);
		dot("$(x-3)$", (3,0), dir(-90), blue);
		dot("$(x^2+1)$", (-4,0), dir(-90), blue);
		dot("$(0)$", (0,1), dir(90), red);
		draw( (-6,0)..(-3,0.5)..(-1,1)--(1,1)--(3,0.5)--(6,0), dotted+red );
		label("$\operatorname{Spec} \mathbb R[x]$", A, dir(-90), blue);
	\end{asy}
\end{center}

One nice thing about this is that the nullstellensatz
is less scary than it was with classical varieties.
The short version is that the function $x^2+1$
vanishes at a point of $\Spec \RR[x]$, namely $(x^2+1)$ itself!
(So in some ways we're sort of automatically working
with the algebraic closure.)

You might remember a long time ago we made a big fuss about
the weak nullstellensatz, for example in
\Cref{prob:complex_variety_nonempty}:
if $I$ was a proper ideal in $\CC[x_1, \dots, x_n]$
there was \emph{some} point $(a_1, \dots, a_n) \in \CC^n$
such that $f(a_1, \dots, a_n) = 0$ for all $f \in I$.
With schemes, it doesn't matter anymore:
if $I$ is a proper ideal of a ring $A$,
then some maximal ideal contains it,
and so $\VV(I)$ is nonempty in $\Spec A$.

We better mention that the stalks this time look different than expected.
Here are some examples:
\begin{align*}
	\kappa\left( (x^2+1) \right) &\cong \RR[x]/(x^2+1) \cong \CC \\
	\kappa \left( (x-3) \right) &\cong \RR[x] / (x-3) \cong \RR \\
	\kappa \left( (0) \right) &\cong \Frac(\RR[x] / (0)) \cong \RR(x)
\end{align*}
Notice the residue fields above the ``complex''
points are bigger: functions on them take values in $\CC$.

\section{$\Spec k[x]$, over any ground field}
In general, if $\ol k$ is the algebraic closure of $k$,
then $\Spec k[x]$ looks like $\Spec \ol k[x]$
with all the Galois conjugates glued together.
So we will almost never need ``algebraically closed''
hypotheses anymore: we're working with polynomial ideals,
so all the elements are implicitly there, anyways.

\section{$\Spec \ZZ$, a one-dimensional scheme}
The great thing about $\Spec \ZZ$ is that
it basically looks like $\Spec k[x]$, too,
being a one-dimensional scheme.
It has two types of prime ideals:
\begin{itemize}
	\ii $(p)$, for every rational prime $p$,
	\ii and the generic point $(0)$.
\end{itemize}
So the picture almost does not change.
\begin{center}
	\begin{asy}
		size(8cm);
		pair A = (-8,0); pair B = (8,0);
		draw(A--B, blue, Arrows);
		dot("$(7)$", (0,0), dir(-90), blue);
		dot("$(3)$", (3,0), dir(-90), blue);
		dot("$(19)$", (-4,0), dir(-90), blue);
		dot("$(0)$", (0,1), dir(90), red);
		draw( (-6,0)..(-3,0.5)..(-1,1)--(1,1)--(3,0.5)--(6,0), dotted+red );
		label("$\operatorname{Spec} \mathbb Z$", A, dir(-90), blue);
	\end{asy}
\end{center}
This time $\eta = (0)$ has stalk $\ZZ_{(0)} = \QQ$,
so a ``rational function'' is literally a rational number!
Thus, $\frac{20}{19}$ is a function
with a double root at $(2)$, a root at $(5)$,
and a simple pole at $(19)$.
If we evaluate it at $\kp = (7)$, we get $3 \pmod 7$.
In general, the residue fields are what you'd guess:
\[ \kappa\left( (p) \right) = \ZZ/(p) \cong \FF_p \]
for each prime $p$, and
$\kappa\left( (0) \right) \cong \QQ$.

The stalk is bigger than the residue field at the closed points:
for example
\[ \OO_{\Spec \ZZ, (3)}
	\cong \left\{ \frac mn \mid 3 \nmid n \right\} \]
consists of rational numbers with no pole at $3$.
The stalk at the generic point is $\ZZ_{(0)} \cong \Frac \ZZ = \QQ$.

%%fakechapter 0D from 1D
\section{$\Spec k[x] / (x^2-x)$, two points}
If we were working with affine varieties,
you would already know what the answer is:
$x^2-x = 0$ has solutions $x=0$ and $x=1$,
so this should be a scheme with two points.

To see this come true, we use \Cref{prop:prime_quotient}:
the points of $\Spec k[x]/(x^2-x)$
should correspond to prime ideals of $k[x]$
contained in $(x^2-x)$.
As $k[x]$ is a PID, there are only two, $(x-1)$ and $(x)$.
They are each maximal,
since their quotient with $k[x]$ is a field (namely $k$),
so as promised $\Spec k[x] / (x^2-x)$ has just two closed points.

Each point has a stalk above it isomorphic to $k$.
A section on the whole space $X$ is just a choice
of two values, one at $(x)$ and one at $(x-1)$.
\begin{center}
\begin{asy}
	size(3cm);
	draw("$k$", (-2,0)--(-2,5), dir(180), heavygreen);
	draw("$k$", (2,0)--(2,5), heavygreen);
	dot("$(x)$", (-2,0), dir(-90), blue);
	dot("$(x-1)$", (2,0), dir(-90), blue);
	label("$\operatorname{Spec} k[x]/(x^2-x)$", (0,5), 2*dir(90));
\end{asy}
\end{center}
So actually, this is a geometric way of thinking about the
ring-theoretic fact that
\[ k[x] / \left( x^2-x \right) \cong k \times k
	\quad\text{by } f \mapsto \left( f(0), f(1) \right).  \]

Also, this is the first example of a reducible space in this chapter:
in fact $X$ is even disconnected.
Accordingly there is no generic point floating around:
as the space is discrete, all points are closed.

\section{$\Spec k[x]/(x^2)$, the double point}
We can now elaborate on the ``double point'' scheme
\[ X_2 = \Spec k[x] / (x^2) \]
since it is such an important motivating example.
How it does differ from the ``one-point'' scheme
$X_1 = \Spec k[x] / (x) = \Spec k$?
Both $X_2$ and $X_1$ have exactly one point,
and so obviously the topologies are the same too.

The difference is that the stalk
(equivalently, the section, since we have only one point)
is larger:
\[ \OO_{X_2, (x)} = \OO_{X_2}(X_2)  = k[x]/(x^2). \]
So to specify a function on a double point,
you need to specify two parameters, not just one:
if we take a polynomial
\[ f = a_0 + a_1 x + \dots \in k[x] \]
then evaluating it at the double point
will remember both $a_0$ and the ``first derivative'' say.

I should mention that if you drop all the way to the residue fields,
you can't tell the difference between
the double point and the single point anymore.
For the residue field of $\Spec k[x] / (x^2)$ at $(x)$ is
\[ \Frac\left( A / (x) \right) = \Frac k = k. \]
Thus the set of \emph{values} is still just $k$
(leading to the ``nilpotent'' discussion at the end of last chapter);
but the stalk, having ``enriched'' values,
can tell the difference.

\section{$\Spec k[x]/(x^3-x)$, a double point and a single point}
There is no problem putting the previous two examples side by side:
the scheme $X = \Spec k[x] / (x^3-x)$
consists of a double point next to a single point.
Note that the stalks are different:
the one above the double point is larger.
\begin{center}
\begin{asy}
	size(5cm);
	draw("$k[x] / (x^2)$", (-2,0)--(-2,7), dir(180), heavygreen);
	draw("$k$", (2,0)--(2,5), heavygreen);
	dot("$(x)$", (-2,0), dir(-90), blue+5);
	dot("$(x-1)$", (2,0), dir(-90), blue);
	label("$\operatorname{Spec} k[x]/(x^3-x)$", (0,7), 2*dir(90));
\end{asy}
\end{center}
This time, we implicitly have the ring isomorphism
\[ k[x] / (x^3-x) \cong k[x] / (x^2) \times k \]
by $f \mapsto \left( f(0) + f'(0) x, f(1) \right)$.
The derivative is meant formally here!

\section{$\Spec \Zc{60}$, a scheme with three points}
We've being seeing geometric examples of ring products coming up,
but actually the Chinese remainder theorem you are used to
with integers is no different.
(This example $X = \Spec \Zc{60}$
is taken from \cite[\S4.4.11]{ref:vakil}.)

By \Cref{prop:prime_quotient},
the prime ideals of $\Zc{60}$ are $(2)$, $(3)$, $(5)$.
But you can think of this also as coming out of $\Spec \ZZ$:
as $60$ was a function with a double root at $(2)$,
and single roots at $(3)$ and $(5)$.
\begin{center}
\begin{asy}
	size(6cm);
	draw("$\mathbb Z / 4 \mathbb Z$", (-2,0)--(-2,7), dir(180), heavygreen);
	draw("$\mathbb Z / 3 \mathbb Z$", (0,0)--(0,5), heavygreen);
	draw("$\mathbb Z / 5 \mathbb Z$", (2,0)--(2,6), heavygreen);
	dot("$(2)$", (-2,0), dir(-90), blue+5);
	dot("$(3)$", ( 0,0), dir(-90), blue);
	dot("$(5)$", ( 2,0), dir(-90), blue);
	label("$\operatorname{Spec} \mathbb Z / 60 \mathbb Z$", (0,7), 2*dir(90));
\end{asy}
\end{center}
Actually, although I have been claiming the ring isomorphisms,
the sheaves really actually give us a full proof.
Let me phrase it in terms of global sections:
\begin{align*}
	\Zc{60} &= \OO_X(X) \\
	&= \OO_X( \{(2)\} ) \times \OO_X( \{(3)\} ) \times \OO_X( \{(5)\} ) \\
	&= \OO_{X,(2)} \times \OO_{X,(3)} \times \OO_{X,(5)} \\
	&= \Zc4 \times \Zc3 \times \Zc5.
\end{align*}
So the theorem that $\OO_X(X) = A$ for $X = \Spec A$
is doing the ``work'' here;
the sheaf axioms then give us the Chinese remainder theorem from here.

On that note, this gives us a way of thinking about
the earlier example that
\[ (\Zc{60})[1/5] \cong \Zc{12}. \]
Indeed, $\Spec \Zc{60}[1/5]$ is supposed to look
like the distinguished open set $D(5)$:
which means we delete the point $(5)$ from the picture above.
That leaves us with $\Zc{12}$.

%%fakechapter Two-dimensional
\section{$\Spec k[x,y]$, the two-dimensional plane}
We have seen this scheme already: it is visualized as a plane.
There are three types of points:
\begin{itemize}
	\ii The closed points $(x-a, y-b)$,
	which consists of single points of the plane.
	\ii A non-closed point $(f(x,y))$ for any irreducible
	polynomial $f$, which floats along some irreducible curve.
	We illustrate this by drawing the dotted curve along
	which the point is floating.
	\ii The generic point $(0)$, floating along the entire plane.
	I don't know a good place to put it in the picture,
	so I'll just put it somewhere and draw a dotted circle around it.
\end{itemize}

Here is an illustration of all three types of points.
\begin{center}
\begin{asy}
	real f(real x) { return x*x; }
	graph.xaxis("$x$");
	graph.yaxis("$y$");
	draw(graph(f,-2,2,operator ..), red+dotted, Arrows(TeXHead));
	dot("$(y-x^2)$", (1.3, f(1.3)), dir(-45), red);
	dot("$(x-1,y+2)$", (1,-2), dir(-45), blue);
	pair O = (-3,3);
	dot("$(0)$", O, dir(225), red);
	filldraw(CR(O, 0.8), opacity(0.2)+lightred, dotted+red);
\end{asy}
\end{center}

We also go ahead and compute the stalks above each point.
\begin{itemize}
	\ii The stalk above $(x-1, y+2)$ is
	the set of rational functions $\frac{f(x,y)}{g(x,y)}$
	such that $g(1,-2) \ne 0$.
	\ii The stalk above the non-closed point $(y-x^2)$
	the set of rational functions $\frac{f(x,y)}{g(x,y)}$
	such that $g(t, t^2) \ne 0$.
	For example the function $\frac{xy}{x+y-2}$ is still fine;
	despite the fact it vanishes at the point $(1,1)$ and $(-2,4)$
	on the parabola it is a function
	on a ``generic point'' (crudely, ``most points'') of the parabola.
	\ii The stalk above $(0)$ is the entire fraction field
	$k(x,y)$ of rational functions.
\end{itemize}

Let's consider the global section $f = x^2 + y^2$
and also take the value at each of the above points.
\begin{itemize}
	\ii $f \pmod{x-1,y-2} = 5$, so $f$ has value $5$ at $(x-1, y+2)$.
	\ii The new bit is that we can think of evaluating
	$f$ along the parabola too --- it is given a particular value
	in the quotient $k[x,y] / (y-x^2)$.
	We can think of it as $f = x^2+y^2 \equiv x^2+x^4 \pmod{y-x^2}$ for example.
	Note that if we know the value of $f$ at the generic point of the parabola,
	we can therefore also evaluate it at any closed point on the parabola.
	\ii At the generic point $(0)$, $f \pmod{0} = f$.
	So ``evaluating at the generic point'' does nothing, as in any other scheme.
\end{itemize}

\section{$\Spec \ZZ[x]$, a two-dimensional scheme, and Mumford's picture}
We saw $\Spec \ZZ$ looked a lot like $\Spec k[x]$,
and we will now see that $\Spec \ZZ[x]$ looks a lot like $\Spec k[x,y]$.

There is a famous picture of this scheme in Mumford's ``red book'',
which I will produce here for culture-preservation reasons,
even though there are some discrepancies between
the pictures that we previously drew.
\begin{center}
	\includegraphics[width=0.9\textwidth]{media/mumforddrawing.jpg}
\end{center}
Mumford uses $[\kp]$ to denote the point $\kp$,
which we don't, so you can ignore the square brackets that appear everywhere.
The non-closed points are illustrated as balls of fuzz.

As before, there are there types of prime ideals,
but they will look somewhat more different:
\begin{itemize}
	\ii The closed points are now pairs $(p, f(x))$
	where $p$ is a prime and $f$ is an irreducible polynomial modulo $p$.
	Indeed, these are the maximal ideals:
	the quotient $\ZZ[x] / (p,f)$ becomes some finite extension of $\FF_p$.
	\ii There are now two different ``one-dimensional'' non-closed points:
	\begin{itemize}
		\ii Each rational prime gives a point $(p)$ and
		\ii Each irreducible polynomial $f$ gives a point $(f)$.
	\end{itemize}
	Indeed, note that the quotients of $\ZZ[x]$ by each are integral domains.
	\ii $\ZZ[x]$ is an integral domain,
	so as always $(0)$ is our generic point for the entire space.
\end{itemize}
There is one bit that I would do differently,
in $\VV(3)$ and $\VV(7)$, there ought to be a point $(3,x^2+1)$,
which is not drawn as a closed point in the picture,
but rather as dashed oval.
This is not right in the topological sense:
as $\km = (3, x^2+1)$ is a maximal ideal,
so it really is one closed point in the scheme.
But the reason it might be thought of as ``doubled'',
is that $\ZZ[x] / (3,x^2+1)$,
the residue field at $\km$,
is a two-dimensional $\FF_3$ vector space.

%%fakechapter 1D cut out from 2D
\section{$\Spec k[x,y]/(y-x^2)$, the parabola}
\label{sec:parabola}
By \Cref{prop:prime_quotient},
the prime ideals of $k[x,y] / (y-x^2)$
correspond to the prime ideals of $k[x,y]$ which are supersets of $(y-x^2)$,
or equivalently the points of $\Spec k[x,y]$ contained
inside the closed set $\VV(y-x^2)$.
Moreover, the subspace topology on $\VV(y-x^2)$
coincides with the topology on $\Spec k[x,y] / (y-x^2)$.

\begin{center}
\begin{asy}
	real f(real x) { return x*x; }
	draw(graph(f,-2,2,operator ..), blue, Arrows(TeXHead));
	label("$\operatorname{Spec} k[x,y]/(y-x^2)$", (0, f(0)), dir(-90), blue);
\end{asy}
\end{center}

This holds much more generally:
\begin{exercise}
	[Boring check]
	Show that if $I$ is an ideal of a ring $A$,
	then $\Spec A/I$ is homeomorphic as a topological space
	to the closed subset $\VV(I)$ of $\Spec A$.
\end{exercise}
So this is the notion of ``closed embedding'':
the parabola, which was a closed subset of $\Spec k[x,y]$,
is itself a scheme.
It will be possible to say more about this,
once we actually define the notion of a morphism.

The sheaf on this scheme only remembers the functions
on the parabola, though: the stalks are not ``inherited'', so to speak.
To see this, let's compute the stalk at the origin:
\Cref{thm:localization_commute_quotient} tells us it is
\[ k[x,y]_{(x,y)} / (y-x^2)
	\cong k[x,x^2]_{(x,x^2)}
	\cong k[x]_{(x)} \]
which is the same as the stalk
of the affine line $\Spec k[x]$ at the origin.
Intuitively, not surprising;
if one looks at any point of the parabola near the origin,
it looks essentially like a line,
as do the functions on it.

The stalk above the generic point is $\Frac(k[x,y] / (y-x^2))$:
so rational functions, with the identification that $y = x^2$.
Also unsurprising.

Finally, we note expect the parabola is actually isomorphic to $\Spec k[x]$,
since there is an isomorphism $k[x,y] / (y-x^2) \cong k[x]$
by sending $y \mapsto x^2$.
Pictorially, this looks like ``un-bending'' the hyperbola.
In general, we would hope that when two rings $A$ and $B$ are isomorphic,
then $\Spec A$ and $\Spec B$ should be ``the same''
(otherwise we would be horrified),
and we'll see later this is indeed the case.

\section{$\Spec \ZZ[i]$, the Gaussian integers (one-dimensional)}
You can play on this idea some more in the integer case.
Note that \[ \ZZ[i] \cong \ZZ[x] / (x^2+1) \]
which means this is a ``dimension-one'' closed set within $\Spec \ZZ[x]$.
In this way, we get a scheme whose elements are \emph{Gaussian primes}.

You can tell which closed points are ``bigger'' than others
by looking at the residue fields.
For example the residue field of the point $(2+i)$ is
\[ \kappa\left( (2+i) \right) = \ZZ[i] / (2+i) \cong \FF_5 \]
but the residue field of the point $(3)$ is
\[ \kappa\left( (3) \right) \cong \ZZ[i] / (3) \cong \FF_9 \]
which is a degree two $\FF_3$-extension.

\section{Long example: $\Spec k[x,y]/(xy)$, two axes}
This is going to be our first example of a non-irreducible scheme.

\subsection{Picture}
Like before, topologically it looks like the closed set $\VV(xy)$
of $\Spec k[x,y]$.
Here is a picture:
\begin{center}
\begin{asy}
	draw( (-4,0)--(4,0), blue, Arrows);
	draw( (0,-4)--(0,4), blue, Arrows);
	dot("$(x)$", (0.3,3), dir(-45), lightred);
	dot("$(y)$", (3, 0.3), dir(135), lightred);
	draw( (0.3,3.6)--(0.3,2.4), lightred+dotted );
	draw( (2.4,0.3)--(3.6,0.3), lightred+dotted );
	dot("$(x+2)$", (-2,0), dir(-90), blue);
	dot("$(y+3)$", (0,-3), dir(0), blue);
\end{asy}
\end{center}
To make sure things are making sense:
\begin{ques}
	[Sanity check]
	Verify that $(y+3)$ is really a maximal ideal of $\Spec k[x,y] / (xy)$
	lying in $\VV(x)$.
\end{ques}

The ideal $(0)$ is longer prime,
so it is not a point of this space.
Rather, there are two non-closed points this time:
the ideals $(x)$ and $(y)$,
which can be visualized as floating around each of the two axes.
This space is reducible,
since it can be written as the union
of two proper closed sets, $\VV(x) \cup \VV(y)$.
(It is still \emph{connected}, as a topological space.)

\subsection{Throwing out the $y$-axis}
Consider the distinguished open set $U = D(x)$.
This corresponds to deleting $\VV(x)$, the $y$-axis.
Therefore we expect that $D(x)$
``is'' just $\Spec k[x]$ with the origin deleted,
and in particular that we should get $k[x, x\inv]$
for the sections.
Indeed,
\begin{align*}
	\OO_{\Spec k[x,y]/(xy)} (D(x))
	&\cong (k[x,y]/(xy))[1/x] \\
	&\cong k[x, x\inv, y] / (xy) \cong k[x, x\inv, y] / (y) \cong k[x, x\inv].
\end{align*}
where $(xy) = (y)$ follows from $x$ being a unit.
Everything as planned.

\subsection{Stalks above some points}
Let's compute the stalk above the point $\km = (x+2)$,
which we think of as the point $(-2,0)$ on the $x$-axis.
(If it makes you more comfortable, note that $\km \ni y(x+2) = 2y$
and hence $y \in \km$, so we could also write $\km = (x+2,y)$.)
The stalk is
\[ \OO_{\Spec k[x,y] / (xy), \km} = k[x,y]_{(x+2)} / (xy). \]
This might look confusing until we realize that $\frac1x$
is an element of $k[x,y]_{(x+2)}$, so $x$ is a unit;
thus $(xy)$ and $(y)$ specify the same ideal and
\[ \OO_{\Spec k[x,y] / (xy), (x+2)} \cong k[x,y]_{(x+2)} / (y)
	\cong k[x]_{(x+2)}  \]
which anyways looks just like the stalk of $(x+2)$ in $\Spec k[x]$.
That's expected.
If we have a space with two lines but we're
standing away from the origin,
then the stalk is not going to pick up the weird behavior
at that far-away point;
it only cares about what happens near $\km$,
and so it looks just like an affine line there.

The generic point $(y)$ (which floats around the $x$-axis)
will tell a similar tale:
if we look at the stalk above it,
we ought to find that it doesn't recognize the presence of the $y$-axis,
because ``nearly all'' points don't recognize it either.
To actually compute the stalk:
\[ \OO_{\Spec k[x,y] / (xy), (y)} = k[x,y]_{(y)} / (xy). \]
Again as $\frac1x$ is an element of $k[x,y]_{(y)}$,
we have $(xy) = (y)$ and thus
\[ \OO_{\Spec k[x,y] / (xy), (y)} = k[x,y]_{(y)} / (y)
	\cong k[x]_{(0)} \cong k(x). \]
which is what we expected
(it is the same as the stalk above $(0)$ in $\Spec k[x]$).

\subsection{Stalk above the origin (tricky)}
The stalk above the origin $(x,y)$ is interesting,
and has some ideas in it we won't be able to explore fully
without talking about localizations of modules.
We could of course write it as
\[ (k[x,y] / (xy))_{(x,y)}
	= k[x,y]_{(x,y)} / (xy). \]
and hence the elements should be
\[ \frac{c + (a_1 x + a_2 x^2 + \dots)
	+ (b_1 y + b_2 y^2 + \dots)}
	{c' + (a_1' x + a_2' x^2 + \dots)
	+ (b_1' y + b_2' y^2 + \dots)}
\]
where $c' \ne 0$.

You might feel unsatisfied with this characterization.
Here is some geometric intuition.
You can write the global section ring as
\[ k[x,y] / (xy) = c + (a_1 x + a_2 x^2 + \dots)
	+ (b_1 y + b_2 y^2 + \dots) \]
meaning that any global section is the sum of an $x$-polynomial
and a $y$-polynomial.
This is \emph{not} just the ring product $k[x] \times k[y]$, though:
because the constant term is shared.
So it is better thought of as pairs of polynomials in $k[x]$
and $k[y]$ which agree on the constant term.

If you like category theory, it is thus a fibered product
\[ k[x,y] / (xy) \cong k[x] \times_k k[y] \]
with morphism $k[x] \to k$ and $k[y] \to k$ by sending $x$ and $y$ to zero.
In that way, we can mostly decompose $k[x,y] / (xy)$
into its two components.

We really ought to be able to do the same as the stalk:
we wish to say that
\[ \OO_{\Spec k[x,y] / (xy), (x,y)}
	\cong k[x]_{(x)} \times_k k[y]_{(y)}. \]
English translation: a ``typical'' germ
ought to look like $\frac{3+x}{x^2+7} + \frac{4+y^3}{y^2+y+7}$,
with the $x$ and $y$ parts decoupled.
Equivalently, the stalk should consist of
pairs of $x$-germs and $y$-germs that agree at the origin.

In fact, this is true!
This might come as a surprise, but let's see why we expect this.
Suppose we take the germ
\[ \frac{1}{1-(x+y)}. \]
If we hold our breath, we could imagine expanding it as
a geometric series: $1 + (x+y) + (x+y)^2 + \dots$.
As $xy =0 $, this just becomes $1+x+x^2+x^3 + \dots + y+y^2+y^3+\dots$.
This is nonsense (as written), but nonetheless it suggests the conjecture
\[ \frac{1}{1-(x+y)} = \frac{1}{1-x} + \frac{1}{1-y} - 1 \]
which you can actually verify is true.
\begin{ques}
	Check this identity holds.
\end{ques}

Of course, this is a lot of computation just for one simple example.
Is there a way to make it general?
Yes: the key claim is that ``localization commutes with \emph{limits}''.
You can try to work out the statement now if you want, but we won't do so.
% \todo{but if we ever do sheaves of modules, then we will}

%%fakechapter 1D with holes
\section{$\Spec k[x,x\inv]$, the punctured line (or hyperbola)}
This is supposed to look like $D(x)$ of $\Spec k[x]$,
or the line with the origin deleted it.
Alternatively, we could also write
\[ k[x,x\inv] \cong k[x,y] / (xy-1) \]
so that the scheme could also be drawn as a hyperbola.

First, here's the 1D illustration.
\begin{center}
	\begin{asy}
		size(8cm);
		pair A = (-8,0); pair B = (8,0);
		draw(A--B, blue, Arrows);
		dot("$(x-3)$", (3,0), dir(-90), blue);
		dot("$(x+2)$", (-2,0), dir(-90), blue);
		dot("$(0)$", (0,1), dir(90), red);
		opendot(origin, blue+1.5);
		draw( (-6,0)..(-3,0.5)..(-1,1)--(1,1)--(3,0.5)--(6,0), dotted+red );
		label("$\operatorname{Spec} k[x,x^{-1}]$", A, dir(-90), blue);
	\end{asy}
\end{center}
We actually saw this scheme already when we took $\Spec k[x,y] / (xy)$
and looked at $D(y)$, too.
Anyways, let us compute the stalk at $(x-3)$ now; it is
\[ \OO_{\Spec k[x,x\inv], (x-3)}
	\cong k[x,x\inv]_{(x-3)}
	\cong k[x]_{(x-3)} \]
since $x\inv$ is in $k[x]_{(x-3)}$ anyways.
So again, we see that the deletion of the origin
doesn't affect the stalk at the farther away point $(x-3)$.

As mentioned, since $k[x,x\inv]$ is isomorphic to $k[x,y] / (xy-1)$,
another way to draw the visualize the same curve
would be to draw the hyperbola
(which you can imagine as flattening to give the punctured line.)
There is one generic point $(0)$ since $k[x,y]/(xy-1)$
really is an integral domain,
as well as points like $(x+2, y+1/2) = (x+2) = (y+1/2)$.
\begin{center}
	\begin{asy}
		size(7cm);
		import graph;
		graph.xaxis("$x$", -4, 4);
		graph.yaxis("$y$", -4, 4);

		real f (real x) { return 1/x; }
		draw(graph(f,-4,-0.25,operator ..), blue);
		draw(graph(f,0.25,4,operator ..), blue);
		label("$\operatorname{Spec} k[x,y] / (xy-1)$", (1,1), dir(45), blue);

		dot("$(0)$", (0.4,2), dir(225), red);
		filldraw(CR( (0.4,2), 0.3 ), opacity(0.1)+lightred, red+dotted);
		dot("$(x+2)$", (-2, f(-2)), dir(10), blue);
	\end{asy}
\end{center}

%%fakechapter 0D --- stalks above 1D
\section{$\Spec k[x]_{(x)}$, zooming in to the origin of the line}
We know already that $\OO_{\Spec A, \kp} \cong A_\kp$:
so $A_\kp$ should be the stalk at $\kp$.
In this example we will see that $\Spec A_\kp$
should be drawn sort of as this stalk, too.

We saw earlier how to draw a picture of $\Spec k[x]$.
You can also draw a picture of the stalk above the origin $(x)$,
which you might visualize as a grass or other plant
growing above $(x)$ if you like agriculture.
In that case, $\Spec k[x]_{(x)}$ might look like what happens
if you pluck out that stalk from the affine line.

\begin{center}
	\begin{asy}
		unitsize(0.7cm);
		pair A = (-5,0); pair B = (5,0);
		draw(A--B, blue, Arrows);
		draw( (-4,0)..(-2,0.5)..(-1,1)--(1,1)--(2,0.5)--(4,0), dotted+red );
		label("$\operatorname{Spec} k[x]$", A, dir(-90), blue);
		draw( (0,0)--(0,3), heavygreen);
		label("$\mathcal O_{\operatorname{Spec} k[x], (x)}$", (0,3), dir(90), heavygreen);
		dot("$(x)$", (0,0), dir(-90), blue);
		dot("$(0)$", (0.2,1), dir(45), red);
		add(shift(-9,0)*CC());
		draw("pluck", (-4.5, 1.5)--(-1.5,1.5), dir(90), black, EndArrow(TeXHead));
		// now the stalk
		draw( (0,0)--(0,3), heavygreen);
		label("$\operatorname{Spec} k[x]_{(x)}$", (0,3), dir(90), blue);
		draw( (-1,1)--(1,1), dotted+red );
		dot("$(0)$", (0.2,1), dir(45), red);
		dot("$(x)$", (0,0), dir(-90), blue);
	\end{asy}
\end{center}

Since $k[x]_{(x)}$ is a local ring
(it is the localization of a prime ideal),
this point has only one closed point: the maximal ideal $(x)$.
However, surprisingly, it has one more point:
a ``generic'' point $(0)$.
So $\Spec k[x]_{(x)}$ is a \emph{two-point space},
but it does not have the discrete topology:
$(x)$ is a closed point, but $(0)$ is not.
(This makes it a nice counter-example for exercises of various sorts.)

So, topologically what's happening is that when we zoom in to $(x)$,
the generic point $(0)$ (which was ``close to every point'') remains,
floating above the point $(x)$.

Note that the stalk above our single closed point $(x)$
is the same as it was before:
\[ \left( k[x]_{(x)} \right)_{(x)} \cong k[x]_{(x)}. \]
Indeed, in general if $R$ is a local ring with maximal ideal $\km$,
then $R_\km \cong R$:
since every element $x \notin \km$ was invertible anyways.
Thus in the picture, the stalk is drawn the same.

Similarly, the stalk above $(0)$ is the same as it was
before we plucked it out:
\[ \left( k[x]_{(x)} \right)_{(0)}
	= \Frac k[x]_{(x)} = k(x). \]
More generally:
\begin{exercise}
	Let $A$ be a ring, and $\kq \subseteq \kp$ prime ideals.
	Check that $A_\kq \cong (A_\kp)_\kq$,
	where we view $\kq$ as a prime ideal of $A_\kp$.
\end{exercise}
So when we zoom in like this, all the stalks stay the same,
even above the non-closed points.

\section{$\Spec k[x,y]_{(x,y)}$, zooming in to the origin of the plane}
The situation is more surprising if we pluck the stalk
above the origin of $\Spec k[x,y]$,
the two-dimensional plane.
The points of $\Spec k[x,y]_{(x,y)}$ are supposed to be
the prime ideals of $k[x,y]$ which are contained in $(x,y)$;
geometrically these are $(x,y)$ and the generic points passing through the origin.
For example, there will be a generic point for the parabola $(y-x^2)$
contained in $k[x,y]_{(x,y)}$,
and another one $(y-x)$ corresponding to a straight line, etc.

So we have the single closed point $(x,y)$ sitting at the bottom,
and all sorts of ``one-dimensional'' generic points floating above it:
lines, parabolas, you name it.
Finally, we have $(0)$, a generic point floating in two dimensions,
whose closure equals the entire space.
\begin{center}
	\begin{asy}
		size(6cm);
		draw( (0,0)--(0,3), heavygreen);
		label("$\operatorname{Spec} k[x,y]_{(x,y)}$", (0,3), dir(90), blue);
		draw( (-1,0.1)--(1,1.1), dotted+red );
		dot("$(3x-2y)$", (0.4,0.8), dir(-45), red);
		path p1 = (-0.5,2.5)..(0,2)..(0.5,2.5);
		draw(p1, dotted+red);
		dot("$(y-x^2)$", relpoint(p1,0.3), dir(200), red);
		path p2 = (-1,1.3)..(-0.5,1.8)..(0,1.6)..(0.5,1.4)..(1,1.9);
		draw(p2, dotted+red);
		dot("$(2y-x^3)$", relpoint(p2,0.7), dir(-45), red);
		dot("$(x,y)$", (0,0), dir(-90), blue);
		dot("$(0)$", (1.5,2.5), dir(225), red);
		filldraw(CR( (1.5,2.5), 0.5 ), opacity(0.1)+lightred, red+dotted);
	\end{asy}
\end{center}

\section{$\Spec k[x,y]_{(0)} = \Spec k(x,y)$, the stalk above the generic point}
The generic point of the plane just has stalk $\Spec k(x,y)$:
which is the spectrum of a field,
hence a single point.
The stalk remains intact as compared to when planted in $\Spec k[x,y]$;
the functions are exactly rational functions in $x$ and $y$.

% \section{$\Spec k[x,y]_{(y-x^2)}$, the stalk above the parabola}
% \section{$\Spec \ZZ_{(0)} = \Spec \QQ$}
% \section{$\Spec k[x,y]_{(0)}$, the stalk above the generic point}

%%fakechapter Problems
\section{\problemhead}
\begin{problem}
	Draw a picture of $\Spec \ZZ[1/55]$,
	describe the topology, and compute the stalk at each point.
\end{problem}

\begin{problem}
	Draw a picture of $\Spec \ZZ_{(5)}$,
	describe the topology, and compute the stalk at each point.
\end{problem}

\begin{problem}
	Let $A = (k[x,y]/(xy))[(x+y)\inv]$.
	Draw a picture of $\Spec A$.
	Show that it is not connected as a topological space.
\end{problem}

\begin{problem}
	Let $A = k[x,y]_{(y-x^2)}$.
	Draw a picture of $\Spec A$.
\end{problem}

max_stars_repo_name: aDotInTheVoid/ltxmk

max_issues_repo_name: aDotInTheVoid/ltxmk

max_forks_repo_name: aDotInTheVoid/ltxmk


text:
\documentclass[handout]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[francais]{babel}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{pgf}

\usetheme{Enac}
% \usetheme[rounded]{Enac}

\author{Gautier Hattenberger}

\title[Enac beamer theme]{Enac Beamer theme example}
\date{2018}

\begin{document}

\maketitle

\section{First section}

\begin{frame}
 \frametitle{Outline}
 \tableofcontents
\end{frame}

\subsection{Fisrt subsection}

\begin{frame}
 \frametitle{What a nice frame}

 You can use this theme with rectangle (default) or rounded blocks with the option \emph{rounded}

 \begin{block}{block}
  this is how a block looks like
 \end{block}
 \begin{exampleblock}{exampleblock}
  same for example block
 \end{exampleblock}
 \begin{alertblock}{alertblock}
  or for \alert{alert block} if it is really important
 \end{alertblock}
\end{frame}

\subsection{Second subsection}

\begin{frame}
 \frametitle{Yet another frame}
 A list
 \begin{itemize}
 \item item 1
 \item item 2
 \end{itemize}
 An enumarate
 \begin{enumerate}
  \item enum 1
  \item enum 2
 \end{enumerate}
 An equation
 \begin{displaymath}
  E = mc^2
 \end{displaymath}
\end{frame}
\end{document}

max_stars_repo_name: cyril-allignol/enac-beamer-theme

max_issues_repo_name: cyril-allignol/enac-beamer-theme

max_forks_repo_name: cyril-allignol/enac-beamer-theme