From 88031a6a5bad428cb3bf03dea6f0f95d79484723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Thu, 16 Jun 2022 17:02:24 +0200 Subject: new plots --- buch/chapters/110-elliptisch/images/Makefile | 13 ++- .../chapters/110-elliptisch/images/jacobiplots.pdf | Bin 56975 -> 59737 bytes buch/chapters/110-elliptisch/images/kegelpara.pdf | Bin 202828 -> 203620 bytes buch/chapters/110-elliptisch/images/lemnispara.cpp | 126 +++++++++++++++++++++ buch/chapters/110-elliptisch/images/lemnispara.pdf | Bin 0 -> 28447 bytes buch/chapters/110-elliptisch/images/lemnispara.tex | 90 +++++++++++++++ buch/chapters/110-elliptisch/images/slcl.pdf | Bin 28233 -> 31823 bytes .../110-elliptisch/images/torusschnitt.pdf | Bin 301677 -> 302496 bytes 8 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 buch/chapters/110-elliptisch/images/lemnispara.cpp create mode 100644 buch/chapters/110-elliptisch/images/lemnispara.pdf create mode 100644 buch/chapters/110-elliptisch/images/lemnispara.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 c8f98cb..3094877 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 slcl.pdf torusschnitt.pdf kegelpara.pdf + sncnlimit.pdf slcl.pdf torusschnitt.pdf kegelpara.pdf lemnispara.pdf lemniskate.pdf: lemniskate.tex pdflatex lemniskate.tex @@ -102,3 +102,14 @@ torusschnitt.jpg: torusschnitt.png Makefile torusschnitt.pdf: torusschnitt.tex torusschnitt.jpg pdflatex torusschnitt.tex +lemnispara: lemnispara.cpp + g++ -O2 -Wall -g -o lemnispara `pkg-config --cflags gsl` \ + lemnispara.cpp `pkg-config --libs gsl` + +lemnisparadata.tex: lemnispara + ./lemnispara + +lemnispara.pdf: lemnispara.tex lemnisparadata.tex + pdflatex lemnispara.tex + +ltest: lemnispara.pdf diff --git a/buch/chapters/110-elliptisch/images/jacobiplots.pdf b/buch/chapters/110-elliptisch/images/jacobiplots.pdf index c11affc..fdd3d1f 100644 Binary files a/buch/chapters/110-elliptisch/images/jacobiplots.pdf and b/buch/chapters/110-elliptisch/images/jacobiplots.pdf differ diff --git a/buch/chapters/110-elliptisch/images/kegelpara.pdf b/buch/chapters/110-elliptisch/images/kegelpara.pdf index 2f76593..2dbe39d 100644 Binary files a/buch/chapters/110-elliptisch/images/kegelpara.pdf and b/buch/chapters/110-elliptisch/images/kegelpara.pdf differ diff --git a/buch/chapters/110-elliptisch/images/lemnispara.cpp b/buch/chapters/110-elliptisch/images/lemnispara.cpp new file mode 100644 index 0000000..6f4d55d --- /dev/null +++ b/buch/chapters/110-elliptisch/images/lemnispara.cpp @@ -0,0 +1,126 @@ +/* + * lemnispara.cpp -- Display parametrisation of the lemniskate + * + * (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const static double s = sqrt(2); +const static double k = 1 / s; +const static double m = k * k; + +typedef std::pair point_t; + +point_t operator*(const point_t& p, double s) { + return point_t(s * p.first, s * p.second); +} + +static double norm(const point_t& p) { + return hypot(p.first, p.second); +} + +static point_t normalize(const point_t& p) { + return p * (1/norm(p)); +} + +static point_t normal(const point_t& p) { + return std::make_pair(p.second, -p.first); +} + +class lemniscate : public point_t { + double sn, cn, dn; +public: + lemniscate(double t) { + gsl_sf_elljac_e(t, m, &sn, &cn, &dn); + first = s * cn * dn; + second = cn * sn; + } + point_t tangent() const { + return std::make_pair(-s * sn * (1.5 - sn * sn), + dn * (1 - 2 * sn * sn)); + } + point_t unittangent() const { + return normalize(tangent()); + } + point_t normal() const { + return ::normal(tangent()); + } + point_t unitnormal() const { + return ::normal(unittangent()); + } +}; + +std::ostream& operator<<(std::ostream& out, const point_t& p) { + char b[1024]; + snprintf(b, sizeof(b), "({%.4f*\\dx},{%.4f*\\dy})", p.first, p.second); + out << b; + return out; +} + +int main(int argc, char *argv[]) { + std::ofstream out("lemnisparadata.tex"); + + // the curve + double tstep = 0.01; + double tmax = 4.05; + out << "\\def\\lemnispath{ "; + out << lemniscate(0); + for (double t = tstep; t < tmax; t += tstep) { + out << std::endl << "\t" << "-- " << lemniscate(t); + } + out << std::endl; + out << "}" << std::endl; + + out << "\\def\\lemnispathmore{ "; + out << lemniscate(tmax); + double tmax2 = 7.5; + for (double t = tmax + tstep; t < tmax2; t += tstep) { + out << std::endl << "\t" << "-- " << lemniscate(t); + } + out << std::endl; + out << "}" << std::endl; + + // individual points + tstep = 0.2; + int i = 0; + char name[3]; + strcpy(name, "L0"); + for (double t = 0; t <= tmax; t += tstep) { + char c = 'A' + i++; + char buffer[128]; + lemniscate l(t); + name[0] = 'L'; + name[1] = c; + out << "\\coordinate (" << name << ") at "; + out << l << ";" << std::endl; + name[0] = 'T'; + out << "\\coordinate (" << name << ") at "; + out << l.unittangent() << ";" << std::endl; + name[0] = 'N'; + out << "\\coordinate (" << name << ") at "; + out << l.unitnormal() << ";" << std::endl; + name[0] = 'C'; + out << "\\def\\" << name << "{ "; + out << "\\node[color=red] at ($(L" << c << ")+0.06*(N" << c << ")$) "; + out << "[rotate={"; + double w = 180 * atan2(l.unitnormal().second, + l.unitnormal().first) / M_PI; + snprintf(buffer, sizeof(buffer), "%.1f", w); + out << buffer; + out << "-90}]"; + snprintf(buffer, sizeof(buffer), "%.1f", t); + out << " {$\\scriptstyle " << buffer << "$};" << std::endl; + out << "}" << std::endl; + } + + out.close(); + return EXIT_SUCCESS; +} diff --git a/buch/chapters/110-elliptisch/images/lemnispara.pdf b/buch/chapters/110-elliptisch/images/lemnispara.pdf new file mode 100644 index 0000000..b03997e Binary files /dev/null and b/buch/chapters/110-elliptisch/images/lemnispara.pdf differ diff --git a/buch/chapters/110-elliptisch/images/lemnispara.tex b/buch/chapters/110-elliptisch/images/lemnispara.tex new file mode 100644 index 0000000..48557cf --- /dev/null +++ b/buch/chapters/110-elliptisch/images/lemnispara.tex @@ -0,0 +1,90 @@ +% +% lemnispara.tex -- parametrization of the lemniscate +% +% (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,calc} +\begin{document} +\def\skala{1} + +\begin{tikzpicture}[>=latex,thick,scale=\skala] +\def\dx{4} +\def\dy{4} +\input{lemnisparadata.tex} + +% add image content here +\draw[color=red!20,line width=1.4pt] \lemnispathmore; +\draw[color=red,line width=1.4pt] \lemnispath; + +\draw[->] ({-1.6*\dx},0) -- ({1.6*\dx},0) coordinate[label={$X$}]; +\draw[->] (0,{-0.7*\dy}) -- (0,{0.7*\dy}) coordinate[label={right:$Y$}]; +\draw ({1.5*\dx},-0.05) -- ({1.5*\dx},0.05); +\draw ({\dx},-0.05) -- ({\dx},0.05); +\draw ({0.5*\dx},-0.05) -- ({0.5*\dx},0.05); +\draw ({-0.5*\dx},-0.05) -- ({-0.5*\dx},0.05); +\draw ({-\dx},-0.05) -- ({-\dx},0.05); +\draw ({-1.5*\dx},-0.05) -- ({-1.5*\dx},0.05); +\draw (-0.05,{0.5*\dy}) -- (0.05,{0.5*\dy}); +\draw (-0.05,{-0.5*\dy}) -- (0.05,{-0.5*\dy}); + +\node at ({\dx},0) [above] {$1$}; +\node at ({-\dx},0) [above] {$-1$}; +\node at ({-0.5*\dx},0) [above] {$-\frac12$}; +\node at ({0.5*\dx},0) [above] {$\frac12$}; +\node at (0,{0.5*\dy}) [left] {$\frac12$}; +\node at (0,{-0.5*\dy}) [left] {$-\frac12$}; + +\def\s{0.02} + +\draw[color=red] ($(LA)-\s*(NA)$) -- ($(LA)+\s*(NA)$); +\draw[color=red] ($(LB)-\s*(NB)$) -- ($(LB)+\s*(NB)$); +\draw[color=red] ($(LC)-\s*(NC)$) -- ($(LC)+\s*(NC)$); +\draw[color=red] ($(LD)-\s*(ND)$) -- ($(LD)+\s*(ND)$); +\draw[color=red] ($(LE)-\s*(NE)$) -- ($(LE)+\s*(NE)$); +\draw[color=red] ($(LF)-\s*(NF)$) -- ($(LF)+\s*(NF)$); +\draw[color=red] ($(LG)-\s*(NG)$) -- ($(LG)+\s*(NG)$); +\draw[color=red] ($(LH)-\s*(NH)$) -- ($(LH)+\s*(NH)$); +\draw[color=red] ($(LI)-\s*(NI)$) -- ($(LI)+\s*(NI)$); +\draw[color=red] ($(LJ)-\s*(NJ)$) -- ($(LJ)+\s*(NJ)$); +\draw[color=red] ($(LK)-\s*(NK)$) -- ($(LK)+\s*(NK)$); +\draw[color=red] ($(LL)-\s*(NL)$) -- ($(LL)+\s*(NL)$); +\draw[color=red] ($(LM)-\s*(NM)$) -- ($(LM)+\s*(NM)$); +\draw[color=red] ($(LN)-\s*(NN)$) -- ($(LN)+\s*(NN)$); +\draw[color=red] ($(LO)-\s*(NO)$) -- ($(LO)+\s*(NO)$); +\draw[color=red] ($(LP)-\s*(NP)$) -- ($(LP)+\s*(NP)$); +\draw[color=red] ($(LQ)-\s*(NQ)$) -- ($(LQ)+\s*(NQ)$); +\draw[color=red] ($(LR)-\s*(NR)$) -- ($(LR)+\s*(NR)$); +\draw[color=red] ($(LS)-\s*(NS)$) -- ($(LS)+\s*(NS)$); +\draw[color=red] ($(LT)-\s*(NT)$) -- ($(LT)+\s*(NT)$); +\draw[color=red] ($(LU)-\s*(NU)$) -- ($(LU)+\s*(NU)$); + +\CB +\CC +\CD +\CE +\CF +\CG +\CH +\CI +\CJ +\CK +\CL +\CM +\CN +\CO +\CP +\CQ +\CR +\CS +\CT +\CU + +\end{tikzpicture} +\end{document} + diff --git a/buch/chapters/110-elliptisch/images/slcl.pdf b/buch/chapters/110-elliptisch/images/slcl.pdf index c15051b..71645e3 100644 Binary files a/buch/chapters/110-elliptisch/images/slcl.pdf and b/buch/chapters/110-elliptisch/images/slcl.pdf differ diff --git a/buch/chapters/110-elliptisch/images/torusschnitt.pdf b/buch/chapters/110-elliptisch/images/torusschnitt.pdf index 11bd353..fde5268 100644 Binary files a/buch/chapters/110-elliptisch/images/torusschnitt.pdf and b/buch/chapters/110-elliptisch/images/torusschnitt.pdf differ -- cgit v1.2.1