Tanzspuren

Einfache Beispiele

Einstieg: Einige Befehle und ihre Wirkung

Plot[Sin[x], {x, 0, 2  Pi}];

u = 7

?u

f[u_] := u^2 Sin[u] + Cos[u/2]/E^(u)

?f

?u

Plot[f[u], {u, 0, 2  Pi}];

Plot[f[x], {x, 0, 2  Pi}];

Plot[f[x]^2, {x, 0, 2  Pi}];

?*Form

Plot[Sin[x], {x, 0, 2  Pi}] // FullForm

{Cos[x], Sin[x]}

{Cos[x], Sin[x]} // MatrixForm

{Cos[x], Sin[x]} /. x -> 0

ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2  Pi}];

ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2  Pi}, 
        AspectRatio -> Automatic];

k = 6; r = 0.3; 
    ParametricPlot[{{Cos[t], Sin[t]}, {Cos[t], Sin[t]} + 
          r*{Sin[k t], Cos[k t]}, {Cos[t], Sin[t]} + 
          r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
      AspectRatio -> Automatic];

p[r_] := 
        ParametricPlot[{{Cos[t], Sin[t]}, {Cos[t], Sin[t]} + 
              r*{Sin[k t], Cos[k t]}, {Cos[t], Sin[t]} + 
              r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
          AspectRatio -> Automatic];

Table[p[r], {r, 1, 4, 0.5}]

k = 6; r = 0.3; 
    pl1 = ParametricPlot[{{Cos[t], Sin[t]}, {Cos[t], Sin[t]} + 
            r*{Sin[k t], Cos[k t]}, {Cos[t], Sin[t]} + 
            r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
        AspectRatio -> Automatic];
pl2 = 
        Show[Graphics[{PointSize[0.03], 
              Point[{Cos[1], Sin[1]} + r*{Sin[k 1], Cos[k 1]}], 
              Point[{Cos[1], Sin[1]} + r*{Sin[k 1 + Pi], Cos[k 1 + Pi]}], 
              Line[{{Cos[1], Sin[1]} + 
                    r*{Sin[k 1], Cos[k 1]}, {Cos[1], Sin[1]} + 
                    r*{Sin[k 1 + Pi], 
                        Cos[k 1 + Pi]}}], 
Line[{{-1, 
                    0}, {1, 0}}], Line[{{0, -1}, {0, 1}}]}], 
          AspectRatio -> Automatic];
Show[pl1, pl2]

k = 6; r = 0.3; 
    ParametricPlot[{{0, t}, {0, t} + r*{Sin[k t], Cos[k t]}, {0, t} + 
          r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
      AspectRatio -> Automatic];

k = 6; r = 0.3; 
    ParametricPlot[{{t/10, Sin[t/4]}}, {t, 0, 2  Pi}, 
      AspectRatio -> Automatic];

k = 6; r = 0.3; 
    ParametricPlot[{{t/10, Sin[t/4]}, {t/10, Sin[t/4]} + 
          r*{Sin[k t], Cos[k t]}, {t/10, Sin[t/4]} + 
          r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
      AspectRatio -> Automatic];

k = 6; r = 0.3; 
    ParametricPlot[{{t/10, Sin[t]}, {t/10, Sin[t]} + 
          r*{Sin[k t], Cos[k t]}, {t/10, Sin[t]} + 
          r*{Sin[k t + Pi], Cos[k t + Pi]}}, {t, 0, 2  Pi}, 
      AspectRatio -> Automatic];

Erzeugung mit ParametricPlot

ParametricPlot[{3  Cos[x], 3 Sin[x]}, {x, 0, 2  Pi}, 
        AspectRatio -> Automatic];

ParametricPlot[{{3  Cos[x], 
            3 Sin[x]}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x],  
              Sin[5  x]/2}}, {x, 0, 2  Pi}, 
        AspectRatio -> Automatic];

ParametricPlot[{{3  Cos[x], 
            3 Sin[x]}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x],  
              Sin[5  x]/2}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x + Pi],  
              Sin[5  x + Pi]/2}}, {x, 0, 2  Pi}, 
        AspectRatio -> Automatic];

Animationsmöglichkeiten

?*Animation*

Remove["Global`*"]

Select the graphics, go to cell, animate selected graphics....

Table[
        ParametricPlot[{{3  Cos[x], 
              3 Sin[x]}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x],  
                Sin[5  x]/2}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x + Pi],  
                Sin[5  x + Pi]/2}}, {x, 0, h 2  Pi}, 
          AspectRatio -> Automatic,  Axes -> False], {h, 0.1, 10, 
          0.1}];

<< Graphics`Animation`

Select the graphics, go to cell, animate selected graphics....

