\documentclass[t,aspectratio=169]{beamer}
\usetheme{metropolis}
\metroset{block=fill}

\input{../../_assets/basicslide1}
\input{../../_assets/macros}

\author{Samuel Vaiter}
\date{}
\institute{
Created: 2023-11-08.\\
Last update: 2023-11-08.\\
Status: draft.}
\title{Gradient and Hessian}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
  \frametitle{Differentiable function}

  \begin{definition}
    A function $f$ is said to be differentiable at $x \in \RR^n$ if there exists $u \in \RR^n$ such that
    \begin{align*}
      f(x + h) &= f(x) + \dotp{u}{h} + o(\norm{h}) &\alert{u \text{ is called \textbf{the} gradient } u = \nabla f(x)}
    \end{align*}
  \end{definition}

  \begin{center}
    \begin{tikzpicture}
      % Axis
      \draw[->] (-6,0) -- (6,0);
      \draw[->] (0,-0.1) -- (0,4);

      \draw[domain=-6:6, smooth, variable=\x] plot ({\x}, {2 + 0.01*(\x^3)}) node[below] {$f(x)$};
      \draw[domain=-5:6, red, variable=\x] plot ({\x}, {2.27 + 0.27*(\x-3)});
      \draw[dotted] (3,2.27) -- (3,0) node[above right] {$x$};
    \end{tikzpicture}
  \end{center}
\end{frame}

\end{document}