Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Visualize one-dimensional iterated functions
ResourceFunction["CobwebPlot"][f,x0,n,{a,b}] plots the real function f along with the diagonal line over the range a to b and, starting from x0, computes n iterates of the function, reflecting each iteration of the function in the diagonal line. |
Display a cobweb plot of 10 iterations of the map starting at x0=2:
In[1]:= | ![]() |
Out[1]= | ![]() |
Show the cobweb as a dashed red line:
In[2]:= | ![]() |
Out[2]= | ![]() |
For the logistic map, xn+1:=α xn(1-xn), display the cobweb plot of , varying the parameter α, the starting value x0 and the number of iterations n:
In[3]:= | ![]() |
Out[3]= | ![]() |
Display the logistic map along with the associated Feigenbaum diagram:
In[4]:= | ![]() |
Out[4]= | ![]() |
For integer values the map corresponds to the (reduced) Collatz (or 3X+1) function: if x is even, return x/2, but if x is odd, return (3x+1)/2. For small starting integers n, the Collatz map iterates to the cycle 1↔2 and the cobweb plot converges to the yellow square:
In[5]:= | ![]() |
Out[5]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License