MovieParametricPlot[{s Cos[2 Pi s + t], s Sin[2 Pi s + t]}, {s, 
        0, 4}, {t, 0, 10  Pi}, Frames -> 10, Axes -> False, 
      AspectRatio -> Automatic, 
      PlotRange -> {{-4, 4}, {-4, 4}}]

Select the graphics, go to cell, animate selected graphics....

MovieParametricPlot[{{3  Cos[x], 
            3 Sin[x]}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x],  
              Sin[5  x]/2}, {3  Cos[x], 3 Sin[x]} + {Cos[5  x + Pi],  
              Sin[5  x + Pi]/2}}, {x, 0, h 2  Pi}, {h, 0.1, 10}, 
        AspectRatio -> Automatic,  Axes -> False];

Select the graphics, go to cell, animate selected graphics....

MovieParametricPlot[{{3  Cos[x], 
            3 Sin[x]}, {3  Cos[x] + h, 3 Sin[x] + h} + {Cos[5  x],  
              Sin[5  x]/2}, {3  Cos[x] + h, 
              3 Sin[x] + h} + {Cos[5  x + Pi],  Sin[5  x + Pi]/2}}, {x, h, 
          2  h/3 +  2  Pi}, {h, 0.1, 20}, AspectRatio -> Automatic,  
        Axes -> False];

Select the graphics, go to cell, animate selected graphics....

?Epilog

?Hue

{3  Cos[10  x] + h, 3 Sin[10  x] + h}

Animate[
        ParametricPlot[{{3  Cos[2  x], 3 Sin[2  x]}, 
            v1 = {3  Cos[x] + h, 3 Sin[x] + h} + {Cos[5  x],  Sin[5  x]/2}, 
            v2 = {3  Cos[x] + h, 3 Sin[x] + h} + {Cos[5  x + Pi],  
                  Sin[5  x + Pi]/2}, 
u = {3  Cos[x] + h, 
                3 Sin[x] + h}}, {x, h, 2  h/3 +  2  Pi}, 
          AspectRatio -> Automatic,  Axes -> False,  
          Epilog -> {PointSize[0.05], Hue[1], 
              Point[u], 
PointSize[0.03], Hue[0.6], 
              Point[v1], Point[v2]
}], {h, 0, 5  Pi, 0.1}, 
        AnimationDisplayTime -> 0.5];

Ein Beispiel

New

Anleitung: 
1. Markiere den äussersten rechten Balken mit der Maus (dieser muss sich schwarz färben).
2. Drücke ENTER, d.h. lasse alle Teilprogramme laufen. 
3. Wenn alles gelaufen ist: Markiere wieder den äussersten rechten Balken mit der Maus (dieser muss sich schwarz färben).
4. Klicke im Pull-Down-Menu oben mit der Maus auf "Cell", dann dort auf "Animate Selected Graphics"
5. Jetzt läuft der Film ab. Um diesen wieder anzuhalten klickt man mit der Maus auf irgend eine der Graphiken. 
6. Versuche die Programme abzuändern und teste sie nach jedem Aenderungsschritt aus.
7. Produziere deinen eigenen Tanzfilm.

Remove["Global`*"]

Off[ ];
Off[General::spell];
Off[General::spell1];

Grundfigur Kreis

var1Stop2Never3Use = 1;

kreis2[pM_, r_] := 
        Show[Graphics[Circle[pM, r]], PlotRange -> All, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];

pList[n_, t_, r_, {vec1_, vec2_}] := 
        Flatten[Table[{Hue[k/n], 
              Point[r {-Cos[t 2  Pi/(4  n) + k 2  Pi/n], 
                      Sin[t 2  Pi/(4  n) + k 2  Pi/n]} + {vec1, 
                    vec2}]}, {k, 0, n - 1}], 1];
If[var1Stop2Never3Use == 9,  
        Print[pList[8, 2, r, {vec1, vec2}]] , 
        leer = leer];
pListA[n_, t_, r_, {vec1_, vec2_}, j_] := 
        Flatten[Table[{Hue[k/n], 
              Point[r {j, Sin[t 2  Pi/(4  n) + k 2  Pi/n]} + {vec1, 
                    vec2}]}, {k, 0, n - 1}], 1];
If[var1Stop2Never3Use == 9,  
        Print[pList[8, 2, r, {vec1, vec2}]] , leer = leer];

