Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Evolute

By: Matthen on Nov 21st, 2012  |  syntax: None  |  size: 1.32 KB  |  views: 108  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. x[t_] := (1 + Cos[t]) Sin[t];
  2. y[t_] := -(1 + Cos[t]) Cos[t];
  3. tmin = 0; tmax = 2 Pi;
  4. n = 41;
  5. notzero[x_] := If[x == 0, 0.001, x];
  6. normals = N@Table[{y'[t], -x'[t]}, {t, tmin, tmax, (tmax - tmin)/n}];
  7. ps = N@Table[{x[t], y[t]}, {t, tmin, tmax, (tmax - tmin)/n}];
  8. ts = N@Table[t, {t, tmin, tmax, (tmax - tmin)/n}];
  9. X[t_] := x[t] -
  10.    y'[t] ( x'[t]^2 + y'[t]^2)/notzero[x'[t] y''[t] - x''[t] y'[t]];
  11. Y[t_] := y[t] +
  12.    x'[t] ( x'[t]^2 + y'[t]^2)/notzero[x'[t] y''[t] - x''[t] y'[t]];
  13. Manipulate[
  14.  Show[
  15.   Graphics[{}, PlotRange -> {{-2, 2}, {-3, 1}},
  16.    ImageSize -> {300, 300}],
  17.   Reverse@Table[
  18.     ParametricPlot[
  19.      ps[[i]] + t normals[[i]]/notzero@Norm[normals[[i]]], {t, -100,
  20.       100},
  21.      PlotStyle ->
  22.       If[i == \[Tau] || i == \[Tau] - Length@ts,
  23.        Directive[Thickness[0.01], RGBColor[0.4, 0.4, 0.9]],
  24.        Directive[Thick, Opacity[0.4], RGBColor[0.1, 0.1, 0.1]]]
  25.      ], {i, If[\[Tau] > Length[ts], \[Tau] - Length[ts], 1],
  26.      If[\[Tau] > Length[ts], Length[ts], \[Tau]]}],
  27.   ParametricPlot[{{x[t], y[t]}, {X[t], Y[t]}}, {t, tmin, tmax},
  28.    PlotStyle -> {Directive[Thick, RGBColor[0.9, 0.2, 0.3]],
  29.      Directive[Thick, RGBColor[1.0, 0.1, 0.2]]}],
  30.   Graphics[{PointSize[0.05], RGBColor[0.2, 0.2, 0.6],
  31.     Point[ps[[Mod[\[Tau], Length@ts, 1]]]]}]
  32.   ],
  33.  
  34.  {\[Tau], 1, 2 Length[ts], 1}]