Function Repository Resource:

HofstadterButterfly

Source Notebook

Plot successive steps of Hofstadter’s butterfly

Contributed by: Enrique Zeleny

ResourceFunction["HofstadterButterfly"][n]

show the plot for n steps of Hofstadter’s butterfly.

Details and Options

ResourceFunction["HofstadterButterfly"] has the same options as Graphics, as well as ColorFunction and PlotStyle.

Examples

Basic Examples (1) 

Show 15 steps for Hofstadter’s butterfly:

In[1]:=
ResourceFunction["HofstadterButterfly"][15]
Out[1]=

Options (3) 

PlotStyle (1) 

Specify a PlotStyle:

In[2]:=
ResourceFunction["HofstadterButterfly"][10, PlotStyle -> {Thickness[.01]}]
Out[2]=

ColorFunction (2) 

Specify a ColorFunction:

In[3]:=
ResourceFunction["HofstadterButterfly"][20, ColorFunction -> ColorData["BrightBands"]]
Out[3]=

A different ColorFunction:

In[4]:=
ResourceFunction["HofstadterButterfly"][20, ColorFunction -> (ColorData[{"TemperatureMap", "Reverse"}][#2] &)]
Out[4]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 20 February 2019

License Information