ou[n_, t_, r_, {vec1_, vec2_}] := 
        Show[Graphics[
            Join[{PointSize[0.04]},  pList[n, t, r, {vec1, vec2}] ]], 
          PlotRange -> All, AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
oa[n_, t_, r_, {vec1_, vec2_}, j_] := 
        Show[Graphics[
            Join[{PointSize[0.04]},  pListA[n, t, r, {vec1, vec2}, j] ]], 
          PlotRange -> All, AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
t1 = 
        Table[Show[kreis2[{0, 0}, 5], ou[8, t, 5, {0, 0}], 
            DisplayFunction -> Identity], {t, 0, 
            32}];
t2 = 
        Table[Show[kreis2[{0, 0}, 5], ou[8, 0, r, {0, 0}], 
            DisplayFunction -> Identity], {r, -5, 
            5}];
Show[t1, t2, DisplayFunction -> $DisplayFunction]

Table[
        Show[kreis2[{0, 0}, 5], ou[8, t, 5, {0, 0}], 
          DisplayFunction -> $DisplayFunction], {t, 0, 
          32}];

Table[
        Show[kreis2[{0, 0}, 5], ou[8, 0, 10  t/32 - 5, {0, 0}], 
          DisplayFunction -> $DisplayFunction], {t, 0, 
          32}];

Table[
        Show[kreis2[{0, 0}, 5], ou[8, t, 5, {0, 0}], 
          ou[8, 0, 10  t/32 - 5, {0, 0}], 
          DisplayFunction -> $DisplayFunction], {t, 0, 
          32}];

Table[Show[kreis2[{0,0},5],ou[8,t,5,{0,0}],ou[4,0,10t/32-5,{0,0}],DisplayFunction->$DisplayFunction],{t,0,32}];

Table[Show[kreis2[{0,0},5],ou[8,t,5,{0,0}],ou[8,-t,4,{0,0}],ou[4,0,10t/32-5,{0,0}],DisplayFunction->$DisplayFunction],{t,0,32}];

Table[Show[kreis2[{0,0},5],ou[8,t,5,{0,0}],ou[8,-t,4,{0,0}],ou[4,0,10t/32-5,{0,0}],oa[8,t,5,{0,0},2],DisplayFunction->$DisplayFunction],{t,0,32}];

Table[
        Show[Graphics[
{Point[5 {2 + 1, 1 + 1}], 
              Point[-5 {2 + 1, 1 + 1}]}, PlotRange -> All, 
            AspectRatio -> Automatic, 
            DisplayFunction -> $DisplayFunction], 
kreis2[{0, 0}, 5], 
          ou[8, t, 5, 5 Sin[t/(20) 2  Pi] {2, 1}], 
          DisplayFunction -> $DisplayFunction], {t, 0, 
          20}];

Table[
        Show[Graphics[
{Point[5 {2 + 1, 1 + 1}], 
              Point[-5 {2 + 1, 1 + 1}]}, PlotRange -> All, 
            AspectRatio -> Automatic, 
            DisplayFunction -> $DisplayFunction], 
kreis2[{0, 0}, 5], 
          ou[8, t, 5, 5 Sin[t/(20) 2  Pi] {2, 1}], 
          ou[8, t, 5, 5 Sin[t/(20) 2  Pi + Pi] {-1, 2}], 
          DisplayFunction -> $DisplayFunction], {t, 0, 
          20}];

Grundfigur Quadrat

Remove[fg1,g2,pLin]

f[r_,t_/;0 ≤t && t<Pi/4]:=r{1,Sin[2t]};
f[r_,t_/;Pi/4≤t && t<3Pi/4]:=r{Cos[2 t-2 Pi/4],1};
f[r_,t_/;3Pi/4≤t && t<5Pi/4]:=r{-1,Cos[2 t-2 3Pi/4]};
f[r_,t_/;5Pi/4≤t && t<7Pi/4]:=r{-Cos[2t-2 5Pi/4],-1};
f[r_,t_/;7Pi/4≤t && t<8Pi/4]:=r{1,Sin[2t-2 8Pi/4]};
g1[r_,k_,n_,col_]=Flatten[{Hue[col],Point[f[r,k 2 Pi/n]]}];
g2[r_,k_,n_,col_]=Flatten[{Hue[col],Point[-f[r,(n-1-k )2 Pi/n]]}];
pLin[r_,k_,n_,col_]:=Show[Graphics[Join[{PointSize[0.03],Point[{r,-r}],Point[{r,r}],Point[{-r,r}],Point[{-r,-r}]},Join[{PointSize[0.05]},g1[r,k,n,col],g2[r,k,n,1-col]]],PlotRange->All,AspectRatio->Automatic]];
Table[pLin[3,k,40,0.3],{k,0,39}];

Zwischendurch an Ort

Remove["Global`*"]

f[x_] := x;
f[x_ /; x > 1] := Floor[x];
g[x_] := f[Mod[x, 2]] + Floor[x/2];

Plot[g[x], {x, -10, 10}, 
        AspectRatio -> Automatic];

h[t_, n_] := Pi g[n 2  t/Pi]/2 /n;

Plot[h[x, 1], {x, 0, 2  Pi}, 
        AspectRatio -> Automatic];

Plot[h[x,2],{x,0,2Pi},AspectRatio->Automatic];

s[t_, n_] := t n  Pi;

parP1[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]},{t,0,2Pi},AspectRatio->Automatic,PlotRange->All];
parP1[2];

