From d1ed55f96f9cecc818844006fb36cd58ca70da5e Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 16 Jun 2005 13:02:02 +0000 Subject: - parameter searching (broken) - misc. updates svn path=/trunk/externals/tb/; revision=3192 --- chaos/src/delayed_logistic.hpp | 92 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 chaos/src/delayed_logistic.hpp (limited to 'chaos/src/delayed_logistic.hpp') diff --git a/chaos/src/delayed_logistic.hpp b/chaos/src/delayed_logistic.hpp new file mode 100644 index 0000000..c78785f --- /dev/null +++ b/chaos/src/delayed_logistic.hpp @@ -0,0 +1,92 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "map_base.hpp" + +// delayed logistic map: x[n+1] = alpha * x[n] * (1 - x[n-1]) +// 0 < x[n] < 1 +// 0 <= alpha <= 4 +// taken from E. Atlee Jackson: Perspective of nonlinear dynamics (Vol. 2) + +class delayed_logistic: + public map_base +{ +public: + delayed_logistic() + { + CHAOS_PRECONSTRUCTOR; + + CHAOS_SYS_INIT(x, 0.5, 0); + + CHAOS_PAR_INIT(alpha, 3.8); + + CHAOS_POSTCONSTRUCTOR; + + m_delayed = get_x(); /* the initial state of the delay */ + } + + ~delayed_logistic() + { + + } + + virtual void m_step() + { + data_t x = m_data[0]; + data_t alpha = CHAOS_PARAMETER(alpha); + data_t delayed = m_delayed; + + m_delayed = x; + m_data[0] = alpha * x * (1.f - delayed); + + } + data_t m_delayed; + + CHAOS_SYSPAR_FUNCS_PRED(alpha, m_pred_alpha); + bool m_pred_alpha(t_float f) + { + return (f > 0) && (f < 4); + } + + CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred_x); + bool m_pred_x(t_float f) + { + return (f > 0) && (f < 1); + } + + virtual void m_verify() + { + data_t x = m_data[0]; + if (m_pred_x(x)) + return; + m_data[0] = 0.5; + } +}; + +#define DELAYED_LOGISTIC_CALLBACKS \ +MAP_CALLBACKS; \ +CHAOS_SYS_CALLBACKS(alpha); \ +CHAOS_SYS_CALLBACKS(x); + +#define DELAYED_LOGISTIC_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +CHAOS_SYS_ATTRIBUTE(alpha); \ +CHAOS_SYS_ATTRIBUTE(x); + -- cgit v1.2.1 From ef53e19b3d9019b1b1f3345390f55ae9229ce390 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 22 Oct 2005 15:11:45 +0000 Subject: cleanups and new system svn path=/trunk/externals/tb/; revision=3750 --- chaos/src/delayed_logistic.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'chaos/src/delayed_logistic.hpp') diff --git a/chaos/src/delayed_logistic.hpp b/chaos/src/delayed_logistic.hpp index c78785f..47360e7 100644 --- a/chaos/src/delayed_logistic.hpp +++ b/chaos/src/delayed_logistic.hpp @@ -29,16 +29,12 @@ class delayed_logistic: public map_base { public: - delayed_logistic() + delayed_logistic(): + map_base(1) { - CHAOS_PRECONSTRUCTOR; - CHAOS_SYS_INIT(x, 0.5, 0); - CHAOS_PAR_INIT(alpha, 3.8); - CHAOS_POSTCONSTRUCTOR; - m_delayed = get_x(); /* the initial state of the delay */ } -- cgit v1.2.1 From 13cba7a7997e318fbba01a36912219355e387d52 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 18:34:34 +0000 Subject: rewrote most stuff using templates svn path=/trunk/externals/tb/; revision=5105 --- chaos/src/delayed_logistic.hpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'chaos/src/delayed_logistic.hpp') diff --git a/chaos/src/delayed_logistic.hpp b/chaos/src/delayed_logistic.hpp index 47360e7..3db7e27 100644 --- a/chaos/src/delayed_logistic.hpp +++ b/chaos/src/delayed_logistic.hpp @@ -26,11 +26,10 @@ // taken from E. Atlee Jackson: Perspective of nonlinear dynamics (Vol. 2) class delayed_logistic: - public map_base + public map_base<1> { public: - delayed_logistic(): - map_base(1) + delayed_logistic() { CHAOS_SYS_INIT(x, 0.5, 0); CHAOS_PAR_INIT(alpha, 3.8); @@ -38,10 +37,7 @@ public: m_delayed = get_x(); /* the initial state of the delay */ } - ~delayed_logistic() - { - - } + virtual void m_step() { -- cgit v1.2.1 From 2c157bd8aa1f5387169cc0c0910d36c8068c4068 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 19:17:04 +0000 Subject: improved inlining for maps svn path=/trunk/externals/tb/; revision=5106 --- chaos/src/delayed_logistic.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/delayed_logistic.hpp') diff --git a/chaos/src/delayed_logistic.hpp b/chaos/src/delayed_logistic.hpp index 3db7e27..d7f7539 100644 --- a/chaos/src/delayed_logistic.hpp +++ b/chaos/src/delayed_logistic.hpp @@ -39,7 +39,7 @@ public: - virtual void m_step() + void m_step() { data_t x = m_data[0]; data_t alpha = CHAOS_PARAMETER(alpha); -- cgit v1.2.1