From bfd6e3d56f2e91f81b42c811fbff62abc153724d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sat, 16 Oct 2021 10:09:16 +0200 Subject: new files --- buch/chapters/110-elliptisch/images/Makefile | 13 ++- buch/chapters/110-elliptisch/images/rechteck.cpp | 54 +++++++++++ .../110-elliptisch/images/unvollstaendig.m | 81 +++++++++++++++++ .../110-elliptisch/images/unvollstaendig.pdf | Bin 0 -> 46390 bytes .../110-elliptisch/images/unvollstaendig.tex | 100 +++++++++++++++++++++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 buch/chapters/110-elliptisch/images/rechteck.cpp create mode 100644 buch/chapters/110-elliptisch/images/unvollstaendig.m create mode 100644 buch/chapters/110-elliptisch/images/unvollstaendig.pdf create mode 100644 buch/chapters/110-elliptisch/images/unvollstaendig.tex (limited to 'buch/chapters/110-elliptisch/images') diff --git a/buch/chapters/110-elliptisch/images/Makefile b/buch/chapters/110-elliptisch/images/Makefile index 327fed1..4912cca 100644 --- a/buch/chapters/110-elliptisch/images/Makefile +++ b/buch/chapters/110-elliptisch/images/Makefile @@ -3,7 +3,7 @@ # # (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule # -all: lemniskate.pdf ellipsenumfang.pdf +all: lemniskate.pdf ellipsenumfang.pdf unvollstaendig.pdf lemniskate.pdf: lemniskate.tex pdflatex lemniskate.tex @@ -14,3 +14,14 @@ ellipsenumfang.pdf: ellipsenumfang.tex ekplot.tex ekplot.tex: ellipsenumfang.m octave ellipsenumfang.m +rechteck: rechteck.cpp + g++ -O -Wall -g rechteck.cpp -o rechteck + +test: rechteck + ./rechteck + +unvollstaendig.pdf: unvollstaendig.tex unvollpath.tex + pdflatex unvollstaendig.tex + +unvollpath.tex: unvollstaendig.m + octave unvollstaendig.m diff --git a/buch/chapters/110-elliptisch/images/rechteck.cpp b/buch/chapters/110-elliptisch/images/rechteck.cpp new file mode 100644 index 0000000..6bd6a06 --- /dev/null +++ b/buch/chapters/110-elliptisch/images/rechteck.cpp @@ -0,0 +1,54 @@ +/* + * rechteck.cpp + * + * (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule + */ +#include +#include +#include +#include +#include + +double ast = 1; + +std::complex integrand(double k, const std::complex& z) { + std::complex s = z * z; + std::complex eins(1); + std::complex result = eins / sqrt((eins - s) * (eins - k * k * s)); + return ast * ((result.imag() < 0) ? -result : result); +} + +std::complex segment(double k, const std::complex& z1, + const std::complex& z2, int n = 100) { + std::complex dz = z2 - z1; + std::complex summe(0); + double h = 1. / n; + summe = integrand(k, z1); + summe += integrand(k, z2); + for (int i = 1; i < n; i++) { + double t = i * h; + std::complex z = (1 - t) * z1 + t * z2; + summe += 2. * integrand(k, z); + } + return dz * h * summe / 2.; +} + +int main(int argc, char *argv[]) { + double k = 0.5; + double y = -0.0001; + double xstep = -0.1; + ast = 1; + std::complex z(0, y); + std::complex w = segment(k, std::complex(0), z); + std::cout << z << std::endl; + int counter = 100; + while (counter-- > 0) { + std::complex znext = z + std::complex(xstep); + std::complex incr = segment(k, z, znext); + w += incr; + std::cout << znext << " -> " << w << ", "; + std::cout << integrand(k, znext) << std::endl; + z = znext; + } + return EXIT_SUCCESS; +} diff --git a/buch/chapters/110-elliptisch/images/unvollstaendig.m b/buch/chapters/110-elliptisch/images/unvollstaendig.m new file mode 100644 index 0000000..25196d0 --- /dev/null +++ b/buch/chapters/110-elliptisch/images/unvollstaendig.m @@ -0,0 +1,81 @@ +# +# unvollstaendig.m +# +# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +global N; +N = 200; +global n; +n = 5; + +function retval = integrand_f(t, k) + retval = 1 / sqrt((1 - t^2) * (1 - k^2 * t^2)); +endfunction + +function retval = integrand_e(t, k) + retval = sqrt((1-k^2*t^2)/(1-t^2)); +endfunction + +function retval = integrand_pi(n, t, k) + retval = 1 / ((1-n*t^2) * sqrt((1-k^2*t^2)*(1-t^2))); +endfunction + +function retval = elliptisch1(f, name, k) + global N; + global n; + s = 0; + fprintf(f, "\\def\\ell%s{ (0,0)", name); + delta = 1 / N; + for x = (0:delta:(1-delta)) + h = delta / n; + for t = (x+h/2:h:x+delta) + s = s + integrand_f(t, k) * h; + endfor + fprintf(f, "\n -- ({\\dx*%.4f},{\\dy*%.4f})", x + delta, s); + endfor + fprintf(f, "}\n"); +endfunction + +function retval = elliptisch2(f, name, k) + global N; + global n; + s = 0; + fprintf(f, "\\def\\ell%s{ (0,0)", name); + delta = 1 / N; + for x = (0:delta:(1-delta)) + h = delta / n; + for t = (x+h/2:h:x+delta) + s = s + integrand_e(t, k) * h; + endfor + fprintf(f, "\n -- ({\\dx*%.4f},{\\dy*%.4f})", x + delta, s); + endfor + fprintf(f, "\n}\n"); +endfunction + +fn = fopen("unvollpath.tex", "w"); + +elliptisch1(fn, "Fzero", 0.0); +elliptisch1(fn, "Fone", 0.1); +elliptisch1(fn, "Ftwo", 0.2); +elliptisch1(fn, "Fthree", 0.3); +elliptisch1(fn, "Ffour", 0.4); +elliptisch1(fn, "Ffive", 0.5); +elliptisch1(fn, "Fsix", 0.6); +elliptisch1(fn, "Fseven", 0.7); +elliptisch1(fn, "Feight", 0.8); +elliptisch1(fn, "Fnine", 0.9); +elliptisch1(fn, "Ften", 1.0); + +elliptisch2(fn, "Ezero", 0.0); +elliptisch2(fn, "Eone", 0.1); +elliptisch2(fn, "Etwo", 0.2); +elliptisch2(fn, "Ethree", 0.3); +elliptisch2(fn, "Efour", 0.4); +elliptisch2(fn, "Efive", 0.5); +elliptisch2(fn, "Esix", 0.6); +elliptisch2(fn, "Eseven", 0.7); +elliptisch2(fn, "Eeight", 0.8); +elliptisch2(fn, "Enine", 0.9); +elliptisch2(fn, "Eten", 1.0); + +fclose(fn); diff --git a/buch/chapters/110-elliptisch/images/unvollstaendig.pdf b/buch/chapters/110-elliptisch/images/unvollstaendig.pdf new file mode 100644 index 0000000..4da2c0c Binary files /dev/null and b/buch/chapters/110-elliptisch/images/unvollstaendig.pdf differ diff --git a/buch/chapters/110-elliptisch/images/unvollstaendig.tex b/buch/chapters/110-elliptisch/images/unvollstaendig.tex new file mode 100644 index 0000000..1a1af13 --- /dev/null +++ b/buch/chapters/110-elliptisch/images/unvollstaendig.tex @@ -0,0 +1,100 @@ +% +% unvollstaendig.tex -- Plots der unvollständigen elliptischen integrale +% +% (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{unvollpath.tex} +\begin{document} +\def\skala{1} +\begin{tikzpicture}[>=latex,thick,scale=\skala] + +\pgfkeys{/pgf/number format/.cd, fixed, fixed zerofill, precision=1} + +\def\dx{12.8} +\def\dy{6} + +\definecolor{darkgreen}{rgb}{0,0.6,0} +\definecolor{blau}{rgb}{0.3,0.3,1} + +\begin{scope} +\begin{scope} +\clip (-0.1,-0.1) rectangle ({\dx+0.0},{10.1}); + +\fill[color=darkgreen!10] \ellEzero -- (\dx,{1.571*\dy}) -- (\dx,0) -- cycle; +\fill[color=red!10] \ellEzero -- (\dx,{1.571*\dy}) -- (\dx,10.1) -- (0,10.2) -- cycle; + +\node[color=red] at ({0.6*\dx},{1.3*\dy}) [scale=2] {$F(x,k)$}; +\node[color=darkgreen] at ({0.6*\dx},{0.3*\dy}) [scale=2] {$E(x,k)$}; + + +\draw[color=red!0!blau,line width=1.0pt] \ellFzero; +\draw[color=red!10!blau,line width=1.0pt] \ellFone; +\draw[color=red!20!blau,line width=1.0pt] \ellFtwo; +\draw[color=red!30!blau,line width=1.0pt] \ellFthree; +\draw[color=red!40!blau,line width=1.0pt] \ellFfour; +\draw[color=red!50!blau,line width=1.0pt] \ellFfive; +\draw[color=red!60!blau,line width=1.0pt] \ellFsix; +\draw[color=red!70!blau,line width=1.0pt] \ellFseven; +\draw[color=red!80!blau,line width=1.0pt] \ellFeight; +\draw[color=red!90!blau,line width=1.0pt] \ellFnine; +\draw[color=red!100!blau,line width=1.0pt] \ellFten; + +\draw[color=darkgreen!100!blau,line width=1.0pt] \ellEten; +\draw[color=darkgreen!90!blau,line width=1.0pt] \ellEnine; +\draw[color=darkgreen!80!blau,line width=1.0pt] \ellEeight; +\draw[color=darkgreen!70!blau,line width=1.0pt] \ellEseven; +\draw[color=darkgreen!60!blau,line width=1.0pt] \ellEsix; +\draw[color=darkgreen!50!blau,line width=1.0pt] \ellEfive; +\draw[color=darkgreen!40!blau,line width=1.0pt] \ellEfour; +\draw[color=darkgreen!30!blau,line width=1.0pt] \ellEthree; +\draw[color=darkgreen!20!blau,line width=1.0pt] \ellEtwo; +\draw[color=darkgreen!10!blau,line width=1.0pt] \ellEone; +\draw[color=darkgreen!0!blau,line width=1.0pt] \ellEzero; + +\end{scope} + +\draw[line width=0.2pt] (\dx,0) -- (\dx,10.1); + +\begin{scope} + \clip ({0.7*\dx},0) rectangle (\dx,10.1); + \draw[color=white,line width=0.5pt] \ellEzero -- (\dx,{1.571*\dy}); +\end{scope} + +\draw[->] ({-0.1},0) -- ({\dx+0.3},0) coordinate[label={$x$}]; +\foreach \x in {0,0.2,...,1.0}{ + \draw ({\x*\dx},-0.1) -- ({\x*\dx},0.1); + \node at ({\x*\dx},0) [below] {$\pgfmathprintnumber{\x}$}; +} +\draw[->] (0,{-0.1}) -- (0,{10.3}) coordinate[label={right:$y$}]; +\foreach \y in {0.5,1,1.5}{ + %\draw[line width=0.2pt] (0,{\y*\dy}) -- (\dx,{\y*\dy}); + \draw (-0.1,{\y*\dy}) -- (0.1,{\y*\dy}); + \node at (0,{\y*\dy}) [left] {$\pgfmathprintnumber{\y}$}; +} +\foreach \c in {0,10,...,100}{ + \pgfmathparse{\c/100} + \xdef\k{\pgfmathresult} + \node[color=red!\c!blau] at ({0.02*\dx},{0.95*\dy+0.04*\c}) + [right] {$k=\pgfmathprintnumber{\k}$}; +} +\foreach \c in {0,10,...,100}{ + \pgfmathparse{\c/100} + \xdef\k{\pgfmathresult} + \node[color=darkgreen!\c!blau] at ({0.98*\dx},{0.75*\dy-0.04*\c}) + [left] {$k=\pgfmathprintnumber{\k}$}; +} + +\draw ({\dx-0.1},{1.571*\dy}) -- ({\dx+0.1},{1.571*\dy}); +\node at (\dx,{1.571*\dy}) [right] {$\frac{\pi}2$}; +\end{scope} + +\end{tikzpicture} +\end{document} + -- cgit v1.2.1