This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Square root wave from sum of iterated sines

By: a guest on Jan 12th, 2013  |  syntax: None  |  size: 4.24 KB  |  views: 29  |  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. (*program start*)
  2. Clear[x, y, n, a, xmin, xmax, ymin, ymax, c]
  3. xmin = -1*Pi;
  4. xmax = +3*Pi;
  5. x = N[Range[xmin, xmax, 1/(50*Pi)], 90];
  6. y1 = Sin[x];
  7. y2 = Sin[y1];
  8. y3 = Sin[y1 + y2];
  9. y4 = Sin[y1 + y2 + y3];
  10. y5 = Sin[y1 + y2 + y3 + y4];
  11. y6 = Sin[y1 + y2 + y3 + y4 + y5];
  12. y7 = Sin[y1 + y2 + y3 + y4 + y5 + y6];
  13. y8 = Sin[y1 + y2 + y3 + y4 + y5 + y6 + y7];
  14. y9 = Sin[y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8];
  15. y10 = Sin[y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8 + y9];
  16. y11 = Sin[y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8 + y9 + y10];
  17. y12 = Sin[y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8 + y9 + y10 + y11];
  18. y = y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8 + y9 + y10 + y11 + y12;
  19. Max[y]
  20. a = Table[{x[[n]], y[[n]]}, {n, 1, Length[x]}];
  21. a1 = Table[{x[[n]], y1[[n]]}, {n, 1, Length[x]}];
  22. a2 = Table[{x[[n]], y2[[n]]}, {n, 1, Length[x]}];
  23. a3 = Table[{x[[n]], y3[[n]]}, {n, 1, Length[x]}];
  24. a4 = Table[{x[[n]], y4[[n]]}, {n, 1, Length[x]}];
  25. a5 = Table[{x[[n]], y5[[n]]}, {n, 1, Length[x]}];
  26. a6 = Table[{x[[n]], y6[[n]]}, {n, 1, Length[x]}];
  27. a7 = Table[{x[[n]], y7[[n]]}, {n, 1, Length[x]}];
  28. a8 = Table[{x[[n]], y8[[n]]}, {n, 1, Length[x]}];
  29. a9 = Table[{x[[n]], y9[[n]]}, {n, 1, Length[x]}];
  30. a10 = Table[{x[[n]], y10[[n]]}, {n, 1, Length[x]}];
  31. a11 = Table[{x[[n]], y11[[n]]}, {n, 1, Length[x]}];
  32. a12 = Table[{x[[n]], y12[[n]]}, {n, 1, Length[x]}];
  33. ymin = Min[y]/Pi;
  34. ymax = Max[y]/Pi;
  35. ymin = -10/2*Pi;
  36. ymax = 10/2*Pi;
  37.  
  38. g = ListLinePlot[a,
  39.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  40.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  41.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2},
  42.    PlotStyle -> RGBColor[1, 0, 1]];
  43. g1 = ListLinePlot[a1,
  44.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  45.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  46.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  47. g2 = ListLinePlot[a2,
  48.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  49.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  50.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  51. g3 = ListLinePlot[a3,
  52.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  53.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  54.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  55. g4 = ListLinePlot[a4,
  56.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  57.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  58.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  59. g5 = ListLinePlot[a5,
  60.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  61.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  62.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  63. g6 = ListLinePlot[a6,
  64.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  65.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  66.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  67. g7 = ListLinePlot[a7,
  68.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  69.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  70.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  71.  
  72. g8 = ListLinePlot[a8,
  73.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  74.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  75.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  76.  
  77. g9 = ListLinePlot[a9,
  78.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  79.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  80.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  81.  
  82. g10 = ListLinePlot[a10,
  83.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  84.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  85.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  86.  
  87. g11 = ListLinePlot[a11,
  88.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  89.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  90.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  91.  
  92. g12 = ListLinePlot[a12,
  93.    Ticks -> {Flatten[{xmin, xmax, Table[n, {n, xmin, xmax, Pi}]}],
  94.      Flatten[{ymin, ymax, Table[k, {k, ymin, ymax, Pi}]}]},
  95.    ImageSize -> Full, PlotRange -> {-Pi - 1/2, Pi + 1/2}];
  96.  
  97. Show[g, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12]
  98. (*program end*)
clone this paste RAW Paste Data