using PlutoUI , Plots
plotly()
the logistic map
read Sethna sec 4.3
results
r in 1:3 stable
3 < r < 3.45 oscillation between 2 values
r > 3.45 CRAZY
md"
# the logistic map
## read Sethna sec 4.3
## results
```math
\begin{aligned}
x_{n+1} = r \, x_n \, (1 - x_n)
\end{aligned}
```
* r in 1:3 stable
* 3 < r < 3.45 oscillation between 2 values
* r > 3.45 CRAZY
"
logistic_map (generic function with 1 method)
let
# visual aid to understand end points
# r = 3.4 has 2 end points
# solution is at x = f(x) = f(f(x)) = ...
r = 3.4
end
invariant density: a histogram of a trajectory at a given r
md"
# invariant density: a histogram of a trajectory at a given r
"
let
# invariant density
# just plot the number of occurances in a histogram
rval = 3.61
x_arr = []
x = 0.28
for i1 = 1:85000
end
# for r = 4
label="analytic (r=4)",
)
end
let
rarr = range(0.5, 4.1, length = 140)
function track(r1)
xarr = []
x = 0.8
for i1 = 1:120
end
end
function plot_one(i1)
return scatter!(
markersize = 0.8,
color="black",
ylim = (0, 1),
label = "",
)
end
for i1 = 1:20
end
other map
or
have similar feature.
md"
# other map
```math
\begin{aligned}
x_{n+1} = r \, sin(\pi \, x_n)
\end{aligned}
```
or
```math
\begin{aligned}
x_{n+1} = x_n \, e^{\, r \, (1-x_n)}
\end{aligned}
```
have similar feature.
"
let
# there nothing special about the function r*x*(1-x)
# a sine function map will work too
function sin_map(x; r = 0.5)
# iterate once
end
rarr = range(0.0, 1.2, length = 120)
function track(r1)
xarr = []
x = 0.8
for i1 = 1:80
end
end
function plot_one(i1)
return scatter!(
markersize = 0.8,
ylim = (0, 1.2),
let
# yet another map
function exp_map(x; r = 0.5)
# iterate once
end
rarr = range(1.4, 4.0, length = 180)
function track(r1)
xarr = []
x = 0.4
for i1 = 1:80
end
end
function plot_one(i1)
return scatter!(
markersize = 0.8,
ylim = (0, 4.0),
label = "",
)
end
further reading
runs this with more points offline
https://www.google.com/search?q=logistic+map
J.F. Boudreau and E.S. Swanson, Applied Computational Physics (ch.13)
what about matrix?
md"
# further reading
* runs this with more points offline
* https://www.google.com/search?q=logistic+map
* J.F. Boudreau and E.S. Swanson, Applied Computational Physics (ch.13)
* [simple math models](https://www.nature.com/articles/261459a0)
* what about matrix?
"
using LinearAlgebra
let
# not sure what is going on
# just for fun
rarr = range(0.01, 2.8, length = 50)
function logi(x; r = 0.5)
# iterate once
end
function track(r1)
xarr = []
x = reshape(rand(4), (2, 2))
for i1 = 1:120
end
end
function plot_one(i1)
return scatter!(
markersize = 0.8,
ylim = (0, 3.5),