diff options
author | Andreas Müller <andreas.mueller@ost.ch> | 2022-03-09 09:42:50 +0100 |
---|---|---|
committer | Andreas Müller <andreas.mueller@ost.ch> | 2022-03-09 09:42:50 +0100 |
commit | 100498089783148753f2862c4dbfba04f110727f (patch) | |
tree | 8da16e53d38a9a9d23efd747849d6af2dc45534e /buch/papers | |
parent | add new files (diff) | |
download | SeminarSpezielleFunktionen-100498089783148753f2862c4dbfba04f110727f.tar.gz SeminarSpezielleFunktionen-100498089783148753f2862c4dbfba04f110727f.zip |
add order statistics graph
Diffstat (limited to '')
-rw-r--r-- | buch/papers/dreieck/images/Makefile | 4 | ||||
-rw-r--r-- | buch/papers/dreieck/images/order.m | 79 | ||||
-rw-r--r-- | buch/papers/dreieck/images/order.pdf | bin | 0 -> 31044 bytes | |||
-rw-r--r-- | buch/papers/dreieck/images/order.tex | 81 |
4 files changed, 155 insertions, 9 deletions
diff --git a/buch/papers/dreieck/images/Makefile b/buch/papers/dreieck/images/Makefile index 02be1bb..3907d13 100644 --- a/buch/papers/dreieck/images/Makefile +++ b/buch/papers/dreieck/images/Makefile @@ -3,6 +3,8 @@ # # (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule # -order.pdf: order.tex +order.pdf: order.tex orderpath.tex pdflatex order.tex +orderpath.tex: order.m + octave order.m diff --git a/buch/papers/dreieck/images/order.m b/buch/papers/dreieck/images/order.m new file mode 100644 index 0000000..d37a258 --- /dev/null +++ b/buch/papers/dreieck/images/order.m @@ -0,0 +1,79 @@ +# +# order.m +# +# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +global N; +N = 10; +global subdivisions; +subdivisions = 100; +global P; +P = 0.5 + +function retval = orderF(p, n, k) + retval = 0; + for i = (k:n) + retval = retval + nchoosek(n,i) * p^i * (1-p)^(n-i); + end +end + +function retval = orderd(p, n, k) + retval = 0; + for i = (k:n) + s = i * p^(i-1) * (1-p)^(n-i); + s = s - p^i * (n-i) * (1-p)^(n-i-1); + retval = retval + nchoosek(n,i) * s; + end +end + +function orderpath(fn, k, name) + fprintf(fn, "\\def\\order%s{\n\t(0,0)", name); + global N; + global subdivisions; + for i = (0:subdivisions) + p = i/subdivisions; + fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", + p, orderF(p, N, k)); + end + fprintf(fn, "\n}\n"); +end + +function orderdpath(fn, k, name) + fprintf(fn, "\\def\\orderd%s{\n\t(0,0)", name); + global N; + global subdivisions; + for i = (1:subdivisions-1) + p = i/subdivisions; + fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", + p, orderd(p, N, k)); + end + fprintf(fn, "\n\t-- ({1*\\dx},0)"); + fprintf(fn, "\n}\n"); +end + +fn = fopen("orderpath.tex", "w"); +orderpath(fn, 0, "zero"); +orderdpath(fn, 0, "zero"); +orderpath(fn, 1, "one"); +orderdpath(fn, 1, "one"); +orderpath(fn, 2, "two"); +orderdpath(fn, 2, "two"); +orderpath(fn, 3, "three"); +orderdpath(fn, 3, "three"); +orderpath(fn, 4, "four"); +orderdpath(fn, 4, "four"); +orderpath(fn, 5, "five"); +orderdpath(fn, 5, "five"); +orderpath(fn, 6, "six"); +orderdpath(fn, 6, "six"); +orderpath(fn, 7, "seven"); +orderdpath(fn, 7, "seven"); +orderpath(fn, 8, "eight"); +orderdpath(fn, 8, "eight"); +orderpath(fn, 9, "nine"); +orderdpath(fn, 9, "nine"); +orderpath(fn, 10, "ten"); +orderdpath(fn, 10, "ten"); +fclose(fn); + + diff --git a/buch/papers/dreieck/images/order.pdf b/buch/papers/dreieck/images/order.pdf Binary files differnew file mode 100644 index 0000000..6d9c8c0 --- /dev/null +++ b/buch/papers/dreieck/images/order.pdf diff --git a/buch/papers/dreieck/images/order.tex b/buch/papers/dreieck/images/order.tex index 826f48c..083f014 100644 --- a/buch/papers/dreieck/images/order.tex +++ b/buch/papers/dreieck/images/order.tex @@ -12,22 +12,87 @@ \usetikzlibrary{arrows,intersections,math} \begin{document} \def\skala{8} +\definecolor{darkgreen}{rgb}{0,0.6,0} +\input{orderpath.tex} \begin{tikzpicture}[>=latex,thick,scale=\skala] -\draw[color=red,line width=1.4pt] ({-0.1/\skala},0) - -- - plot[domain=0:1,samples=100] ({\x},{0.5*\x*\x*\x*\x*\x*\x}) - -- - ({1+0.1/\skala},0.5); +\def\dx{1} +\def\dy{0.5} -\draw[color=red,line width=1.4pt] ({-0.1/\skala},0) +\def\pfad#1#2{ +\draw[color=#2,line width=1.4pt] ({-0.1/\skala},0) -- - plot[domain=0:1,samples=100] ({\x},{0.5*(\x*\x*\x*\x)}) + #1 -- ({1+0.1/\skala},0.5); +} -\draw[->] ({-0.1/\skala},0) -- (1.1,0) coordinate[label={$1$}]; +\pfad{\orderzero}{darkgreen!20} +\pfad{\orderone}{darkgreen!20} +\pfad{\ordertwo}{darkgreen!20} +\pfad{\orderthree}{darkgreen!20} +\pfad{\orderfour}{darkgreen!20} +\pfad{\orderfive}{darkgreen!20} +\pfad{\ordersix}{darkgreen!20} +\pfad{\ordereight}{darkgreen!20} +\pfad{\ordernine}{darkgreen!20} +\pfad{\orderten}{darkgreen!20} +\pfad{\orderseven}{darkgreen} + +\draw[->] ({-0.1/\skala},0) -- (1.1,0) coordinate[label={$x$}]; \draw[->] (0,{-0.1/\skala}) -- (0,0.6) coordinate[label={left:$F(X)$}]; +\foreach \x in {0,0.2,0.4,0.6,0.8,1}{ + \draw (\x,{-0.1/\skala}) -- (\x,{0.1/\skala}); + \node at (\x,{-0.1/\skala}) [below] {$\x$}; +} +\foreach \y in {0.5,1}{ + \draw ({-0.1/\skala},{\y*\dy}) -- ({0.1/\skala},{\y*\dy}); + \node at ({-0.1/\skala},{\y*\dy}) [left] {$\y$}; +} + +\node[color=darkgreen] at (0.65,{0.5*\dy}) [above,rotate=55] {$k=7$}; + +\begin{scope}[yshift=-0.7cm] +\def\dy{0.125} + +\def\pfad#1#2{ + \draw[color=#2,line width=1.4pt] ({-0.1/\skala},0) + -- + #1 + -- + ({1+0.1/\skala},0.0); +} + +\begin{scope} +\clip ({-0.1/\skala},{-0.1/\skala}) + rectangle ({1+0.1/\skala},{0.56+0.1/\skala}); +\pfad{\orderdzero}{red!20} +\pfad{\orderdone}{red!20} +\pfad{\orderdtwo}{red!20} +\pfad{\orderdthree}{red!20} +\pfad{\orderdfour}{red!20} +\pfad{\orderdfive}{red!20} +\pfad{\orderdsix}{red!20} +\pfad{\orderdeight}{red!20} +\pfad{\orderdnine}{red!20} +\pfad{\orderdten}{red!20} +\pfad{\orderdseven}{red} +\end{scope} + +\draw[->] ({-0.1/\skala},0) -- (1.1,0) coordinate[label={$x$}]; +\draw[->] (0,{-0.1/\skala}) -- (0,0.6) coordinate[label={left:$\varphi(X)$}]; +\foreach \x in {0,0.2,0.4,0.6,0.8,1}{ + \draw (\x,{-0.1/\skala}) -- (\x,{0.1/\skala}); + \node at (\x,{-0.1/\skala}) [below] {$\x$}; +} +\foreach \y in {1,2,3,4}{ + \draw ({-0.1/\skala},{\y*\dy}) -- ({0.1/\skala},{\y*\dy}); + \node at ({-0.1/\skala},{\y*\dy}) [left] {$\y$}; +} + +\node[color=red] at (0.67,{2.7*\dy}) [above] {$k=7$}; + +\end{scope} \end{tikzpicture} \end{document} |