Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96515
License: OTHER
1
\documentclass[varwidth=false, border=2pt]{standalone}
2
3
\usepackage{pgfplots}
4
\usepackage{tikz}
5
\usepackage{xcolor}
6
7
\begin{document}
8
\begin{tikzpicture}
9
\definecolor{color1}{HTML}{332288}
10
\definecolor{color2}{HTML}{FDB863}
11
\definecolor{color3}{HTML}{B2ABD2}
12
\definecolor{color4}{HTML}{5E3C99}
13
\begin{axis}[
14
legend pos=north west,
15
legend cell align={left},
16
axis x line=middle,
17
axis y line=middle,
18
x tick label style={/pgf/number format/fixed,
19
/pgf/number format/fixed zerofill,
20
/pgf/number format/precision=1},
21
y tick label style={/pgf/number format/fixed,
22
/pgf/number format/fixed zerofill,
23
/pgf/number format/precision=1},
24
grid = major,
25
width=16cm,
26
height=8cm,
27
grid style={dashed, gray!30},
28
xmin=-2, % start the diagram at this x-coordinate
29
xmax= 2, % end the diagram at this x-coordinate
30
ymin=-1, % start the diagram at this y-coordinate
31
ymax= 2, % end the diagram at this y-coordinate
32
%axis background/.style={fill=white},
33
xlabel=x,
34
ylabel=y,
35
tick align=outside,
36
enlargelimits=false]
37
% plot the stirling-formulae
38
\addplot[domain=-2:2, color1, ultra thick,samples=500] {1/(1+exp(-x))};
39
\addplot[domain=-2:2, color2, ultra thick,samples=500] {tanh(x)};
40
\addplot[domain=-2:2, color4, ultra thick,samples=500] {max(0, x)};
41
\addplot[domain=-2:2, color4, ultra thick,samples=500, dashed] {ln(exp(x) + 1)};
42
\addplot[domain=-2:2, color3, ultra thick,samples=500, dotted] {max(x, exp(x) - 1)};
43
\addlegendentry{$\varphi_1(x)=\frac{1}{1+e^{-x}}$}
44
\addlegendentry{$\varphi_2(x)=\tanh(x)$}
45
\addlegendentry{$\varphi_3(x)=\max(0, x)$}
46
\addlegendentry{$\varphi_4(x)=\log(e^x + 1)$}
47
\addlegendentry{$\varphi_5(x)=\max(x, e^x - 1)$}
48
\end{axis}
49
\end{tikzpicture}
50
\end{document}
51
52