Advertisement
Guest User

Fractals

a guest
Sep 25th, 2014
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. (* Content-type: application/vnd.wolfram.cdf.text *)
  2.  
  3. (*** Wolfram CDF File ***)
  4. (* http://www.wolfram.com/cdf *)
  5.  
  6. (* CreatedBy='Mathematica 9.0' *)
  7.  
  8. (*************************************************************************)
  9. (* *)
  10. (* The Mathematica License under which this file was created prohibits *)
  11. (* restricting third parties in receipt of this file from republishing *)
  12. (* or redistributing it by any means, including but not limited to *)
  13. (* rights management or terms of use, without the express consent of *)
  14. (* Wolfram Research, Inc. For additional information concerning CDF *)
  15. (* licensing and redistribution see: *)
  16. (* *)
  17. (* www.wolfram.com/cdf/adopting-cdf/licensing-options.html *)
  18. (* *)
  19. (*************************************************************************)
  20.  
  21. (*CacheID: 234*)
  22. (* Internal cache information:
  23. NotebookFileLineBreakTest
  24. NotebookFileLineBreakTest
  25. NotebookDataPosition[ 1063, 20]
  26. NotebookDataLength[ 3895, 123]
  27. NotebookOptionsPosition[ 4556, 123]
  28. NotebookOutlinePosition[ 4901, 138]
  29. CellTagsIndexPosition[ 4858, 135]
  30. WindowFrame->Normal*)
  31.  
  32. (* Beginning of Notebook Content *)
  33. Notebook[{
  34. Cell[BoxData[
  35. RowBox[{"Manipulate", "[", "\[IndentingNewLine]",
  36. RowBox[{
  37. RowBox[{
  38. RowBox[{"pts", "=",
  39. RowBox[{
  40. RowBox[{
  41. RowBox[{"{",
  42. RowBox[{
  43. RowBox[{"Re", "@", "#"}], ",",
  44. RowBox[{"Im", "@", "#"}]}], "}"}], "&"}], "/@",
  45. RowBox[{"Table", "[",
  46. RowBox[{
  47. RowBox[{"E", "^",
  48. RowBox[{"(",
  49. RowBox[{"2", "I", " ", "Pi", " ",
  50. RowBox[{"r", "/", "n"}]}], ")"}]}], ",",
  51. RowBox[{"{",
  52. RowBox[{"r", ",", "0", ",",
  53. RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}]}], ";",
  54. "\[IndentingNewLine]",
  55. RowBox[{"f", "[",
  56. RowBox[{"iters", ",",
  57. RowBox[{"{",
  58. RowBox[{"{",
  59. RowBox[{"0", ",", "0"}], "}"}], "}"}], ",", "r", ",", "pts"}], "]"}],
  60. ";", "\[IndentingNewLine]",
  61. RowBox[{"Column", "@",
  62. RowBox[{"{",
  63. RowBox[{
  64. RowBox[{"Text", "[",
  65. RowBox[{"\"\<n = \>\"", "<>", " ",
  66. RowBox[{"ToString", "@", "n"}]}], "]"}], ",",
  67. RowBox[{"Text", "[",
  68. RowBox[{"\"\<r = \>\"", "<>", " ",
  69. RowBox[{"ToString", "@", "r"}]}], "]"}], ",",
  70. RowBox[{"Text", "[",
  71. RowBox[{"\"\<Iters = \>\"", "<>", " ",
  72. RowBox[{"ToString", "@", "iters"}]}], "]"}], ",",
  73. RowBox[{"Graphics", "[",
  74. RowBox[{
  75. RowBox[{"{",
  76. RowBox[{
  77. RowBox[{"AbsolutePointSize", "[", "1", "]"}], ",",
  78. RowBox[{"Point", "@", "k"}]}], "}"}], ",",
  79. RowBox[{"ImageSize", "\[Rule]", "600"}]}], "]"}]}], "}"}]}]}], ",",
  80. "\[IndentingNewLine]",
  81. RowBox[{"{",
  82. RowBox[{
  83. RowBox[{"{",
  84. RowBox[{"n", ",", "3"}], "}"}], ",", "3", ",", "8", ",", "1"}], "}"}],
  85. ",", "\[IndentingNewLine]",
  86. RowBox[{"{",
  87. RowBox[{
  88. RowBox[{"{",
  89. RowBox[{"r", ",", ".5"}], "}"}], ",", "0", ",", "1"}], "}"}], ",",
  90. "\[IndentingNewLine]",
  91. RowBox[{"{",
  92. RowBox[{
  93. RowBox[{"{",
  94. RowBox[{"iters", ",", "1000"}], "}"}], ",", "1000", ",", "20000"}],
  95. "}"}], ",", "\[IndentingNewLine]",
  96. RowBox[{"TrackedSymbols", "\[Rule]",
  97. RowBox[{"{",
  98. RowBox[{"n", ",", "r", ",", "iters"}], "}"}]}], ",",
  99. "\[IndentingNewLine]",
  100. RowBox[{"Initialization", "\[RuleDelayed]",
  101. RowBox[{"(", "\[IndentingNewLine]",
  102. RowBox[{
  103. RowBox[{"f", "[",
  104. RowBox[{"n_", ",", "s_", ",", "r_", ",", "p_"}], "]"}], ":=",
  105. RowBox[{"(",
  106. RowBox[{
  107. RowBox[{"k", "=", "s"}], ";", "\[IndentingNewLine]",
  108. RowBox[{"Do", "[",
  109. RowBox[{
  110. RowBox[{"AppendTo", "[",
  111. RowBox[{"k", ",",
  112. RowBox[{
  113. RowBox[{
  114. RowBox[{"k", "[",
  115. RowBox[{"[",
  116. RowBox[{"-", "1"}], "]"}], "]"}], " ",
  117. RowBox[{"(",
  118. RowBox[{"1", "-", "r"}], ")"}]}], " ", "+", " ",
  119. RowBox[{"r", " ",
  120. RowBox[{"RandomChoice", "@", "p"}]}]}]}], "]"}], ",",
  121. RowBox[{"{", "n", "}"}]}], "]"}]}], ")"}]}], ")"}]}]}],
  122. "\[IndentingNewLine]", "]"}]], "Input"]
  123. },
  124. WindowSize->{851, 655},
  125. WindowMargins->{{168, Automatic}, {Automatic, 60}},
  126. FrontEndVersion->"9.0 for Microsoft Windows (32-bit) (January 25, 2013)",
  127. StyleDefinitions->"Default.nb"
  128. ]
  129. (* End of Notebook Content *)
  130.  
  131. (* Internal cache information *)
  132. (*CellTagsOutline
  133. CellTagsIndex->{}
  134. *)
  135. (*CellTagsIndex
  136. CellTagsIndex->{}
  137. *)
  138. (*NotebookFileOutline
  139. Notebook[{
  140. Cell[1463, 33, 3089, 88, 292, "Input"]
  141. }
  142. ]
  143. *)
  144.  
  145. (* End of internal cache information *)
  146.  
  147. (* NotebookSignature 3uTy#CsucPn1EBwGswVJLU40 *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement