The Conley-Morse Graphs Software
m_henon.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2///
3/// @file m_henon.h
4///
5/// The Henon map.
6///
7/// @author Pawel Pilarczyk
8///
9/////////////////////////////////////////////////////////////////////////////
10
11// Copyright (C) 1997-2014 by Pawel Pilarczyk.
12//
13// This file is part of my research software package. This is free software:
14// you can redistribute it and/or modify it under the terms of the GNU
15// General Public License as published by the Free Software Foundation,
16// either version 3 of the License, or (at your option) any later version.
17//
18// This software is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this software; see the file "license.txt". If not,
25// please, see <https://www.gnu.org/licenses/>.
26
27// Started on January 18, 2010. Last revision: January 18, 2010.
28
29
30#ifndef _CMGRAPHS_HENON_H_
31#define _CMGRAPHS_HENON_H_
32
33
34// the generic class for the type of a map
35#include "maptype.h"
36
37// the interval arithmetic data types
38#include "typeintv.h"
39
40
41// --------------------------------------------------
42// -------- a sample difference equation map --------
43// --------------------------------------------------
44
45/// This class defines the Henon map.
46/// There are only two parameters of this map: 'a' and 'b'.
47class MapHenon: public MapType
48{
49public:
50 /// The default constructor.
51 MapHenon ();
52
53 /// Computes the image of a box whose left and right coordinates
54 /// are given. Fills in the images with the left and right
55 /// coordinates of the image box.
56 void compute (const double *xleft, const double *xright,
57 double *yleft, double *yright, int dim,
58 const spcCoord *coord, int subdiv) const;
59
60}; /* class MapHenon */
61
62// --------------------------------------------------
63
65{
67 return;
68} /* MapHenon::MapHenon */
69
70inline void MapHenon::compute (const double *xleft, const double *xright,
71 double *yleft, double *yright, int dim, const spcCoord *, int) const
72{
73 if (dim != 2)
74 throw "Wrong phase space dim for the Henon map.";
77 IntervalType x (xleft [0], xright [0]);
78 IntervalType x2;
79 if ((xleft [0] >= 0) || (xright [0] <= 0))
80 {
81 x2 = x * x;
82 }
83 else
84 {
85 IntervalType half (0, (-xleft [0] >= xright [0]) ?
86 (-xleft [0]) : xright [0]);
87 x2 = half * half;
88 }
89 IntervalType y (xleft [1], xright [1]);
90 IntervalType one (1.0, 1.0);
91 IntervalType xNew (y + one - a * x2);
92 IntervalType yNew (b * x);
93 yleft [0] = xNew. leftBound ();
94 yright [0] = xNew. rightBound ();
95 yleft [1] = yNew. leftBound ();
96 yright [1] = yNew. rightBound ();
97
98 // swich the rounding direction to the neutral one
100 return;
101} /* MapHenon::compute */
102
103
104#endif // _CMGRAPHS_HENON_H_
105
This class defines the Henon map.
Definition: m_henon.h:48
MapHenon()
The default constructor.
Definition: m_henon.h:64
void compute(const double *xleft, const double *xright, double *yleft, double *yright, int dim, const spcCoord *coord, int subdiv) const
Computes the image of a box whose left and right coordinates are given.
Definition: m_henon.h:70
This is an abstract class which defines the interface to other classes that describe maps for the use...
Definition: maptype.h:59
const double & getLeftParam(int n) const
Returns the left value of the given parameter.
Definition: maptype.h:196
const double & getRightParam(int n) const
Returns the right value of the given parameter.
Definition: maptype.h:203
An abstract map type.
Data types for interval arithmetic.
void resetRounding()
This function resets rounding switches of the processor and sets rounding to the nearest.
Definition: typeintv.h:65
bool testIntervals(bool throwException=false)
Testing interval arithmetic.
Definition: typeintv.h:82
capd::DInterval IntervalType
The type of an interval (from the CAPD library 2.9/3.0 beta).
Definition: typeintv.h:49
int spcCoord
The type of coordinates of cubes in the phase space.
Definition: typespace.h:50