From 5bd294f334dc1d99e3db29996482f0f2cd1c8b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Wed, 27 Oct 2021 08:51:17 +0200 Subject: add gamma function section --- buch/chapters/040-rekursion/images/Makefile | 12 +++ buch/chapters/040-rekursion/images/gammaplot.m | 52 +++++++++++++ buch/chapters/040-rekursion/images/gammaplot.pdf | Bin 0 -> 30468 bytes buch/chapters/040-rekursion/images/gammaplot.tex | 89 +++++++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 buch/chapters/040-rekursion/images/Makefile create mode 100644 buch/chapters/040-rekursion/images/gammaplot.m create mode 100644 buch/chapters/040-rekursion/images/gammaplot.pdf create mode 100644 buch/chapters/040-rekursion/images/gammaplot.tex (limited to 'buch/chapters/040-rekursion/images') diff --git a/buch/chapters/040-rekursion/images/Makefile b/buch/chapters/040-rekursion/images/Makefile new file mode 100644 index 0000000..58f79b8 --- /dev/null +++ b/buch/chapters/040-rekursion/images/Makefile @@ -0,0 +1,12 @@ +# +# Makefile +# +# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +all: gammaplot.pdf + +gammaplot.pdf: gammaplot.tex gammapaths.tex + pdflatex gammaplot.tex + +gammapaths.tex: gammaplot.m + octave gammaplot.m diff --git a/buch/chapters/040-rekursion/images/gammaplot.m b/buch/chapters/040-rekursion/images/gammaplot.m new file mode 100644 index 0000000..3b1d23d --- /dev/null +++ b/buch/chapters/040-rekursion/images/gammaplot.m @@ -0,0 +1,52 @@ +# +# gammaplot.m +# +# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# + +fn = fopen("gammapaths.tex", "w"); + +function finterval(f, fn, from, to, name, delta) + fprintf(fn, "\\def\\gamma%s{", name); + x = from + delta; + fprintf(fn, "({\\dx*%.4f},{\\dy*%.4f})", x, f(x)); + x = from + 0.02; + for x = (from+0.02:0.02:to-0.02) + fprintf(fn, "\n -- "); + fprintf(fn, "({\\dx*%.4f},{\\dy*%.4f})", x, f(x)); + endfor + x = to - delta; + fprintf(fn, "\n -- "); + fprintf(fn, "({\\dx*%.4f},{\\dy*%.4f})", x, f(x)); + fprintf(fn, "}\n"); +endfunction + +function gammainterval(fn, from, to, name, delta) + finterval(@gamma, fn, from, to, name, delta) +endfunction + +function retval = gammasin(x) + retval = gamma(x) + sin(x * pi); +endfunction + +function gammasininterval(fn, from, to, name, delta) + finterval(@gammasin, fn, from, to, name, delta) +endfunction + +gammainterval(fn, 0, 4.1, "plus", 0.019); +gammainterval(fn, -1, 0, "one", 0.019); +gammainterval(fn, -2, -1, "two", 0.019); +gammainterval(fn, -3, -2, "three", 0.019); +gammainterval(fn, -4, -3, "four", 0.005); +gammainterval(fn, -5, -4, "five", 0.001); +gammainterval(fn, -6, -5, "six", 0.0002); + +gammasininterval(fn, 0, 4.1, "sinplus", 0.019); +gammasininterval(fn, -1, 0, "sinone", 0.019); +gammasininterval(fn, -2, -1, "sintwo", 0.019); +gammasininterval(fn, -3, -2, "sinthree", 0.019); +gammasininterval(fn, -4, -3, "sinfour", 0.005); +gammasininterval(fn, -5, -4, "sinfive", 0.001); +gammasininterval(fn, -6, -5, "sinsix", 0.0002); + +fclose(fn); diff --git a/buch/chapters/040-rekursion/images/gammaplot.pdf b/buch/chapters/040-rekursion/images/gammaplot.pdf new file mode 100644 index 0000000..d0a766e Binary files /dev/null and b/buch/chapters/040-rekursion/images/gammaplot.pdf differ diff --git a/buch/chapters/040-rekursion/images/gammaplot.tex b/buch/chapters/040-rekursion/images/gammaplot.tex new file mode 100644 index 0000000..4e11d32 --- /dev/null +++ b/buch/chapters/040-rekursion/images/gammaplot.tex @@ -0,0 +1,89 @@ +% +% gammaplot.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} +\input{gammapaths.tex} +\begin{document} +\def\skala{1} +\begin{tikzpicture}[>=latex,thick,scale=\skala] + +\definecolor{darkgreen}{rgb}{0,0.8,0} + +\draw[->] (-6.1,0) -- (5.3,0) coordinate[label={$z$}]; +\draw[->] (0,-5.1) -- (0,6.4) coordinate[label={right:$\Gamma(z)$}]; + +\foreach \x in {-1,-2,-3,-4,-5,-6}{ + \draw (\x,-0.1) -- (\x,0.1); + \draw[line width=0.1pt] (\x,-5) -- (\x,6.2); +} +\foreach \x in {1,2,3,4,5}{ + \draw (\x,-0.1) -- (\x,0.1); + \node at (\x,0) [below] {$\x$}; +} +\foreach \y in {-5,-4,-3,-2,-1,1,2,3,4,5,6}{ + \draw (-0.1,\y) -- (0.1,\y); +} +\foreach \y in {1,2,3,4,5,6}{ + \node at (0,\y) [left] {$\y$}; +} +\foreach \y in {-1,-2,-3,-4,-5}{ + \node at (0,\y) [right] {$\y$}; +} +\foreach \x in {-1,-3,-5}{ + \node at (\x,0) [below left] {$\x$}; +} +\foreach \x in {-2,-4,-6}{ + \node at (\x,0) [above left] {$\x$}; +} + +\def\dx{1} +\def\dy{1} + +\begin{scope} +\clip (-6.1,-5) rectangle (4.3,6.2); + +\draw[color=darkgreen,line width=1.4pt] \gammasinplus; +\draw[color=darkgreen,line width=1.4pt] \gammasinone; +\draw[color=darkgreen,line width=1.4pt] \gammasintwo; +\draw[color=darkgreen,line width=1.4pt] \gammasinthree; +\draw[color=darkgreen,line width=1.4pt] \gammasinfour; +\draw[color=darkgreen,line width=1.4pt] \gammasinfive; +\draw[color=darkgreen,line width=1.4pt] \gammasinsix; + +\draw[color=red,line width=1.4pt] \gammaplus; +\draw[color=red,line width=1.4pt] \gammaone; +\draw[color=red,line width=1.4pt] \gammatwo; +\draw[color=red,line width=1.4pt] \gammathree; +\draw[color=red,line width=1.4pt] \gammafour; +\draw[color=red,line width=1.4pt] \gammafive; +\draw[color=red,line width=1.4pt] \gammasix; + +\end{scope} + +\fill[color=blue] (1,1) circle[radius=0.08]; +\node[color=blue] at (1,1-0.2) [below] {$\Gamma(1)=0!$}; +\fill[color=blue] (2,1) circle[radius=0.08]; +\node[color=blue] at (2,1) [below right] {$\Gamma(2)=1!$}; +\fill[color=blue] (3,2) circle[radius=0.08]; +\node[color=blue] at (3,2) [right] {$\Gamma(3)=2!$}; +\fill[color=blue] (4,6) circle[radius=0.08]; +\node[color=blue] at (4,6) [right] {$\Gamma(4)=3!$}; + +\begin{scope}[xshift=3cm,yshift=-2.4cm] + \draw[color=red,line width=1.4pt] (-1,0) -- (0,0); + \draw[color=darkgreen,line width=1.4pt] (-1,-0.7) -- (0,-0.7); + \node at (0.1,0) [right] {$\Gamma(z)$}; + \node at (0.1,-0.7) [right] {$\Gamma(z)+\sin\pi z$}; +\end{scope} + +\end{tikzpicture} +\end{document} + -- cgit v1.2.1