Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::LogisticMapT< SampleType > Class Template Reference

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.

Detailed Description

template<typename SampleType = float>
class pulp::signal::LogisticMapT< SampleType >

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.

Member Function Documentation

◆ current()

template<typename SampleType = float>
SampleType pulp::signal::LogisticMapT< SampleType >::current ( ) const
inline

◆ next()

template<typename SampleType = float>
SampleType pulp::signal::LogisticMapT< SampleType >::next ( )
inline

Advance and return the state in [0, 1].

◆ next_bipolar()

template<typename SampleType = float>
SampleType pulp::signal::LogisticMapT< SampleType >::next_bipolar ( )
inline

Advance and return the state mapped to [-1, 1].

◆ r()

template<typename SampleType = float>
double pulp::signal::LogisticMapT< SampleType >::r ( ) const
inline

◆ reset()

template<typename SampleType = float>
void pulp::signal::LogisticMapT< SampleType >::reset ( )
inline

◆ seed()

template<typename SampleType = float>
void pulp::signal::LogisticMapT< SampleType >::seed ( double x0)
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.

◆ set_r()

template<typename SampleType = float>
void pulp::signal::LogisticMapT< SampleType >::set_r ( double r)
inline

Member Data Documentation

◆ kEpsilon

template<typename SampleType = float>
double pulp::signal::LogisticMapT< SampleType >::kEpsilon = 1.0e-6
staticconstexpr

Distance kept from the fixed points at 0 and 1.

◆ kMaxR

template<typename SampleType = float>
double pulp::signal::LogisticMapT< SampleType >::kMaxR = 4.0
staticconstexpr

◆ kMinR

template<typename SampleType = float>
double pulp::signal::LogisticMapT< SampleType >::kMinR = 3.5
staticconstexpr

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/chaos.hpp