English: Time series of an orbit of the Mandelbrot map.
Plotting code:
# Argument: floating point c, or "selection"
import sys, decimal, matplotlib.pyplot as plt
decimal.getcontext().prec=100
dpi=300
cSelection = ["0.2501", "0.24", "-0.4", "-0.74", "-0.8", "-1.24", "-1.26", "-1.38", "-1.42", "-1.74991",
"-1.74992", "-1.75", "-1.8", "-1.99"]
imageSuffix = ".svg" # can be ".svg", ".png", etc.
cStr = sys.argv[1]
seriesLen = 300
if len(sys.argv) > 2:
seriesLen = int(sys.argv[2])
def plotC(cStr):
c = decimal.Decimal(cStr)
xSeries = [0] * seriesLen
x = decimal.Decimal(0)
xSeries[0] = float(x)
for i in xrange(seriesLen - 1):
try:
x = x * x + c
xSeries[i + 1] = float(x)
except decimal.Overflow:
xSeries[i + 1] = float("nan")
# Output
for i in xrange(seriesLen):
print xSeries[i]
# Plot
fig, biax = plt.subplots()
figSize = fig.get_size_inches()
fig.set_size_inches(figSize[0] * 3/2, figSize[1])
plt.rc('font', size=8)
biax.plot(range(seriesLen), xSeries, ".-", linewidth=0.5, markersize=1)
biax.set(xlabel="i", ylabel="x", title="Orbit time series for $f(x) = x^2 + c$; c=" + str(c))
plt.grid(linewidth=0.25, color="#DDDDDD")
cStr = str(c).replace(".", "p").replace("-", "m")
fileName = "MandelbrotMapOrbitTimeSeries_" + cStr + imageSuffix
plt.savefig(fileName, dpi=dpi)
if cStr == "selection":
for cStr in cSelection:
plotC(cStr)
else:
plotC(cStr)