I am trying to make just a general picture that looks like this one:
It doesn't have to look exactly like this, but just look like a general bifurcation in similar spirit to this one.
And here is the code I tried:
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{luacode}
\begin{luacode*}
function logistic()
local function map(r,x)
return r*x*(1-x)
end
for r = 2.5,4,0.005 do
x = 0.1
for i = 1, 200 do
x = map(r,x)
end
for i = 1, 250 do
x = map(r,x)
tex.sprint("("..r..","..x..")")
end
end
end
\end{luacode*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[tick label style={font=\tiny}]
\edef\logisticplot{\noexpand\addplot [color=black!10, mesh, only marks,
mark size = 0.05pt, opacity = 0.1] coordinates{ \directlua{logistic()} };}
\logisticplot
\end{axis}
\end{tikzpicture}
\end{document}
I found the code on this website, but I don't understand this language so I can't figure out why the code isn't working: http://texwelt.de/wissen/fragen/7097/wie-kann-man-einen-iterativen-plot-eleganter-schreiben
Best Answer
Here is solution provided with a bit of research, minor code modification, and implemented using
R
andknitr
withLaTeX
.