aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/040-rekursion/images
diff options
context:
space:
mode:
Diffstat (limited to 'buch/chapters/040-rekursion/images')
-rw-r--r--buch/chapters/040-rekursion/images/Makefile6
-rw-r--r--buch/chapters/040-rekursion/images/loggammaplot.m43
-rw-r--r--buch/chapters/040-rekursion/images/loggammaplot.pdfbin0 -> 30948 bytes
-rw-r--r--buch/chapters/040-rekursion/images/loggammaplot.tex89
4 files changed, 137 insertions, 1 deletions
diff --git a/buch/chapters/040-rekursion/images/Makefile b/buch/chapters/040-rekursion/images/Makefile
index 86dfa1e..a1884f4 100644
--- a/buch/chapters/040-rekursion/images/Makefile
+++ b/buch/chapters/040-rekursion/images/Makefile
@@ -3,7 +3,7 @@
#
# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#
-all: gammaplot.pdf fibonacci.pdf order.pdf beta.pdf
+all: gammaplot.pdf fibonacci.pdf order.pdf beta.pdf loggammaplot.pdf
gammaplot.pdf: gammaplot.tex gammapaths.tex
pdflatex gammaplot.tex
@@ -29,4 +29,8 @@ beta.pdf: beta.tex betapaths.tex
betapaths.tex: betadist.m
octave betadist.m
+loggammaplot.pdf: loggammaplot.tex loggammadata.tex
+ pdflatex loggammaplot.tex
+loggammadata.tex: loggammaplot.m
+ octave loggammaplot.m
diff --git a/buch/chapters/040-rekursion/images/loggammaplot.m b/buch/chapters/040-rekursion/images/loggammaplot.m
new file mode 100644
index 0000000..5456e4f
--- /dev/null
+++ b/buch/chapters/040-rekursion/images/loggammaplot.m
@@ -0,0 +1,43 @@
+#
+# loggammaplot.m
+#
+# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+xmax = 10;
+xmin = 0.1;
+N = 500;
+
+fn = fopen("loggammadata.tex", "w");
+
+fprintf(fn, "\\def\\loggammapath{\n ({%.4f*\\dx},{%.4f*\\dy})",
+ xmax, log(gamma(xmax)));
+xstep = (xmax - 1) / N;
+for x = (xmax:-xstep:1)
+ fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x)));
+endfor
+for k = (0:0.2:10)
+ x = exp(-k);
+ fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x)));
+endfor
+fprintf(fn, "\n}\n");
+
+function retval = lgp(fn, x0, name)
+ fprintf(fn, "\\def\\loggammaplot%s{\n", name);
+ fprintf(fn, "\\draw[color=red,line width=1pt] ");
+ for k = (-7:0.1:7)
+ x = x0 + 0.5 * tanh(k);
+ if (k > -5)
+ fprintf(fn, "\n\t-- ");
+ end
+ fprintf(fn, "({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x)));
+ endfor
+ fprintf(fn, ";\n}\n");
+endfunction
+
+lgp(fn, -0.5, "zero");
+lgp(fn, -1.5, "one");
+lgp(fn, -2.5, "two");
+lgp(fn, -3.5, "three");
+lgp(fn, -4.5, "four");
+
+fclose(fn);
diff --git a/buch/chapters/040-rekursion/images/loggammaplot.pdf b/buch/chapters/040-rekursion/images/loggammaplot.pdf
new file mode 100644
index 0000000..8ac9eb4
--- /dev/null
+++ b/buch/chapters/040-rekursion/images/loggammaplot.pdf
Binary files differ
diff --git a/buch/chapters/040-rekursion/images/loggammaplot.tex b/buch/chapters/040-rekursion/images/loggammaplot.tex
new file mode 100644
index 0000000..c3c17ea
--- /dev/null
+++ b/buch/chapters/040-rekursion/images/loggammaplot.tex
@@ -0,0 +1,89 @@
+%
+% tikztemplate.tex -- template for standalon tikz images
+%
+% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+%
+\documentclass[tikz]{standalone}
+\usepackage{amsmath}
+\usepackage{times}
+\usepackage{txfonts}
+\usepackage{pgfplots}
+\usepackage{csvsimple}
+\usetikzlibrary{arrows,intersections,math}
+\begin{document}
+\def\skala{1}
+\input{loggammadata.tex}
+\begin{tikzpicture}[>=latex,thick,scale=\skala]
+
+% add image content here
+
+\def\dx{1}
+\def\dy{0.6}
+\def\xmax{7.8}
+\def\xmin{-4.9}
+\def\ymax{8}
+\def\ymin{-3.1}
+
+\fill[color=blue!20] ({\xmin*\dx},{\ymin*\dy}) rectangle ({-4*\dx},{\ymax*\dy});
+\fill[color=blue!20] ({-3*\dx},{\ymin*\dy}) rectangle ({-2*\dx},{\ymax*\dy});
+\fill[color=blue!20] ({-1*\dx},{\ymin*\dy}) rectangle ({-0*\dx},{\ymax*\dy});
+
+\draw[->] ({\xmin*\dx-0.1},0) -- ({\xmax*\dx+0.3},0)
+ coordinate[label={$x$}];
+\draw[->] (0,{\ymin*\dy-0.1}) -- (0,{\ymax*\dy+0.3})
+ coordinate[label={right:$y$}];
+
+\begin{scope}
+\clip ({\xmin*\dx},{\ymin*\dy}) rectangle ({\xmax*\dx},{\ymax*\dy});
+
+\foreach \x in {-1,-2,-3,-4}{
+ \draw[color=blue,line width=0.3pt]
+ ({\x*\dx},{\ymin*\dy}) -- ({\x*\dx},{\ymax*\dy});
+}
+
+\draw[color=red,line width=1pt] \loggammapath;
+
+\loggammaplotzero
+\loggammaplotone
+\loggammaplottwo
+\loggammaplotthree
+\loggammaplotfour
+
+\end{scope}
+
+\foreach \y in {0.1,10,100,1000,1000}{
+ \draw[line width=0.3pt]
+ ({\xmin*\dx},{ln(\y)*\dy})
+ --
+ ({\xmax*\dx},{ln(\y)*\dy}) ;
+}
+
+\foreach \x in {1,...,8}{
+ \draw ({\x*\dx},{-0.05}) -- ({\x*\dx},{0.05});
+ \node at ({\x*\dx},0) [below] {$\x$};
+}
+
+\foreach \x in {-1,...,-4}{
+ \draw ({\x*\dx},{-0.05}) -- ({\x*\dx},{0.05});
+}
+\foreach \x in {-1,...,-3}{
+ \node at ({\x*\dx},0) [below right] {$\x$};
+}
+\node at ({-4*\dx},0) [below left] {$-4$};
+
+\def\htick#1#2{
+ \draw (-0.05,{ln(#1)*\dy}) -- (0.05,{ln(#1)*\dy});
+ \node at (0,{ln(#1)*\dy}) [above right] {#2};
+}
+
+\htick{10}{$10^1$}
+\htick{100}{$10^2$}
+\htick{1000}{$10^3$}
+\htick{0.1}{$10^{-1}$}
+
+\node[color=red] at ({3*\dx},{ln(30)*\dy}) {$y=\log|\Gamma(x)|$};
+
+
+\end{tikzpicture}
+\end{document}
+