Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132939 views
License: OTHER
1
\documentclass{article}
2
\usepackage[pdftex,active,tightpage]{preview}
3
\setlength\PreviewBorder{2mm}
4
5
\usepackage[utf8]{inputenc} % this is needed for umlauts
6
\usepackage[ngerman]{babel} % this is needed for umlauts
7
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
8
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
9
\usepackage{braket} % needed for \Set
10
\usepackage{algorithm,algpseudocode}
11
12
\usepackage{tikz}
13
\usetikzlibrary{decorations.pathreplacing,calc}
14
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
15
\newcommand*{\AddNote}[4]{%
16
\begin{tikzpicture}[overlay, remember picture]
17
\draw [decoration={brace,amplitude=0.5em},decorate,very thick]
18
($(#3)!(#1.north)!($(#3)-(0,1)$)$) --
19
($(#3)!(#2.south)!($(#3)-(0,1)$)$)
20
node [align=center, text width=2.5cm, pos=0.5, anchor=west] {#4};
21
\end{tikzpicture}
22
}%
23
24
\begin{document}
25
\begin{preview}
26
\begin{algorithm}[H]
27
\begin{algorithmic}
28
\Require $Z \in \mathbb{N}_{\geq 0}, b \in \mathbb{N}_{\geq 2}$
29
\State $i\gets 0$
30
\While{$Z > 0$}
31
\State $y_i\gets Z \mod b$
32
\State $Z \gets \frac{Z - y_i}{b}$
33
\State $i \gets i + 1$
34
\EndWhile
35
\\
36
\State \textbf{Result:} $y_{0} y_{1} \dots y_{i-1}$
37
\end{algorithmic}
38
\caption{Horner-Schema for changing base for numbers in $\mathbb{N}_0$}
39
\label{alg:hornerschemaGanzeZahlen}
40
\end{algorithm}
41
\end{preview}
42
\end{document}
43
44