Logistic map: x <- r * x * (1 - x) (May, "Simple mathematical models with very complicated dynamics", Nature 261, 1976). More...
#include <chaos.hpp>
Public Member Functions | |
| void | set_r (double r) |
| double | r () const |
| void | seed (double x0) |
| Initial condition, in (0, 1). | |
| void | reset () |
| SampleType | next () |
| Advance and return the state in [0, 1]. | |
| SampleType | next_bipolar () |
| Advance and return the state mapped to [-1, 1]. | |
| SampleType | current () const |
Static Public Attributes | |
| static constexpr double | kMinR = 3.5 |
| static constexpr double | kMaxR = 4.0 |
| static constexpr double | kEpsilon = 1.0e-6 |
| Distance kept from the fixed points at 0 and 1. | |
Logistic map: x <- r * x * (1 - x) (May, "Simple mathematical models with very complicated dynamics", Nature 261, 1976).
The useful range of r is [3.5, 4.0]. At 3.5 the orbit is a clean 4-cycle; by 3.57 it has gone chaotic through period doubling; at 4.0 it fills the unit interval. Sweeping r across that range is the "one knob from rhythmic to unpredictable" gesture the map is worth having for.
The state is clamped away from the 0 and 1 fixed points. At r = 4 an unlucky value lands exactly on one of them and the map sticks there forever; the clamp costs nothing and turns a silent death into a continued orbit.
|
inline |
|
inline |
Advance and return the state in [0, 1].
|
inline |
Advance and return the state mapped to [-1, 1].
|
inline |
|
inline |
|
inline |
Initial condition, in (0, 1).
Two instances with the same seed and the same r produce identical orbits forever. Applies immediately, like Xorshift32::seed(); reset() rewinds to it.
|
inline |
|
staticconstexpr |
Distance kept from the fixed points at 0 and 1.
|
staticconstexpr |
|
staticconstexpr |