davidjamesweir’s avatardavidjamesweir’s Twitter Archive—№ 3,356

    1. Logistic map graffiti – Dale Street, Manchester, 6.5.2019. en.wikipedia.org/wiki/Logistic_map
      oh my god twitter doesn’t include alt text from images in their API
  1. …in reply to @davidjamesweir
    import matplotlib.pyplot as plt, numpy as np lmap=lambda x,r: r*x*(1-x) pts=2000 iters=1000 r=np.linspace(0,4,pts) x0=np.random.rand(pts) for i in range(iters): x0=list(map(lmap,x0,r)) plt.scatter(r,x0,0.1) plt.xlabel('$r$') plt.ylabel('$x_{%d}$' % pts) plt.savefig('map.pdf')
    oh my god twitter doesn’t include alt text from images in their API
    1. …in reply to @davidjamesweir
      (There was a typo in the above: plt.ylabel('$x_{%d}$' % pts) should have been plt.ylabel('$x_{%d}$' % iters) –but then it wouldn't have fit in a tweet 🤷) Anyway here's one coloured by the period of the cycle at each r, up to a maximum of 128. This one doesn't fit in a tweet 😅.
      oh my god twitter doesn’t include alt text from images in their API
      1. …in reply to @davidjamesweir
        Last go, for now. I realised the plot can be made to look nicer, and denser, by including all the points in each cycle, not just the last iteration. So here's the result of that, with 5000 points. Even with my terrible code, it runs in just a couple of minutes on my old MacBook.
        oh my god twitter doesn’t include alt text from images in their API
        1. …in reply to @davidjamesweir
          I put the code for these explorations into a Jupyter notebook and it's viewable here: mybinder.org/v2/git/https%3A%2F%2Fversion.helsinki.fi%2Fweir%2Fexploring-the-logistic-map/master?filepath=Logistic%20Map.ipynb
          1. …in reply to @davidjamesweir
            The repo with this notebook is here version.helsinki.fi/weir/exploring-the-logistic-map/ and I tidied up the code to make the 'period plot'. I also fixed some problems that came up when actually trying to run the code on mybinder 😅 (namely, it needs a requirements.txt).
            oh my god twitter doesn’t include alt text from images in their API