parP[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]},{t,0,4Pi},AspectRatio->Automatic,PlotRange->All];
parP[2];

parP[k_] := 
        ParametricPlot[{Cos[h[t, k]], 
              Sin[h[t, k]]} (2 + Sin[2 t k]^2), {t, 0, 4  Pi}, 
          AspectRatio -> Automatic, 
          PlotRange -> All];
parP[2];

parP[4];

parP[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]} (2+Sin[2 t k]^2),{t,0,4Pi},
      AspectRatio->Automatic,PlotRange->All,DisplayFunction->Identity];
pt1[k_]:={Cos[h[t,k]],Sin[h[t,k]]} (2+Sin[2 t k]^2);
pt2[k_]:={Cos[h[t,k]],Sin[h[t,k]]} (3-Sin[2 t k+Pi/(2k)]^2)

tabFilm[k_, r_] := 
        Table[Show[parP[k], 
            Graphics[{Circle[{0, 0}, r], Hue[0.6], PointSize[0.04], 
                Point[pt1[k]], Hue[1], Point[pt2[k]]}], 
            AspectRatio -> Automatic, PlotRange -> All, 
            DisplayFunction -> $DisplayFunction], {t, 0, k Pi, 
            0.1}];
tabFilm[4, 2];

Ein zweites Beispiel

Remove["Global`*"]

Off[ ];
Off[General::spell];
Off[General::spell1];

Zwischendurch an Ort, etwas andere Figur

Remove["Global`*"]

f[x_] := x;
f[x_ /; x > 1] := Floor[x];
g[x_] := f[Mod[x, 2]] + Floor[x/2];

Plot[g[x], {x, -10, 10}, 
        AspectRatio -> Automatic];

h[t_, n_] := Pi g[n 2  t/Pi]/2 /n;

Plot[h[x, 1], {x, 0, 2  Pi}, 
        AspectRatio -> Automatic];

Plot[h[x,2],{x,0,2Pi},AspectRatio->Automatic];

s[t_, n_] := t n  Pi;

parP1[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]},{t,0,2Pi},AspectRatio->Automatic,PlotRange->All];
parP1[2];

parP[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]},{t,0,4Pi},AspectRatio->Automatic,PlotRange->All];
parP[2];

parP[k_] := 
        ParametricPlot[{Cos[h[t, k]], 
              Sin[h[t, k]]} (2 + Sin[2 t k]^2), {t, 0, 4  Pi}, 
          AspectRatio -> Automatic, PlotRange -> All, 
          Axes -> False];
parP[2];

parP[1];

parP[1/2];

parP[4];

({{Export["name.ext", graphics] }, {Export["file", graphics, "format"] }, {Export["file", {(Subscript[g, 1]), (Subscript[g, 2]), … }, … ] }, {ExportString[graphics, "format"] }}) GIF!  ({{"GIF" , GIF and animated GIF (.gif) }})

?ImageSize

?PlotRegion

Options[Plot]

parP[k_]:=ParametricPlot[{Cos[h[t,k]],Sin[h[t,k]]} (3+Sin[2 t k]),{t,0,4Pi},
      AspectRatio->Automatic,PlotRange->All,DisplayFunction->Identity];
      parP1[k_]:=ParametricPlot[{Cos[h[t,k]+Pi/8],Sin[h[t,k]+Pi/8]} (3-Sin[2 t k]^2),{t,0,4Pi},AspectRatio->Automatic,PlotRange->All,DisplayFunction->Identity];
pt1[k_]:={Cos[h[t,k]],Sin[h[t,k]]} (3+Sin[2 t k]);
pt2[k_]:={Cos[h[t,k]+Pi/8],Sin[h[t,k]+Pi/8]} (3-Sin[2 t k]^2)

tabFilm[k_, r_] := 
        Table[Show[parP[k], parP1[k], 
            Graphics[{Circle[{0, 0}, r], Circle[{0, 0}, r + 1.5], Hue[0.6], 
                PointSize[0.06], Point[pt1[k]], Hue[1], Point[pt2[k]]}], 
            AspectRatio -> Automatic, PlotRange -> All, 
            DisplayFunction -> $DisplayFunction, 
            PlotRegion -> {{0.3, 0.8}, {0.3, 0.8}}], {t, 0, 4 Pi, 
            0.1}];
tabFilm[2, 3];

Export["GIFAnimationTanz",tabFilm[2,3],"GIF"]