From 43dd4efedf1ecfe721cde5830bdcee67ffa48907 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 28 Dec 2004 12:38:45 +0000 Subject: a few new attractors ... svn path=/trunk/externals/tb/; revision=2434 --- chaos/src/latoocarfian.hpp | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 chaos/src/latoocarfian.hpp (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp new file mode 100644 index 0000000..c2a31a1 --- /dev/null +++ b/chaos/src/latoocarfian.hpp @@ -0,0 +1,98 @@ +// +// +// 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" +#include + +// latoocarfian model: x1[n+1] = sin(x2[n]*b) + c*sin(x1[n]*b) +// x2[n+1] = sin(x1[n]*a) + d*sin(x2[n]*a) +// -3 < a,b < 3 +// -0.5 < c,d < 1.5 +// taken from Pickover: Chaos In Wonderland + +class latoocarfian + : public map_base +{ +public: + latoocarfian() + { + m_num_eq = 2; + m_data = new data_t[m_num_eq]; + + CHAOS_SYS_INIT(x1,0.5); + CHAOS_SYS_INIT(x2,0); + CHAOS_SYS_INIT(a,-0.966918); + CHAOS_SYS_INIT(b,2.879879); + CHAOS_SYS_INIT(c,0.765145); + CHAOS_SYS_INIT(d,0.744728); + } + + ~latoocarfian() + { + delete m_data; + } + + virtual void m_step() + { + data_t x1 = m_data[0], x2 = m_data[1]; + data_t a = CHAOS_PARAMETER(a), b = CHAOS_PARAMETER(b), + c = CHAOS_PARAMETER(c), d = CHAOS_PARAMETER(d); + + m_data[0] = sin(x2*b) + c*sin(x1*b); + m_data[1] = sin(x1*a) + d*sin(x2*a); + } + + CHAOS_SYSVAR_FUNCS(x1, 0); + CHAOS_SYSVAR_FUNCS(x2, 1); + + CHAOS_SYSPAR_FUNCS_PRED(a,m_pred_1); + CHAOS_SYSPAR_FUNCS_PRED(b,m_pred_1); + CHAOS_SYSPAR_FUNCS_PRED(c,m_pred_2); + CHAOS_SYSPAR_FUNCS_PRED(d,m_pred_2); + + bool m_pred_1(t_float f) + { + return (f > -3.f) && (f < 3.f); + } + + bool m_pred_2(t_float f) + { + return (f > -0.5) && (f < 1.5); + } +}; + + +#define LATOOCARFIAN_CALLBACKS \ +MAP_CALLBACKS; \ +CHAOS_SYS_CALLBACKS(x1); \ +CHAOS_SYS_CALLBACKS(x2); \ +CHAOS_SYS_CALLBACKS(a); \ +CHAOS_SYS_CALLBACKS(b); \ +CHAOS_SYS_CALLBACKS(c); \ +CHAOS_SYS_CALLBACKS(d); + +#define LATOOCARFIAN_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +CHAOS_SYS_ATTRIBUTE(x1); \ +CHAOS_SYS_ATTRIBUTE(x2); \ +CHAOS_SYS_ATTRIBUTE(a); \ +CHAOS_SYS_ATTRIBUTE(b); \ +CHAOS_SYS_ATTRIBUTE(c); \ +CHAOS_SYS_ATTRIBUTE(d); -- cgit v1.2.1 From 2393d5bab1917825e806871d9050ca54dc3041f3 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 12 Feb 2005 08:58:21 +0000 Subject: stability improvement and others svn path=/trunk/externals/tb/; revision=2568 --- chaos/src/latoocarfian.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index c2a31a1..1fe1b9a 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -76,6 +76,18 @@ public: { return (f > -0.5) && (f < 1.5); } + + /* function has a fix point for x1 == x2 == 0 */ + virtual void m_verify() + { + for (int i = 0; i != get_num_eq(); ++i) + { +#ifndef DOUBLE_PRECISION + if (PD_BIGORSMALL(m_data[i])) + m_data[i] = 0.01; +#endif + } + }; }; -- cgit v1.2.1 From 2434290915cda6ed855e4dc2249312153b995817 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 9 Jun 2005 12:52:17 +0000 Subject: changed initialisation svn path=/trunk/externals/tb/; revision=3145 --- chaos/src/latoocarfian.hpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index 1fe1b9a..9884fd1 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -33,20 +33,22 @@ class latoocarfian public: latoocarfian() { - m_num_eq = 2; - m_data = new data_t[m_num_eq]; + CHAOS_PRECONSTRUCTOR - CHAOS_SYS_INIT(x1,0.5); - CHAOS_SYS_INIT(x2,0); - CHAOS_SYS_INIT(a,-0.966918); - CHAOS_SYS_INIT(b,2.879879); - CHAOS_SYS_INIT(c,0.765145); - CHAOS_SYS_INIT(d,0.744728); + CHAOS_SYS_INIT(x1,0.5,0); + CHAOS_SYS_INIT(x2,0,1); + + CHAOS_PAR_INIT(a,-0.966918); + CHAOS_PAR_INIT(b,2.879879); + CHAOS_PAR_INIT(c,0.765145); + CHAOS_PAR_INIT(d,0.744728); + + CHAOS_POSTCONSTRUCTOR; } ~latoocarfian() { - delete m_data; + } virtual void m_step() -- cgit v1.2.1 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/latoocarfian.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index 9884fd1..9bfba90 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -82,14 +82,10 @@ public: /* function has a fix point for x1 == x2 == 0 */ virtual void m_verify() { - for (int i = 0; i != get_num_eq(); ++i) - { -#ifndef DOUBLE_PRECISION - if (PD_BIGORSMALL(m_data[i])) - m_data[i] = 0.01; -#endif - } - }; + if (m_data[0] == 0 && m_data[1] == 0) + for (int i = 0; i != 2; ++i) + m_data[i] = rand_range(0,0.1); + } }; -- 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/latoocarfian.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index 9bfba90..eec6116 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -31,10 +31,9 @@ class latoocarfian : public map_base { public: - latoocarfian() + latoocarfian(): + map_base(2) { - CHAOS_PRECONSTRUCTOR - CHAOS_SYS_INIT(x1,0.5,0); CHAOS_SYS_INIT(x2,0,1); @@ -42,13 +41,10 @@ public: CHAOS_PAR_INIT(b,2.879879); CHAOS_PAR_INIT(c,0.765145); CHAOS_PAR_INIT(d,0.744728); - - CHAOS_POSTCONSTRUCTOR; } ~latoocarfian() { - } virtual void m_step() -- 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/latoocarfian.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index eec6116..47abc33 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -28,11 +28,10 @@ // taken from Pickover: Chaos In Wonderland class latoocarfian - : public map_base + : public map_base<2> { public: - latoocarfian(): - map_base(2) + latoocarfian() { CHAOS_SYS_INIT(x1,0.5,0); CHAOS_SYS_INIT(x2,0,1); @@ -42,10 +41,6 @@ public: CHAOS_PAR_INIT(c,0.765145); CHAOS_PAR_INIT(d,0.744728); } - - ~latoocarfian() - { - } 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/latoocarfian.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/latoocarfian.hpp') diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index 47abc33..1329bd3 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -42,7 +42,7 @@ public: CHAOS_PAR_INIT(d,0.744728); } - virtual void m_step() + void m_step() { data_t x1 = m_data[0], x2 = m_data[1]; data_t a = CHAOS_PARAMETER(a), b = CHAOS_PARAMETER(b), -- cgit v1.2.1