Created
July 29, 2010 04:14
-
-
Save ilg/497210 to your computer and use it in GitHub Desktop.
Mathematica code to go along with http://math.stackexchange.com/questions/1099/mandelbrot-like-sets-for-functions-other-than-fzz2c/1107#1107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cosineEscapeTime = | |
Compile[{{c, _Complex}}, | |
Block[{z = c, n = 2, escapeRadius = 10 \[Pi], maxIterations = 100}, | |
While[And[Abs[z] <= escapeRadius, n < maxIterations], | |
z = Cos[z] + c; n++]; n]] | |
DensityPlot[ | |
cosineEscapeTime[x + I y], {x, -2 \[Pi], | |
2 \[Pi]}, {y, -\[Pi], \[Pi]}, PlotPoints -> 250, | |
AspectRatio -> (1/2), ColorFunction -> "TemperatureMap"] | |
Block[{center = {0.5527, 0.9435}, radius = 0.1}, | |
DensityPlot[ | |
cosineEscapeTime[x + I y], {x, center[[1]] - radius, | |
center[[1]] + radius}, {y, center[[2]] - radius, | |
center[[2]] + radius}, PlotPoints -> 250, AspectRatio -> 1, | |
ColorFunction -> "TemperatureMap"]] | |
sineEscapeTime = | |
Compile[{{c, _Complex}}, | |
Block[{z = c, n = 2, escapeRadius = 10 \[Pi], maxIterations = 100}, | |
While[And[Abs[z] <= escapeRadius, n < maxIterations], | |
z = Sin[z] + c; n++]; n]] | |
DensityPlot[ | |
sineEscapeTime[x + I y], {x, -2 \[Pi], 2 \[Pi]}, {y, -\[Pi], \[Pi]}, | |
PlotPoints -> 100, AspectRatio -> (1/2), | |
ColorFunction -> "TemperatureMap"] | |
expEscapeTime = | |
Compile[{{c, _Complex}}, | |
Block[{z = c, n = 2, escapeRadius = 50, maxIterations = 100}, | |
While[And[Abs[z] <= escapeRadius, n < maxIterations], z = E^z + c; | |
n++]; n]] | |
DensityPlot[expEscapeTime[x + I y], {x, -1, 3.5}, {y, -\[Pi], \[Pi]}, | |
PlotPoints -> 250, AspectRatio -> 2 \[Pi]/4.5, | |
ColorFunction -> "TemperatureMap"] | |
Block[{center = {1.142, 1.408}, radius = 0.1}, | |
DensityPlot[ | |
expEscapeTime[x + I y], {x, center[[1]] - radius, | |
center[[1]] + radius}, {y, center[[2]] - radius, | |
center[[2]] + radius}, PlotPoints -> 250, AspectRatio -> 1, | |
ColorFunction -> "TemperatureMap"]] | |
logisticEscapeTime = | |
Compile[{{c, _Complex}}, | |
Block[{z = c, n = 2, escapeRadius = 50, maxIterations = 200}, | |
While[And[Abs[z] <= escapeRadius, n < maxIterations], | |
z = c z (1 - z); n++]; n]] | |
DensityPlot[ | |
logisticEscapeTime[x + I y], {x, -1.5, 1.5}, {y, -1.5, 1.5}, | |
PlotPoints -> 250, AspectRatio -> 1, | |
ColorFunction -> "TemperatureMap"] | |
Block[{center = {1, .25}, radius = 0.1}, | |
DensityPlot[ | |
logisticEscapeTime[x + I y], {x, center[[1]] - radius, | |
center[[1]] + radius}, {y, center[[2]] - radius, | |
center[[2]] + radius}, PlotPoints -> 250, AspectRatio -> 1, | |
ColorFunction -> "TemperatureMap"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment