$$
\newcommand{\LetThereBe}[2]{\newcommand{#1}{#2}}
\newcommand{\letThereBe}[3]{\newcommand{#1}[#2]{#3}}
% Declare mathematics (so they can be overwritten for PDF)
\newcommand{\declareMathematics}[2]{\DeclareMathOperator{#1}{#2}}
\newcommand{\declareMathematicsStar}[2]{\DeclareMathOperator*{#1}{#2}}
% striked integral
\newcommand{\avint}{\mathop{\mathchoice{\,\rlap{-}\!\!\int}
{\rlap{\raise.15em{\scriptstyle -}}\kern-.2em\int}
{\rlap{\raise.09em{\scriptscriptstyle -}}\!\int}
{\rlap{-}\!\int}}\nolimits}
% \d does not work well for PDFs
\LetThereBe{\d}{\differential}
\LetThereBe{\Im}{\mathrm{Im}}
\LetThereBe{\Re}{\mathrm{Re}}
\letThereBe{\imOf}{1}{\Im\,#1}
\letThereBe{\reOf}{1}{\Re\,#1}
\letThereBe{\ImOf}{1}{\Im \brackets{#1}}
\letThereBe{\ReOf}{1}{\Re \brackets{#1}}
\letThereBe{\linefrac}{2}{#1/#2}
$$
$$
% Simply for testing
\LetThereBe{\foo}{\textrm{FIXME: this is a test!}}
% Font styles
\letThereBe{\mcal}{1}{\mathcal{#1}}
\letThereBe{\chem}{1}{\mathrm{#1}}
% Sets
\LetThereBe{\C}{\mathbb{C}}
\LetThereBe{\R}{\mathbb{R}}
\LetThereBe{\Z}{\mathbb{Z}}
\LetThereBe{\N}{\mathbb{N}}
\LetThereBe{\im}{\mathrm{i}}
% Sets from PDEs
\LetThereBe{\boundary}{\partial}
\letThereBe{\closure}{1}{\overline{#1}}
\letThereBe{\Contf}{1}{C^{#1}}
\letThereBe{\contf}{2}{\Contf{#2}(#1)}
\letThereBe{\compactContf}{2}{C_c^{#2}(#1)}
\letThereBe{\ball}{2}{B\brackets{#1, #2}}
\letThereBe{\closedBall}{2}{B\parentheses{#1, #2}}
\LetThereBe{\compactEmbed}{\subset\subset}
\letThereBe{\inside}{1}{#1^o}
\LetThereBe{\neighborhood}{\mcal O}
\letThereBe{\neigh}{1}{\neighborhood \brackets{#1}}
% Basic notation - vectors and random variables
\letThereBe{\vi}{1}{\boldsymbol{#1}} %vector or matrix
\letThereBe{\dvi}{1}{\vi{\dot{#1}}} %differentiated vector or matrix
\letThereBe{\vii}{1}{\mathbf{#1}} %if \vi doesn't work
\letThereBe{\dvii}{1}{\vii{\dot{#1}}} %if \dvi doesn't work
\letThereBe{\rnd}{1}{\mathup{#1}} %random variable
\letThereBe{\vr}{1}{\mathbf{#1}} %random vector or matrix
\letThereBe{\vrr}{1}{\boldsymbol{#1}} %random vector if \vr doesn't work
\letThereBe{\dvr}{1}{\vr{\dot{#1}}} %differentiated vector or matrix
\letThereBe{\vb}{1}{\pmb{#1}} %#TODO
\letThereBe{\dvb}{1}{\vb{\dot{#1}}} %#TODO
\letThereBe{\oper}{1}{\mathsf{#1}}
% Basic notation - general
\letThereBe{\set}{1}{\left\{#1\right\}}
\letThereBe{\seqnc}{4}{\set{#1_{#2}}_{#2 = #3}^{#4}}
\letThereBe{\Seqnc}{3}{\set{#1}_{#2}^{#3}}
\letThereBe{\brackets}{1}{\left( #1 \right)}
\letThereBe{\parentheses}{1}{\left[ #1 \right]}
\letThereBe{\dom}{1}{\mcal{D}\, \brackets{#1}}
\letThereBe{\complexConj}{1}{\overline{#1}}
\LetThereBe{\divider}{\; \vert \;}
\LetThereBe{\gets}{\leftarrow}
\letThereBe{\rcases}{1}{\left.\begin{aligned}#1\end{aligned}\right\}}
\letThereBe{\rcasesAt}{2}{\left.\begin{alignedat}{#1}#2\end{alignedat}\right\}}
\letThereBe{\lcases}{1}{\begin{cases}#1\end{cases}}
\letThereBe{\lcasesAt}{2}{\left\{\begin{alignedat}{#1}#2\end{alignedat}\right.}
\letThereBe{\evaluateAt}{2}{\left.#1\right|_{#2}}
\LetThereBe{\Mod}{\;\mathrm{mod}\;}
% Special symbols
\LetThereBe{\const}{\mathrm{const}}
\LetThereBe{\konst}{\mathrm{konst.}}
\LetThereBe{\vf}{\varphi}
\LetThereBe{\ve}{\varepsilon}
\LetThereBe{\tht}{\theta}
\LetThereBe{\Tht}{\Theta}
\LetThereBe{\after}{\circ}
\LetThereBe{\lmbd}{\lambda}
% Shorthands
\LetThereBe{\xx}{\vi x}
\LetThereBe{\yy}{\vi y}
\LetThereBe{\XX}{\vi X}
\LetThereBe{\AA}{\vi A}
\LetThereBe{\bb}{\vi b}
\LetThereBe{\vvf}{\vi \vf}
\LetThereBe{\ff}{\vi f}
\LetThereBe{\gg}{\vi g}
% Basic functions
\letThereBe{\absval}{1}{\left| #1 \right|}
\LetThereBe{\id}{\mathrm{id}}
\letThereBe{\floor}{1}{\left\lfloor #1 \right\rfloor}
\letThereBe{\ceil}{1}{\left\lceil #1 \right\rceil}
\declareMathematics{\image}{im} %image
\declareMathematics{\domain}{dom} %image
\declareMathematics{\tg}{tg}
\declareMathematics{\sign}{sign}
\declareMathematics{\card}{card} %cardinality
\letThereBe{\setSize}{1}{\left| #1 \right|}
\declareMathematics{\exp}{exp}
\letThereBe{\Exp}{1}{\exp\brackets{#1}}
\letThereBe{\indicator}{1}{\mathbb{I}_{#1}}
\declareMathematics{\arccot}{arccot}
\declareMathematics{\complexArg}{arg}
\declareMathematics{\gcd}{gcd} % Greatest Common Divisor
\declareMathematics{\lcm}{lcm} % Least Common Multiple
\letThereBe{\limInfty}{1}{\lim_{#1 \to \infty}}
\letThereBe{\limInftyM}{1}{\lim_{#1 \to -\infty}}
% Useful commands
\letThereBe{\onTop}{2}{\mathrel{\overset{#2}{#1}}}
\letThereBe{\onBottom}{2}{\mathrel{\underset{#2}{#1}}}
\letThereBe{\tOnTop}{2}{\mathrel{\overset{\text{#2}}{#1}}}
\letThereBe{\tOnBottom}{2}{\mathrel{\underset{\text{#2}}{#1}}}
\LetThereBe{\EQ}{\onTop{=}{!}}
\LetThereBe{\letDef}{:=} %#TODO: change the symbol
\LetThereBe{\isPDef}{\onTop{\succ}{?}}
\LetThereBe{\inductionStep}{\tOnTop{=}{induct. step}}
% Optimization
\declareMathematicsStar{\argmin}{argmin}
\declareMathematicsStar{\argmax}{argmax}
\letThereBe{\maxOf}{1}{\max\set{#1}}
\letThereBe{\minOf}{1}{\min\set{#1}}
\declareMathematics{\prox}{prox}
\declareMathematics{\loss}{loss}
\declareMathematics{\supp}{supp}
\letThereBe{\Supp}{1}{\supp\brackets{#1}}
\LetThereBe{\constraint}{\text{s.t.}\;}
$$
$$
% Operators - Analysis
\LetThereBe{\hess}{\nabla^2}
\LetThereBe{\lagr}{\mcal L}
\LetThereBe{\lapl}{\Delta}
\declareMathematics{\grad}{grad}
\declareMathematics{\Dgrad}{D}
\LetThereBe{\gradient}{\nabla}
\LetThereBe{\jacobi}{\nabla}
\LetThereBe{\Jacobi}{\vi{\mathrm J}}
\letThereBe{\jacobian}{2}{\Dgrad_{#1}\brackets{#2}}
\LetThereBe{\d}{\mathrm{d}}
\LetThereBe{\dd}{\,\mathrm{d}}
\letThereBe{\partialDeriv}{2}{\frac {\partial #1} {\partial #2}}
\letThereBe{\npartialDeriv}{3}{\partialDeriv{^{#1} #2} {#3^{#1}}}
\letThereBe{\partialOp}{1}{\frac {\partial} {\partial #1}}
\letThereBe{\npartialOp}{2}{\frac {\partial^{#1}} {\partial #2^{#1}}}
\letThereBe{\pDeriv}{2}{\partialDeriv{#1}{#2}}
\letThereBe{\npDeriv}{3}{\npartialDeriv{#1}{#2}{#3}}
\letThereBe{\deriv}{2}{\frac {\d #1} {\d #2}}
\letThereBe{\nderiv}{3}{\frac {\d^{#1} #2} {\d #3^{#1}}}
\letThereBe{\derivOp}{1}{\frac {\d} {\d #1}\,}
\letThereBe{\nderivOp}{2}{\frac {\d^{#1}} {\d #2^{#1}}\,}
$$
$$
% Linear algebra
\letThereBe{\norm}{1}{\left\lVert #1 \right\rVert}
\letThereBe{\scal}{2}{\left\langle #1, #2 \right\rangle}
\letThereBe{\avg}{1}{\overline{#1}}
\letThereBe{\Avg}{1}{\bar{#1}}
\letThereBe{\linspace}{1}{\mathrm{lin}\set{#1}}
\letThereBe{\algMult}{1}{\mu_{\mathrm A} \brackets{#1}}
\letThereBe{\geomMult}{1}{\mu_{\mathrm G} \brackets{#1}}
\LetThereBe{\Nullity}{\mathrm{nullity}}
\letThereBe{\nullity}{1}{\Nullity \brackets{#1}}
\LetThereBe{\nulty}{\nu}
\declareMathematics{\SpanOf}{span}
\letThereBe{\Span}{1}{\SpanOf\set{#1}}
% Linear algebra - Matrices
\LetThereBe{\tr}{\top}
\LetThereBe{\Tr}{^\tr}
\LetThereBe{\pinv}{\dagger}
\LetThereBe{\Pinv}{^\dagger}
\LetThereBe{\Inv}{^{-1}}
\LetThereBe{\ident}{\vi{I}}
\letThereBe{\mtr}{1}{\begin{pmatrix}#1\end{pmatrix}}
\letThereBe{\bmtr}{1}{\begin{bmatrix}#1\end{bmatrix}}
\declareMathematics{\trace}{tr}
\declareMathematics{\diagonal}{diag}
\declareMathematics{\rank}{rank}
$$
$$
% Statistics
\LetThereBe{\iid}{\overset{\text{i.i.d.}}{\sim}}
\LetThereBe{\ind}{\overset{\text{ind}}{\sim}}
\LetThereBe{\condp}{\,\vert\,}
\letThereBe{\complement}{1}{\overline{#1}}
\LetThereBe{\acov}{\gamma}
\LetThereBe{\acf}{\rho}
\LetThereBe{\stdev}{\sigma}
\LetThereBe{\procMean}{\mu}
\LetThereBe{\procVar}{\stdev^2}
\declareMathematics{\variance}{var}
\letThereBe{\Variance}{1}{\variance \brackets{#1}}
\declareMathematics{\cov}{cov}
\declareMathematics{\corr}{cor}
\letThereBe{\sampleVar}{1}{\rnd S^2_{#1}}
\letThereBe{\populationVar}{1}{V_{#1}}
\declareMathematics{\expectedValue}{\mathbb{E}}
\declareMathematics{\rndMode}{Mode}
\letThereBe{\RndMode}{1}{\rndMode\brackets{#1}}
\letThereBe{\expect}{1}{\expectedValue #1}
\letThereBe{\Expect}{1}{\expectedValue \brackets{#1}}
\letThereBe{\expectIn}{2}{\expectedValue_{#1} #2}
\letThereBe{\ExpectIn}{2}{\expectedValue_{#1} \brackets{#2}}
\LetThereBe{\betaF}{\mathrm B}
\LetThereBe{\fisherMat}{J}
\LetThereBe{\mutInfo}{I}
\LetThereBe{\expectedGain}{I_e}
\letThereBe{\KLDiv}{2}{D\brackets{#1 \parallel #2}}
\LetThereBe{\entropy}{H}
\LetThereBe{\diffEntropy}{h}
\LetThereBe{\probF}{\pi}
\LetThereBe{\densF}{\vf}
\LetThereBe{\att}{_t} %at time
\letThereBe{\estim}{1}{\hat{#1}}
\letThereBe{\estimML}{1}{\hat{#1}_{\mathrm{ML}}}
\letThereBe{\estimOLS}{1}{\hat{#1}_{\mathrm{OLS}}}
\letThereBe{\estimMAP}{1}{\hat{#1}_{\mathrm{MAP}}}
\letThereBe{\predict}{3}{\estim {\rnd #1}_{#2 | #3}}
\letThereBe{\periodPart}{3}{#1+#2-\ceil{#2/#3}#3}
\letThereBe{\infEstim}{1}{\tilde{#1}}
\letThereBe{\predictDist}{1}{{#1}^*}
\LetThereBe{\backs}{\oper B}
\LetThereBe{\diff}{\oper \Delta}
\LetThereBe{\BLP}{\oper P}
\LetThereBe{\arPoly}{\Phi}
\letThereBe{\ArPoly}{1}{\arPoly\brackets{#1}}
\LetThereBe{\maPoly}{\Theta}
\letThereBe{\MaPoly}{1}{\maPoly\brackets{#1}}
\letThereBe{\ARmod}{1}{\mathrm{AR}\brackets{#1}}
\letThereBe{\MAmod}{1}{\mathrm{MA}\brackets{#1}}
\letThereBe{\ARMA}{2}{\mathrm{ARMA}\brackets{#1, #2}}
\letThereBe{\sARMA}{3}{\mathrm{ARMA}\brackets{#1}\brackets{#2}_{#3}}
\letThereBe{\SARIMA}{3}{\mathrm{ARIMA}\brackets{#1}\brackets{#2}_{#3}}
\letThereBe{\ARIMA}{3}{\mathrm{ARIMA}\brackets{#1, #2, #3}}
\LetThereBe{\pacf}{\alpha}
\letThereBe{\parcorr}{3}{\rho_{#1 #2 | #3}}
\LetThereBe{\noise}{\mathscr{N}}
\LetThereBe{\jeffreys}{\mathcal J}
\LetThereBe{\likely}{\mcal L}
\letThereBe{\Likely}{1}{\likely\brackets{#1}}
\LetThereBe{\loglikely}{\mcal l}
\letThereBe{\Loglikely}{1}{\loglikely \brackets{#1}}
\LetThereBe{\CovMat}{\Gamma}
\LetThereBe{\covMat}{\vi \CovMat}
\LetThereBe{\rcovMat}{\vrr \CovMat}
\LetThereBe{\AIC}{\mathrm{AIC}}
\LetThereBe{\BIC}{\mathrm{BIC}}
\LetThereBe{\AICc}{\mathrm{AIC}_c}
\LetThereBe{\nullHypo}{H_0}
\LetThereBe{\altHypo}{H_1}
\LetThereBe{\rve}{\rnd \ve}
\LetThereBe{\rtht}{\rnd \theta}
\LetThereBe{\rX}{\rnd X}
\LetThereBe{\rY}{\rnd Y}
\LetThereBe{\rZ}{\rnd Z}
\LetThereBe{\rA}{\rnd A}
\LetThereBe{\rB}{\rnd B}
\LetThereBe{\vrZ}{\vr Z}
\LetThereBe{\vrY}{\vr Y}
\LetThereBe{\vrX}{\vr X}
\LetThereBe{\rW}{\rnd W}
\LetThereBe{\rS}{\rnd S}
\LetThereBe{\rM}{\rnd M}
\LetThereBe{\rtau}{\rnd \tau}
% Bayesian inference
\LetThereBe{\paramSet}{\mcal T}
\LetThereBe{\sampleSet}{\mcal Y}
\LetThereBe{\bayesSigmaAlg}{\mcal B}
\LetThereBe{\ltwo}{L^2}
\LetThereBe{\ltwoEq}{\onTop{=}{\ltwo}}
% Different types of convergence
\LetThereBe{\inDist}{\onTop{\to}{d}}
\letThereBe{\inDistWhen}{1}{\onBottom{\onTop{\longrightarrow}{d}}{#1}}
\LetThereBe{\inProb}{\onTop{\to}{P}}
\letThereBe{\inProbWhen}{1}{\onBottom{\onTop{\longrightarrow}{P}}{#1}}
\LetThereBe{\inMeanSq}{\onTop{\to}{\ltwo}}
\LetThereBe{\inltwo}{\onTop{\to}{\ltwo}}
\letThereBe{\inMeanSqWhen}{1}{\onBottom{\onTop{\longrightarrow}{\ltwo}}{#1}}
\LetThereBe{\convergeAS}{\tOnTop{\to}{a.s.}}
\letThereBe{\convergeASWhen}{1}{\onBottom{\tOnTop{\longrightarrow}{a.s.}}{#1}}
% Asymptotic qualities
\LetThereBe{\simAsymp}{\tOnTop{\sim}{as.}}
% Stochastic analysis
\letThereBe{\diffOn}{2}{\diff #1_{[#2]}}
% \LetThereBe{\timeSet}{\Theta}
\LetThereBe{\eventSet}{\Omega}
\LetThereBe{\filtration}{\mcal F}
% TODO: Rename allFiltrations and the like
\letThereBe{\allFiltrations}{1}{\set{\filtration_t}_{#1}}
\letThereBe{\natFilter}{1}{\filtration_t^{#1}}
\letThereBe{\NatFilter}{2}{\filtration_{#2}^{#1}}
\letThereBe{\filterAll}{1}{\set{#1}_{t \geq 0}}
\letThereBe{\FilterAll}{2}{\set{#1}_{#2}}
\LetThereBe{\borelAlgebra}{\mcal B}
\LetThereBe{\sAlgebra}{\mcal A}
\LetThereBe{\quadVar}{Q}
\LetThereBe{\totalVar}{V}
\LetThereBe{\adaptIntProcs}{\mcal M}
\letThereBe{\reflectProc}{2}{#1^{#2}}
$$
$$
% Distributions
\letThereBe{\WN}{2}{\mathrm{WN}\brackets{#1,#2}}
\declareMathematics{\uniform}{Unif}
\declareMathematics{\binomDist}{Bi}
\declareMathematics{\negbinomDist}{NBi}
\declareMathematics{\betaDist}{Beta}
\declareMathematics{\betabinomDist}{BetaBin}
\declareMathematics{\gammaDist}{Gamma}
\declareMathematics{\igammaDist}{IGamma}
\declareMathematics{\invgammaDist}{IGamma}
\declareMathematics{\expDist}{Ex}
\declareMathematics{\poisDist}{Po}
\declareMathematics{\erlangDist}{Er}
\declareMathematics{\altDist}{A}
\declareMathematics{\geomDist}{Ge}
\LetThereBe{\normalDist}{\mathcal N}
%\declareMathematics{\normalDist}{N}
\letThereBe{\normalD}{1}{\normalDist \brackets{#1}}
\letThereBe{\mvnormalD}{2}{\normalDist_{#1} \brackets{#2}}
\letThereBe{\NormalD}{2}{\normalDist \brackets{#1, #2}}
\LetThereBe{\lognormalDist}{\log\normalDist}
$$
$$
% Game Theory
\LetThereBe{\doms}{\succ}
\LetThereBe{\isdom}{\prec}
\letThereBe{\OfOthers}{1}{_{-#1}}
\LetThereBe{\ofOthers}{\OfOthers{i}}
\LetThereBe{\pdist}{\sigma}
\letThereBe{\domGame}{1}{G_{DS}^{#1}}
\letThereBe{\ratGame}{1}{G_{Rat}^{#1}}
\letThereBe{\bestRep}{2}{\mathrm{BR}_{#1}\brackets{#2}}
\letThereBe{\perf}{1}{{#1}_{\mathrm{perf}}}
\LetThereBe{\perfG}{\perf{G}}
\letThereBe{\imperf}{1}{{#1}_{\mathrm{imp}}}
\LetThereBe{\imperfG}{\imperf{G}}
\letThereBe{\proper}{1}{{#1}_{\mathrm{proper}}}
\letThereBe{\finrep}{2}{{#2}_{#1{\text -}\mathrm{rep}}} %T-stage game
\letThereBe{\infrep}{1}{#1_{\mathrm{irep}}}
\LetThereBe{\repstr}{\tau} %strategy in a repeated game
\LetThereBe{\emptyhist}{\epsilon}
\letThereBe{\extrep}{1}{{#1^{\mathrm{rep}}}}
\letThereBe{\avgpay}{1}{#1^{\mathrm{avg}}}
\LetThereBe{\succf}{\pi} %successor function
\LetThereBe{\playf}{\rho} %player function
\LetThereBe{\actf}{\chi} %action function
$$
$$
% ODEs
\LetThereBe{\timeInt}{\mcal I}
\LetThereBe{\stimeInt}{\mcal J}
\LetThereBe{\Wronsk}{\mcal W}
\letThereBe{\wronsk}{1}{\Wronsk \parentheses{#1}}
\LetThereBe{\prufRadius}{\rho}
\LetThereBe{\prufAngle}{\vf}
\LetThereBe{\weyr}{\sigma}
\LetThereBe{\linDifOp}{\mathsf{L}}
\LetThereBe{\Hurwitz}{\vi H}
\letThereBe{\hurwitz}{1}{\Hurwitz \brackets{#1}}
% Cont. Models
\LetThereBe{\dirac}{\delta}
% PDEs
% \avint -- defined in format-respective tex files
\LetThereBe{\fundamental}{\Phi}
\LetThereBe{\fund}{\fundamental}
\letThereBe{\normaDeriv}{1}{\partialDeriv{#1}{\vec{n}}}
\letThereBe{\volAvg}{2}{\avint_{\ball{#1}{#2}}}
\LetThereBe{\VolAvg}{\volAvg{x}{\ve}}
\letThereBe{\surfAvg}{2}{\avint_{\boundary \ball{#1}{#2}}}
\LetThereBe{\SurfAvg}{\surfAvg{x}{\ve}}
\LetThereBe{\corrF}{\varphi^{\times}}
\LetThereBe{\greenF}{G}
\letThereBe{\reflect}{1}{\tilde{#1}}
\letThereBe{\unitBall}{1}{\alpha(#1)}
\LetThereBe{\conv}{*}
\letThereBe{\dotP}{2}{#1 \cdot #2}
\letThereBe{\translation}{1}{\tau_{#1}}
\declareMathematics{\dist}{dist}
\letThereBe{\regularizef}{1}{\eta_{#1}}
\letThereBe{\fourier}{1}{\widehat{#1}}
\letThereBe{\ifourier}{1}{\check{#1}}
\LetThereBe{\fourierOp}{\mcal F}
\LetThereBe{\ifourierOp}{\mcal F^{-1}}
\letThereBe{\FourierOp}{1}{\fourierOp\set{#1}}
\letThereBe{\iFourierOp}{1}{\ifourierOp\set{#1}}
\LetThereBe{\laplaceOp}{\mcal L}
\letThereBe{\LaplaceOp}{1}{\laplaceOp\set{#1}}
\letThereBe{\Norm}{1}{\absval{#1}}
% SINDy
\LetThereBe{\Koop}{\mcal K}
\letThereBe{\oneToN}{1}{\left[#1\right]}
\LetThereBe{\meas}{\mathrm{m}}
\LetThereBe{\stateLoss}{\mcal J}
\LetThereBe{\lagrm}{p}
% Stochastic analysis
\LetThereBe{\RiemannInt}{(\mcal R)}
\LetThereBe{\RiemannStieltjesInt}{(\mcal {R_S})}
\LetThereBe{\LebesgueInt}{(\mcal L)}
\LetThereBe{\ItoInt}{(\mcal I)}
\LetThereBe{\Stratonovich}{\circ}
\LetThereBe{\infMean}{\alpha}
\LetThereBe{\infVar}{\beta}
% Dynamical systems
\LetThereBe{\nUnit}{\mathrm N}
\LetThereBe{\timeUnit}{\mathrm T}
% Masters thesis
\LetThereBe{\evolOp}{\oper{\vf}}
\letThereBe{\obj}{1}{\mathbb{#1}}
\LetThereBe{\timeSet}{\obj T}
\LetThereBe{\stateSpace}{\obj X}
\LetThereBe{\contStateSpace}{\stateSpace_{C}}
\LetThereBe{\orbit}{Or}
\letThereBe{\Orbit}{1}{\orbit\brackets{#1}}
\LetThereBe{\limitSet}{\obj \Lambda}
\LetThereBe{\crossSection}{\obj \Sigma}
\declareMathematics{\codim}{codim}
% Left and right closed-or-open intervals
\LetThereBe{\lco}{\langle}
\LetThereBe{\rco}{\rangle}
\letThereBe{\testInt}{1}{\mathrm{Int}_{#1}}
\letThereBe{\evalOp}{1}{\oper{\eta}_{#1}}
\LetThereBe{\nonzeroEl}{\bullet}
\LetThereBe{\zeroEl}{\circ}
\LetThereBe{\solOp}{\oper{S}}
\LetThereBe{\infGen}{\oper{A}}
\LetThereBe{\indexSet}{\mcal I}
\letThereBe{\indicesOf}{1}{\indexSet\parentheses{#1}}
\letThereBe{\IndicesOf}{2}{\indexSet_{#2}\parentheses{#1}}
\LetThereBe{\meshGrid}{\obj M}
\declareMathematics{\starter}{starter}
\declareMathematics{\indexer}{indx}
\declareMathematics{\enumerator}{enum}
\LetThereBe{\inSS}{_{\infty}}
\LetThereBe{\manifold}{\mcal M}
\LetThereBe{\curve}{\mathcal C}
% Numerical methods
\declareMathematics{\globErr}{err}
\declareMathematics{\locErr}{le}
\declareMathematics{\locTrErr}{lte}
\declareMathematics{\incrementFunc}{Inc}
\letThereBe{\incrementF}{1}{\incrementFunc \brackets{#1}}
%Stochastic analysis
\LetThereBe{\RiemannInt}{(\mcal R)}
\LetThereBe{\RiemannStieltjesInt}{(\mcal {R_S})}
\LetThereBe{\LebesgueInt}{(\mcal L)}
\LetThereBe{\ItoInt}{(\mcal I)}
\LetThereBe{\Stratonovich}{\circ}
\LetThereBe{\infMean}{\alpha}
\LetThereBe{\infVar}{\beta}
%Optimization
\LetThereBe{\goldRatio}{\tau}
%Interpolation
\LetThereBe{\lagrPoly}{l}
$$
Synchronization is a phenomenon commonly found in nature and, as is often the case, it takes many shapes and forms from the coordination between neurons in our brains or fire-fly lights to synchronization found in electrical grids and financial markets. What started in the 17th century with Huygens’ investigation into the behavior of two weakly interacting pendulum clocks through a heavy beam, see [1], has since evolved into a field rich with both theory and applications.
The key application and motivation of this thesis lies, as the name may suggest, in physiological models of neurons in the brain. Several studies, see [2], [3], [4], [5], and [6] among others, have shown that fast to ultra-fast ripples (oscillations of frequencies ranging from 250 Hz to 2000 Hz, or even higher in the case of ultra-fast oscillations) in intracranial electroencephalographic (iEEG) recordings measured deep in the brain can be potentially used as biomarkers of epileptogenic zones of focal epilepsy. Furthermore, there is evidence they correlate with the severity of epilepsy. Research also suggests that very high-frequency oscillations (VHFOs) and ultra-fast oscillations (UFOs) are more local, i.e., spatially restricted than traditional biomarkers, high-frequency oscillations (HFOs), thus providing better guidance in locating the areas of epilepsy. Fast oscillations lie outside the realm of physiologically possible frequencies of single neurons. This indicates another mechanism must be at play, but its identification is an open question in neuroscience, see [7].
The primary goal of this thesis is to provide insight into a small part of computational analysis in neuroscience — phase synchronization of coupled neurons and techniques used in its detection and exploration. In particular, we will study two possible approaches and analyze their strengths and shortcomings.
Note that VFHOs and UFOs in the context of coupled neuronal models pose a very difficult problem from the point of view of applied mathematics. While in this thesis we only study numerical simulations of neuronal models, colleagues from the Nonlinear Dynamics team have explored the detection of VHFOs in iEEG signals, see [9]. Moreover, the scope and focus of the thesis, i.e., computation of periods (frequencies) and shifts of simulated weakly coupled neuronal models, arose naturally as an extension of research conducted in the Nonlinear Dynamics team in the course of the GAMU Interdisciplinary project # MUNI/G/1213/2022. This research direction was fueled by the necessity of understanding regions and types of synchrony of coupled neurons in the vicinity of an epileptogenic zone.
First and foremost, we shall introduce the necessary theory. Starting with a theoretical introduction to dynamical systems, we then shift our attention to delay differential equations and semidynamical systems induced by them. A discussion of methods of numerical integration for both ordinary and delay differential equations follows. Lastly, 1D optimization methods are studied, together with Newton’s method, before shortly turning our attention to the models and principles from computational neuroscience.
In the second chapter, an approach for the computation of phase shift between two weakly coupled oscillators based on simulations of the corresponding differential equation is iteratively developed. Starting from a simple, naive algorithm, we progressively add various concepts to address present issues. We end this thesis by taking a different route and introducing the theory of localization of equilibria and periodic orbits. We then use these concepts from bifurcation theory to compute the phase shifts as continuations of cycles on a specific manifold.
Let us note the thesis is typeset using Quarto [10] and all figures are generated in Julia [11] using the Makie.jl package [12]. Both HTML and PDF versions are available. All source code for this thesis (and included numerical computations) is included in the Git repository (if not stated otherwise).
[2]
Brázdil, M.,
Worrell, G. A.,
Trávníček, V.,
Pail, M.,
Roman, R.,
Plešinger, F.,
Klimeš, P.,
Cimbálník, J.,
Stacey, W. and
Jurák, P. (2023).
Ultra fast oscillations in the human brain and their functional significance.
[3]
Cimbalnik, J.,
Brinkmann, B.,
Kremen, V.,
Jurak, P.,
Berry, B.,
Gompel, J. V.,
Stead, M. and
Worrell, G. (2018).
Physiological and pathological high frequency oscillations in focal epilepsy.
Annals of Clinical and Translational Neurology 5 1062–76.
[4]
Ševčík, J. and Přibylová, L. (2025). Cycle multistability and synchronization mechanisms in coupled interneurons: In-phase and anti-phase dynamics under current stimuli. accepted for publication in Applied Mathematics and Computation.
[5]
Přibylová, L.,
Ševčík, J.,
Eclerová, V.,
Klimeš, P.,
Brázdil, M. and
Meijer, H. G. E. (2024).
Weak coupling of neurons enables very high-frequency and ultra-fast oscillations through the interplay of synchronized phase shifts.
Network Neuroscience 8 293–318.
[6]
Přibylová, L.,
Ševčík, J.,
Halmazňa, T.,
Husa, Š.,
Malárik, P.,
Kajanová, L.,
Polách, M.,
Zapadlo, Š. and
Eclerová, V. (2025).
Chaos links dendritic calcium to bursting in hippocampal pyramidal cells.
Chaos, Solitons and Fractals.
[7]
Jiruska, P.,
Alvarado‐Rojas, C.,
Schevon, C. A.,
Staba, R.,
Stacey, W.,
Wendling, F. and
Avoli, M. (2017).
Update on the mechanisms and roles of high‐frequency oscillations in seizures and epileptic disorders.
Epilepsia 58 1330–9.
[10]
Allaire, J. J.,
Teague, C.,
Scheidegger, C.,
Xie, Y.,
Dervieux, C. and
Woodhull, G. (2025).
Quarto.