\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{sagetex}
\usepackage{verbatim}

\begin{document}
\section{Inline-Berechnungen}

Einfache Rechnung: $3 \times 3 = \sage{3*3}$ \\

(\LaTeX-Code: \verb+$3 \times 3 = \sage{3*3}$+)


\section{Sage-Blöcke}

Funktionsdefinition:

\begin{sageblock}
    f(x) = exp(x) * sin(2*x)
\end{sageblock}

\subsection{Latex-Code:}
\begin{verbatim}
\begin{sageblock}
    f(x) = exp(x) * sin(2*x)
\end{sageblock}
\end{verbatim}

\subsection{2. Ableitung von $f$}

\[
  \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
  \sage{diff(f, x, 2)(x)}.
\]

\subsection{Latex-Code:}
\begin{verbatim}
\[
  \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
  \sage{diff(f, x, 2)(x)}.
\]
\end{verbatim}

\section{Sage-Blöcke ohne Anzeige}
\begin{sagesilent}
f2(x) = 2*x
\end{sagesilent}

\begin{verbatim}
\begin{sagesilent}
f2(x) = 2*x
\end{sagesilent}
\end{verbatim}

\[ 2 * 7 = \sage{f2(7)} \]

\subsection{Latex-Code:}
\begin{verbatim}
\[ 2 * 7 = \sage{f2(7)} \]
\end{verbatim}


\section{Plot von $f$ from $-1$ to $1$}
\sageplot[angle=0, width=5cm]{plot(f, -1, 1)}

\subsection{Latex-Code:}
\begin{verbatim}
\sageplot[width=5cm]{plot(f, -1, 1)}
\end{verbatim}

\end{document}
