aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Müller <andreas.mueller@ost.ch>2022-05-23 23:06:11 +0200
committerAndreas Müller <andreas.mueller@ost.ch>2022-05-23 23:06:11 +0200
commite8bb3fd399f2261c9b430ffa319626950499d4c1 (patch)
treefcdd1d5881d1194de3eb0f8bf2628c9ebe8f51fe
parentmore rational integration stuff (diff)
downloadSeminarSpezielleFunktionen-e8bb3fd399f2261c9b430ffa319626950499d4c1.tar.gz
SeminarSpezielleFunktionen-e8bb3fd399f2261c9b430ffa319626950499d4c1.zip
new spherical graph
-rw-r--r--buch/papers/kugel/images/Makefile12
-rw-r--r--buch/papers/kugel/images/spherecurve.m160
-rw-r--r--buch/papers/kugel/images/spherecurve.maxima13
-rw-r--r--buch/papers/kugel/images/spherecurve.pov73
4 files changed, 257 insertions, 1 deletions
diff --git a/buch/papers/kugel/images/Makefile b/buch/papers/kugel/images/Makefile
index e8bf919..6187fed 100644
--- a/buch/papers/kugel/images/Makefile
+++ b/buch/papers/kugel/images/Makefile
@@ -3,7 +3,7 @@
#
# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#
-all: curvature.jpg
+all: curvature.jpg spherecurve.jpg
curvature.inc: curvgraph.m
octave curvgraph.m
@@ -13,3 +13,13 @@ curvature.png: curvature.pov curvature.inc
curvature.jpg: curvature.png
convert curvature.png -density 300 -units PixelsPerInch curvature.jpg
+
+spherecurve.inc: spherecurve.m
+ octave spherecurve.m
+
+spherecurve.png: spherecurve.pov spherecurve.inc
+ povray +A0.1 +W1920 +H1080 +Ospherecurve.png spherecurve.pov
+
+spherecurve.jpg: spherecurve.png
+ convert spherecurve.png -density 300 -units PixelsPerInch spherecurve.jpg
+
diff --git a/buch/papers/kugel/images/spherecurve.m b/buch/papers/kugel/images/spherecurve.m
new file mode 100644
index 0000000..ea9c901
--- /dev/null
+++ b/buch/papers/kugel/images/spherecurve.m
@@ -0,0 +1,160 @@
+#
+# spherecurv.m
+#
+# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+global a;
+a = 5;
+global A;
+A = 10;
+
+phisteps = 400;
+hphi = 2 * pi / phisteps;
+thetasteps = 200;
+htheta = pi / thetasteps;
+
+function retval = f(z)
+ global a;
+ global A;
+ retval = A * exp(a * (z^2 - 1));
+endfunction
+
+function retval = g(z)
+ global a;
+ retval = -f(z) * 2 * a * (2 * a * z^4 + (3 - 2*a) * z^2 - 1);
+ # 2
+ # - a 2 4 2 2 a z
+ #(%o6) - %e (4 a z + (6 a - 4 a ) z - 2 a) %e
+endfunction
+
+phi = (1 + sqrt(5)) / 2;
+
+global axes;
+axes = [
+ 0, 0, 1, -1, phi, -phi;
+ 1, -1, phi, phi, 0, 0;
+ phi, phi, 0, 0, 1, 1;
+];
+axes = axes / (sqrt(phi^2+1));
+
+function retval = kugel(theta, phi)
+ retval = [
+ cos(phi) * sin(theta);
+ sin(phi) * sin(theta);
+ cos(theta)
+ ];
+endfunction
+
+function retval = F(v)
+ global axes;
+ s = 0;
+ for i = (1:6)
+ z = axes(:,i)' * v;
+ s = s + f(z);
+ endfor
+ retval = s / 6;
+endfunction
+
+function retval = F2(theta, phi)
+ v = kugel(theta, phi);
+ retval = F(v);
+endfunction
+
+function retval = G(v)
+ global axes;
+ s = 0;
+ for i = (1:6)
+ s = s + g(axes(:,i)' * v);
+ endfor
+ retval = s / 6;
+endfunction
+
+function retval = G2(theta, phi)
+ v = kugel(theta, phi);
+ retval = G(v);
+endfunction
+
+function retval = cnormalize(u)
+ utop = 11;
+ ubottom = -30;
+ retval = (u - ubottom) / (utop - ubottom);
+ if (retval > 1)
+ retval = 1;
+ endif
+ if (retval < 0)
+ retval = 0;
+ endif
+endfunction
+
+global umin;
+umin = 0;
+global umax;
+umax = 0;
+
+function color = farbe(v)
+ global umin;
+ global umax;
+ u = G(v);
+ if (u < umin)
+ umin = u;
+ endif
+ if (u > umax)
+ umax = u;
+ endif
+ u = cnormalize(u);
+ color = [ u, 0.5, 1-u ];
+ color = color/max(color);
+endfunction
+
+function dreieck(fn, v0, v1, v2)
+ fprintf(fn, " mesh {\n");
+ c = (v0 + v1 + v2) / 3;
+ c = c / norm(c);
+ color = farbe(c);
+ v0 = v0 * (1 + F(v0));
+ v1 = v1 * (1 + F(v1));
+ v2 = v2 * (1 + F(v2));
+ fprintf(fn, "\ttriangle {\n");
+ fprintf(fn, "\t <%.6f,%.6f,%.6f>,\n", v0(1,1), v0(3,1), v0(2,1));
+ fprintf(fn, "\t <%.6f,%.6f,%.6f>,\n", v1(1,1), v1(3,1), v1(2,1));
+ fprintf(fn, "\t <%.6f,%.6f,%.6f>\n", v2(1,1), v2(3,1), v2(2,1));
+ fprintf(fn, "\t}\n");
+ fprintf(fn, "\tpigment { color rgb<%.4f,%.4f,%.4f> }\n",
+ color(1,1), color(1,2), color(1,3));
+ fprintf(fn, "\tfinish { metallic specular 0.5 }\n");
+ fprintf(fn, " }\n");
+endfunction
+
+fn = fopen("spherecurve.inc", "w");
+
+ for i = (1:phisteps)
+ # Polkappe nord
+ v0 = [ 0; 0; 1 ];
+ v1 = kugel(htheta, (i-1) * hphi);
+ v2 = kugel(htheta, i * hphi);
+ fprintf(fn, " // i = %d\n", i);
+ dreieck(fn, v0, v1, v2);
+
+ # Polkappe sued
+ v0 = [ 0; 0; -1 ];
+ v1 = kugel(pi-htheta, (i-1) * hphi);
+ v2 = kugel(pi-htheta, i * hphi);
+ dreieck(fn, v0, v1, v2);
+ endfor
+
+ for j = (1:thetasteps-2)
+ for i = (1:phisteps)
+ v0 = kugel( j * htheta, (i-1) * hphi);
+ v1 = kugel((j+1) * htheta, (i-1) * hphi);
+ v2 = kugel( j * htheta, i * hphi);
+ v3 = kugel((j+1) * htheta, i * hphi);
+ fprintf(fn, " // i = %d, j = %d\n", i, j);
+ dreieck(fn, v0, v1, v2);
+ dreieck(fn, v1, v2, v3);
+ endfor
+ endfor
+
+fclose(fn);
+
+umin
+umax
diff --git a/buch/papers/kugel/images/spherecurve.maxima b/buch/papers/kugel/images/spherecurve.maxima
new file mode 100644
index 0000000..1e9077c
--- /dev/null
+++ b/buch/papers/kugel/images/spherecurve.maxima
@@ -0,0 +1,13 @@
+/*
+ * spherecurv.maxima
+ *
+ * (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+ */
+f: exp(-a * sin(theta)^2);
+
+g: ratsimp(diff(sin(theta) * diff(f, theta), theta)/sin(theta));
+g: subst(z, cos(theta), g);
+g: subst(sqrt(1-z^2), sin(theta), g);
+ratsimp(g);
+
+f: ratsimp(subst(sqrt(1-z^2), sin(theta), f));
diff --git a/buch/papers/kugel/images/spherecurve.pov b/buch/papers/kugel/images/spherecurve.pov
new file mode 100644
index 0000000..86c3745
--- /dev/null
+++ b/buch/papers/kugel/images/spherecurve.pov
@@ -0,0 +1,73 @@
+//
+// curvature.pov
+//
+// (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+//
+
+#version 3.7;
+#include "colors.inc"
+
+global_settings {
+ assumed_gamma 1
+}
+
+#declare imagescale = 0.14;
+
+camera {
+ location <10, 10, -40>
+ look_at <0, 0, 0>
+ right 16/9 * x * imagescale
+ up y * imagescale
+}
+
+light_source {
+ <-10, 10, -40> color White
+ area_light <1,0,0> <0,0,1>, 10, 10
+ adaptive 1
+ jitter
+}
+
+sky_sphere {
+ pigment {
+ color rgb<1,1,1>
+ }
+}
+
+//
+// draw an arrow from <from> to <to> with thickness <arrowthickness> with
+// color <c>
+//
+#macro arrow(from, to, arrowthickness, c)
+#declare arrowdirection = vnormalize(to - from);
+#declare arrowlength = vlength(to - from);
+union {
+ sphere {
+ from, 1.1 * arrowthickness
+ }
+ cylinder {
+ from,
+ from + (arrowlength - 5 * arrowthickness) * arrowdirection,
+ arrowthickness
+ }
+ cone {
+ from + (arrowlength - 5 * arrowthickness) * arrowdirection,
+ 2 * arrowthickness,
+ to,
+ 0
+ }
+ pigment {
+ color c
+ }
+ finish {
+ specular 0.9
+ metallic
+ }
+}
+#end
+
+arrow(<-2.7,0,0>, <2.7,0,0>, 0.03, White)
+arrow(<0,-2.7,0>, <0,2.7,0>, 0.03, White)
+arrow(<0,0,-2.7>, <0,0,2.7>, 0.03, White)
+
+#include "spherecurve.inc"
+