diff options
author | Andreas Müller <andreas.mueller@ost.ch> | 2022-04-20 10:30:56 +0200 |
---|---|---|
committer | Andreas Müller <andreas.mueller@ost.ch> | 2022-04-20 10:30:56 +0200 |
commit | 0344a846c083c11e9ed93ddc5898dd55c6dd1022 (patch) | |
tree | 284ff262d32e7e1138679b56bbc11060e4bc0db8 /buch/chapters/110-elliptisch/images | |
parent | Singularitaeten (diff) | |
download | SeminarSpezielleFunktionen-0344a846c083c11e9ed93ddc5898dd55c6dd1022.tar.gz SeminarSpezielleFunktionen-0344a846c083c11e9ed93ddc5898dd55c6dd1022.zip |
lemniscate sine stuff
Diffstat (limited to '')
-rw-r--r-- | buch/chapters/110-elliptisch/images/Makefile | 9 | ||||
-rw-r--r-- | buch/chapters/110-elliptisch/images/jacobiplots.pdf | bin | 56975 -> 56975 bytes | |||
-rw-r--r-- | buch/chapters/110-elliptisch/images/lemniskate.pdf | bin | 9914 -> 14339 bytes | |||
-rw-r--r-- | buch/chapters/110-elliptisch/images/lemniskate.tex | 15 | ||||
-rw-r--r-- | buch/chapters/110-elliptisch/images/slcl.cpp | 128 | ||||
-rw-r--r-- | buch/chapters/110-elliptisch/images/slcl.pdf | bin | 0 -> 28269 bytes | |||
-rw-r--r-- | buch/chapters/110-elliptisch/images/slcl.tex | 88 |
7 files changed, 237 insertions, 3 deletions
diff --git a/buch/chapters/110-elliptisch/images/Makefile b/buch/chapters/110-elliptisch/images/Makefile index 68322b6..a7c9e74 100644 --- a/buch/chapters/110-elliptisch/images/Makefile +++ b/buch/chapters/110-elliptisch/images/Makefile @@ -5,7 +5,7 @@ # all: lemniskate.pdf ellipsenumfang.pdf unvollstaendig.pdf rechteck.pdf \ ellipse.pdf pendel.pdf jacobiplots.pdf jacobidef.pdf jacobi12.pdf \ - sncnlimit.pdf + sncnlimit.pdf slcl.pdf lemniskate.pdf: lemniskate.tex pdflatex lemniskate.tex @@ -71,3 +71,10 @@ jacobi12.pdf: jacobi12.tex sncnlimit.pdf: sncnlimit.tex pdflatex sncnlimit.tex +slcl: slcl.cpp + g++ -O -Wall -std=c++11 slcl.cpp -o slcl `pkg-config --cflags gsl` `pkg-config --libs gsl` + +slcldata.tex: slcl + ./slcl --outfile=slcldata.tex --a=0 --b=13.4 --steps=200 +slcl.pdf: slcl.tex slcldata.tex + pdflatex slcl.tex diff --git a/buch/chapters/110-elliptisch/images/jacobiplots.pdf b/buch/chapters/110-elliptisch/images/jacobiplots.pdf Binary files differindex 88cf119..f0e6e78 100644 --- a/buch/chapters/110-elliptisch/images/jacobiplots.pdf +++ b/buch/chapters/110-elliptisch/images/jacobiplots.pdf diff --git a/buch/chapters/110-elliptisch/images/lemniskate.pdf b/buch/chapters/110-elliptisch/images/lemniskate.pdf Binary files differindex 063a3e1..9e02c3c 100644 --- a/buch/chapters/110-elliptisch/images/lemniskate.pdf +++ b/buch/chapters/110-elliptisch/images/lemniskate.pdf diff --git a/buch/chapters/110-elliptisch/images/lemniskate.tex b/buch/chapters/110-elliptisch/images/lemniskate.tex index f74a81f..fe90631 100644 --- a/buch/chapters/110-elliptisch/images/lemniskate.tex +++ b/buch/chapters/110-elliptisch/images/lemniskate.tex @@ -27,13 +27,16 @@ \draw[color=red,line width=2.0pt] plot[domain=45:\a,samples=100] ({\x}:{sqrt(2*cos(2*\x))}); -\draw[->] (-1.5,0) -- (1.5,0) coordinate[label={$x$}]; -\draw[->] (0,-0.7) -- (0,0.7) coordinate[label={right:$y$}]; +\draw[->] (-1.5,0) -- (1.7,0) coordinate[label={$X$}]; +\draw[->] (0,-0.7) -- (0,0.7) coordinate[label={right:$Y$}]; \fill[color=white] (1,0) circle[radius=0.02]; \draw (1,0) circle[radius=0.02]; +\node at ({1},0) [below] {$\displaystyle a\mathstrut$}; + \fill[color=white] (-1,0) circle[radius=0.02]; \draw (-1,0) circle[radius=0.02]; +\node at ({-1},0) [below] {$\displaystyle\llap{$-$}a\mathstrut$}; \node[color=blue] at (\a:{0.6*sqrt(2*cos(2*\a))}) [below] {$r$}; \node[color=red] at ({\b}:{sqrt(2*cos(2*\b))}) [above] {$s$}; @@ -41,6 +44,14 @@ \fill[color=white] (\a:{sqrt(2*cos(2*\a))}) circle[radius=0.02]; \draw[color=red] (\a:{sqrt(2*cos(2*\a))}) circle[radius=0.02]; +\draw ({sqrt(2)},{-0.1/\skala}) -- ({sqrt(2)},{0.1/\skala}); +\node at ({sqrt(2)},0) [below right] + {$\displaystyle a\mathstrut\sqrt{2}$}; +\draw ({-sqrt(2)},{-0.1/\skala}) -- ({-sqrt(2)},{0.1/\skala}); +\node at ({-sqrt(2)},0) [below left] + {$\displaystyle -a\mathstrut\sqrt{2}$}; + + \end{tikzpicture} \end{document} diff --git a/buch/chapters/110-elliptisch/images/slcl.cpp b/buch/chapters/110-elliptisch/images/slcl.cpp new file mode 100644 index 0000000..8584e94 --- /dev/null +++ b/buch/chapters/110-elliptisch/images/slcl.cpp @@ -0,0 +1,128 @@ +/* + * slcl.cpp + * + * (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule + */ +#include <cstdlib> +#include <cstdio> +#include <cmath> +#include <iostream> +#include <fstream> +#include <sstream> +#include <getopt.h> +#include <vector> +#include <gsl/gsl_sf_elljac.h> + +namespace slcl { + +static struct option longopts[] { +{ "outfile", required_argument, NULL, 'o' }, +{ "a", required_argument, NULL, 'a' }, +{ "b", required_argument, NULL, 'b' }, +{ "steps", required_argument, NULL, 'n' }, +{ NULL, 0, NULL, 0 } +}; + +class plot { + typedef std::pair<double, double> point_t; + typedef std::vector<point_t> curve_t; + curve_t _sl; + curve_t _cl; + double _a; + double _b; + int _steps; +public: + double a() const { return _a; } + double b() const { return _b; } + int steps() const { return _steps; } +public: + plot(double a, double b, int steps) : _a(a), _b(b), _steps(steps) { + double l = sqrt(2); + double k = 1 / l; + double m = k * k; + double h = (b - a) / steps; + for (int i = 0; i <= steps; i++) { + double x = a + h * i; + double sn, cn, dn; + gsl_sf_elljac_e(x, m, &sn, &cn, &dn); + _sl.push_back(std::make_pair(l * x, k * sn / dn)); + _cl.push_back(std::make_pair(l * x, cn)); + } + } +private: + std::string point(const point_t p) const { + char buffer[128]; + snprintf(buffer, sizeof(buffer), "({%.4f*\\dx},{%.4f*\\dy})", + p.first, p.second); + return std::string(buffer); + } + std::string path(const curve_t& curve) const { + std::ostringstream out; + auto i = curve.begin(); + out << point(*(i++)); + do { + out << std::endl << " -- " << point(*(i++)); + } while (i != curve.end()); + out.flush(); + return out.str(); + } +public: + std::string slpath() const { + return path(_sl); + } + std::string clpath() const { + return path(_cl); + } +}; + +/** + * \brief Main function for the slcl program + */ +int main(int argc, char *argv[]) { + int longindex; + int c; + double a = 0; + double b = 10; + int steps = 100; + std::ostream *out = &std::cout; + while (EOF != (c = getopt_long(argc, argv, "a:b:o:n:", + longopts, &longindex))) + switch (c) { + case 'a': + a = std::stod(optarg); + break; + case 'b': + b = std::stod(optarg) / sqrt(2); + break; + case 'n': + steps = std::stol(optarg); + break; + case 'o': + out = new std::ofstream(optarg); + break; + } + + plot p(a, b, steps); + (*out) << "\\def\\slpath{ " << p.slpath(); + (*out) << std::endl << " }" << std::endl; + (*out) << "\\def\\clpath{ " << p.clpath(); + (*out) << std::endl << " }" << std::endl; + + out->flush(); + //out->close(); + return EXIT_SUCCESS; +} + +} // namespace slcl + +int main(int argc, char *argv[]) { + try { + return slcl::main(argc, argv); + } catch (const std::exception& e) { + std::cerr << "terminated by exception: " << e.what(); + std::cerr << std::endl; + } catch (...) { + std::cerr << "terminated by unknown exception" << std::endl; + } + return EXIT_FAILURE; +} diff --git a/buch/chapters/110-elliptisch/images/slcl.pdf b/buch/chapters/110-elliptisch/images/slcl.pdf Binary files differnew file mode 100644 index 0000000..493b5fa --- /dev/null +++ b/buch/chapters/110-elliptisch/images/slcl.pdf diff --git a/buch/chapters/110-elliptisch/images/slcl.tex b/buch/chapters/110-elliptisch/images/slcl.tex new file mode 100644 index 0000000..08241ac --- /dev/null +++ b/buch/chapters/110-elliptisch/images/slcl.tex @@ -0,0 +1,88 @@ +% +% 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} +\input{slcldata.tex} +\def\skala{1} +\begin{tikzpicture}[>=latex,thick,scale=\skala] + +% add image content here +\def\lemniscateconstant{2.6220575542} +\pgfmathparse{(3.1415926535/2)/\lemniscateconstant} +\xdef\scalechange{\pgfmathresult} + +\pgfmathparse{\scalechange*(180/3.1415926535)} +\xdef\ts{\pgfmathresult} + +\def\dx{1} +\def\dy{3} + +\draw[line width=0.3pt] + ({\lemniscateconstant*\dx},0) + -- + ({\lemniscateconstant*\dx},{1*\dy}); +\draw[line width=0.3pt] + ({2*\lemniscateconstant*\dx},0) + -- + ({2*\lemniscateconstant*\dx},{-1*\dy}); +\draw[line width=0.3pt] + ({3*\lemniscateconstant*\dx},0) + -- + ({3*\lemniscateconstant*\dx},{-1*\dy}); +\draw[line width=0.3pt] + ({4*\lemniscateconstant*\dx},0) + -- + ({4*\lemniscateconstant*\dx},{1*\dy}); +\draw[line width=0.3pt] + ({5*\lemniscateconstant*\dx},0) + -- + ({5*\lemniscateconstant*\dx},{1*\dy}); + +\draw[color=red!20,line width=1.4pt] + plot[domain=0:13,samples=200] ({\x},{\dy*sin(\ts*\x)}); +\draw[color=blue!20,line width=1.4pt] + plot[domain=0:13,samples=200] ({\x},{\dy*cos(\ts*\x)}); + +\draw[color=red,line width=1.4pt] \slpath; +\draw[color=blue,line width=1.4pt] \clpath; + +\draw[->] (0,{-1*\dy-0.1}) -- (0,{1*\dy+0.4}) coordinate[label={right:$r$}]; +\draw[->] (-0.1,0) -- (13.7,0) coordinate[label={$s$}]; + +\foreach \i in {1,2,3,4,5}{ + \draw ({\lemniscateconstant*\i},-0.1) -- ({\lemniscateconstant*\i},0.1); +} +\node at ({\lemniscateconstant*\dx},0) [below left] {$ \varpi\mathstrut$}; +\node at ({2*\lemniscateconstant*\dx},0) [below left] {$2\varpi\mathstrut$}; +\node at ({3*\lemniscateconstant*\dx},0) [below right] {$3\varpi\mathstrut$}; +\node at ({4*\lemniscateconstant*\dx},0) [below right] {$4\varpi\mathstrut$}; +\node at ({5*\lemniscateconstant*\dx},0) [below left] {$5\varpi\mathstrut$}; + +\node[color=red] at ({1.6*\lemniscateconstant*\dx},{0.6*\dy}) + [below left] {$\operatorname{sl}(s)$}; +\node[color=red!50] at ({1.5*\lemniscateconstant*\dx},{sin(1.5*90)*\dy*0.90}) + [above right] {$\sin \bigl(\frac{\pi}{2\varpi}s\bigr)$}; + +\node[color=blue] at ({1.4*\lemniscateconstant*\dx},{-0.6*\dy}) + [above right] {$\operatorname{cl}(s)$}; +\node[color=blue!50] at ({1.5*\lemniscateconstant*\dx},{cos(1.5*90)*\dy*0.90}) + [below left] {$\cos\bigl(\frac{\pi}{2\varpi}s\bigr)$}; + +\draw (-0.1,{1*\dy}) -- (0.1,{1*\dy}); +\draw (-0.1,{-1*\dy}) -- (0.1,{-1*\dy}); +\node at (0,{1*\dy}) [left] {$1\mathstrut$}; +\node at (0,0) [left] {$0\mathstrut$}; +\node at (0,{-1*\dy}) [left] {$-1\mathstrut$}; + +\end{tikzpicture} +\end{document} + |