The Finite Resolution Dynamics Software
maphenon.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 ///
3 /// @file maphenon.h
4 ///
5 /// The Henon map.
6 /// This file contains the definition of a class that represents
7 /// the Henon map. The class includes a method for computing
8 /// a rigorous outer approximation of the image of an open rectangle.
9 ///
10 /// @author Pawel Pilarczyk
11 ///
12 /////////////////////////////////////////////////////////////////////////////
13 
14 // Copyright (C) 1997-2010 by Pawel Pilarczyk.
15 //
16 // This file is part of my research software package. This is free software;
17 // you can redistribute it and/or modify it under the terms of the GNU
18 // General Public License as published by the Free Software Foundation;
19 // either version 2 of the License, or (at your option) any later version.
20 //
21 // This software is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License along
27 // with this software; see the file "license.txt". If not, write to the
28 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
29 // MA 02111-1307, USA.
30 
31 // Started on December 22, 2008. Last revision: December 22, 2008.
32 
33 
34 #ifndef _FINRESDYN_MAPHENON_H_
35 #define _FINRESDYN_MAPHENON_H_
36 
37 
38 // include some standard C++ header files
39 #include <iostream>
40 
41 // include local header files
42 #include "rounding.h"
43 #include "opensqr.h"
44 
45 
46 // --------------------------------------------------
47 // ----------------- the Henon map ------------------
48 // --------------------------------------------------
49 
50 /// The Henon map.
51 /// This class defines the Henon map: (x,y) -> (1 + y - ax^2, bx),
52 /// where a = 1.4 and b = 0.3.
53 template <class NumType>
54 class tMapHenon
55 {
56 public:
57  /// The type of numbers in the Henon map.
58  typedef NumType NumberType;
59 
60  /// The constructor of a Henon map object.
61  tMapHenon (const NumType &aNumerator = 14,
62  const NumType &aDenominator = 10,
63  const NumType &bNumerator = 3,
64  const NumType &bDenominator = 10);
65 
66  /// Returns the dimension of the phase space.
67  static int dim ();
68 
69  /// Returns an initial point for constructing a cover
70  /// of the attractor. The vector provided is iterated
71  /// for the given time by the map, and the result is stored
72  /// back in the provided vector.
73  void initialPoint (NumType *x, int iterCount) const;
74 
75  /// Returns a rigorous bound of the image of the given rectangle
76  /// by the Henon map.
77  template <class InputType, class ResultType>
78  void image (const InputType *xMin, const InputType *xMax,
79  ResultType *yMin, ResultType *yMax) const;
80 
81 private:
82  /// A lower bound for the parameter 'a' in the Henon map.
83  const NumType aMin;
84 
85  /// An upper bound for the parameter 'a' in the Henon map.
86  const NumType aMax;
87 
88  /// A lower bound for the parameter 'b' in the Henon map.
89  const NumType bMin;
90 
91  /// An upper bound for the parameter 'b' in the Henon map.
92  const NumType bMax;
93 
94 }; /* class tMapHenon */
95 
96 // --------------------------------------------------
97 
98 template <class NumType>
100  (const NumType &aNumerator, const NumType &aDenominator,
101  const NumType &bNumerator, const NumType &bDenominator):
102  aMin (tRounding<NumType>::div_down (aNumerator, aDenominator)),
103  aMax (tRounding<NumType>::div_up (aNumerator, aDenominator)),
104  bMin (tRounding<NumType>::div_down (bNumerator, bDenominator)),
105  bMax (tRounding<NumType>::div_up (bNumerator, bDenominator))
106 {
107  if ((aMin < 0) || (bMin < 0))
108  throw "Trying to use negative parameters of the Henon map.";
109  return;
110 } /* tMapHenon::tMapHenon */
111 
112 template <class NumType>
114 {
115  return 2;
116 } /* tMapHenon::dim */
117 
118 template <class NumType>
119 inline void tMapHenon<NumType>::initialPoint (NumType *x, int iterCount)
120  const
121 {
122  // iterate the point by the Henon map: (x,y) -> (1 + y - ax^2, bx)
123  for (int i = 0; i < iterCount; ++ i)
124  {
125  NumType tmp = 1 + x [1] - aMin * x [0] * x [0];
126  x [1] = bMin * x [0];
127  x [0] = tmp;
128  }
129  return;
130 } /* tMapHenon::initialPoint */
131 
132 template <class NumType>
133 template <class InputType, class ResultType>
135  (const InputType *xMin, const InputType *xMax,
136  ResultType *yMin, ResultType *yMax) const
137 {
138  // extract the rounding class to shorten the notation
139  typedef tRounding<ResultType> rnd;
140 
141  // compute elements of the formulas for the image
142  ResultType x2Min, x2Max;
143  openSqr (xMin [0], xMax [0], x2Min, x2Max);
144  ResultType ax2Min = rnd::mul_down (aMin, x2Min);
145  ResultType ax2Max = rnd::mul_up (aMax, x2Max);
146  ResultType y1Min = rnd::add_down (1, xMin [1]);
147  ResultType y1Max = rnd::add_up (1, xMax [1]);
148  ResultType bxMin = rnd::mul_down (bMin, xMin [0]);
149  ResultType bxMax = rnd::mul_up (bMax, xMax [0]);
150 
151  // compute the final formulas of the image of the rectangle
152  yMin [0] = rnd::sub_down (y1Min, ax2Max);
153  yMax [0] = rnd::sub_up (y1Max, ax2Min);
154  yMin [1] = bxMin;
155  yMax [1] = bxMax;
156 
157  return;
158 } /* tMapHenon::image */
159 
160 
161 #endif // _FINRESDYN_MAPHENON_H_
162 
The Henon map.
Definition: maphenon.h:54
void openSqr(const NumType &xLeft, const NumType &xRight, NumType &yLeft, NumType &yRight)
Computes the square f (x) = x^2 in the open interval arithmetic.
Definition: opensqr.h:48
NumType NumberType
The type of numbers in the Henon map.
Definition: maphenon.h:58
Rigorous rounding of arithmetic operations.
const NumType aMin
A lower bound for the parameter &#39;a&#39; in the Henon map.
Definition: maphenon.h:83
A class for rounding operations which uses the BOOST library.
Definition: rounding.h:48
static int dim()
Returns the dimension of the phase space.
Definition: maphenon.h:113
tMapHenon(const NumType &aNumerator=14, const NumType &aDenominator=10, const NumType &bNumerator=3, const NumType &bDenominator=10)
The constructor of a Henon map object.
Definition: maphenon.h:100
An open-interval version of the square function.
void initialPoint(NumType *x, int iterCount) const
Returns an initial point for constructing a cover of the attractor.
Definition: maphenon.h:119
const NumType bMin
A lower bound for the parameter &#39;b&#39; in the Henon map.
Definition: maphenon.h:89
const NumType aMax
An upper bound for the parameter &#39;a&#39; in the Henon map.
Definition: maphenon.h:86
void image(const InputType *xMin, const InputType *xMax, ResultType *yMin, ResultType *yMax) const
Returns a rigorous bound of the image of the given rectangle by the Henon map.
Definition: maphenon.h:135
const NumType bMax
An upper bound for the parameter &#39;b&#39; in the Henon map.
Definition: maphenon.h:92