maphenon.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 ///
00003 /// @file maphenon.h
00004 ///
00005 /// The Henon map.
00006 /// This file contains the definition of a class that represents
00007 /// the Henon map. The class includes a method for computing
00008 /// a rigorous outer approximation of the image of an open rectangle.
00009 ///
00010 /// @author Pawel Pilarczyk
00011 ///
00012 /////////////////////////////////////////////////////////////////////////////
00013 
00014 // Copyright (C) 1997-2010 by Pawel Pilarczyk.
00015 //
00016 // This file is part of my research software package.  This is free software;
00017 // you can redistribute it and/or modify it under the terms of the GNU
00018 // General Public License as published by the Free Software Foundation;
00019 // either version 2 of the License, or (at your option) any later version.
00020 //
00021 // This software is distributed in the hope that it will be useful,
00022 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 // GNU General Public License for more details.
00025 //
00026 // You should have received a copy of the GNU General Public License along
00027 // with this software; see the file "license.txt".  If not, write to the
00028 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00029 // MA 02111-1307, USA.
00030 
00031 // Started on December 22, 2008. Last revision: December 22, 2008.
00032 
00033 
00034 #ifndef _FINRESDYN_MAPHENON_H_
00035 #define _FINRESDYN_MAPHENON_H_
00036 
00037 
00038 // include some standard C++ header files
00039 #include <iostream>
00040 
00041 // include local header files
00042 #include "rounding.h"
00043 #include "opensqr.h"
00044 
00045 
00046 // --------------------------------------------------
00047 // ----------------- the Henon map ------------------
00048 // --------------------------------------------------
00049 
00050 /// The Henon map.
00051 /// This class defines the Henon map: (x,y) -> (1 + y - ax^2, bx),
00052 /// where a = 1.4 and b = 0.3.
00053 template <class NumType>
00054 class tMapHenon
00055 {
00056 public:
00057         /// The type of numbers in the Henon map.
00058         typedef NumType NumberType;
00059 
00060         /// The constructor of a Henon map object.
00061         tMapHenon (const NumType &aNumerator = 14,
00062                 const NumType &aDenominator = 10,
00063                 const NumType &bNumerator = 3,
00064                 const NumType &bDenominator = 10);
00065 
00066         /// Returns the dimension of the phase space.
00067         static int dim ();
00068 
00069         /// Returns an initial point for constructing a cover
00070         /// of the attractor. The vector provided is iterated
00071         /// for the given time by the map, and the result is stored
00072         /// back in the provided vector.
00073         void initialPoint (NumType *x, int iterCount) const;
00074 
00075         /// Returns a rigorous bound of the image of the given rectangle
00076         /// by the Henon map.
00077         template <class InputType, class ResultType>
00078         void image (const InputType *xMin, const InputType *xMax,
00079                 ResultType *yMin, ResultType *yMax) const;
00080 
00081 private:
00082         /// A lower bound for the parameter 'a' in the Henon map.
00083         const NumType aMin;
00084 
00085         /// An upper bound for the parameter 'a' in the Henon map.
00086         const NumType aMax;
00087 
00088         /// A lower bound for the parameter 'b' in the Henon map.
00089         const NumType bMin;
00090 
00091         /// An upper bound for the parameter 'b' in the Henon map.
00092         const NumType bMax;
00093 
00094 }; /* class tMapHenon */
00095 
00096 // --------------------------------------------------
00097 
00098 template <class NumType>
00099 inline tMapHenon<NumType>::tMapHenon
00100         (const NumType &aNumerator, const NumType &aDenominator,
00101         const NumType &bNumerator, const NumType &bDenominator):
00102         aMin (tRounding<NumType>::div_down (aNumerator, aDenominator)),
00103         aMax (tRounding<NumType>::div_up (aNumerator, aDenominator)),
00104         bMin (tRounding<NumType>::div_down (bNumerator, bDenominator)),
00105         bMax (tRounding<NumType>::div_up (bNumerator, bDenominator))
00106 {
00107         if ((aMin < 0) || (bMin < 0))
00108                 throw "Trying to use negative parameters of the Henon map.";
00109         return;
00110 } /* tMapHenon::tMapHenon */
00111 
00112 template <class NumType>
00113 inline int tMapHenon<NumType>::dim ()
00114 {
00115         return 2;
00116 } /* tMapHenon::dim */
00117 
00118 template <class NumType>
00119 inline void tMapHenon<NumType>::initialPoint (NumType *x, int iterCount)
00120         const
00121 {
00122         // iterate the point by the Henon map: (x,y) -> (1 + y - ax^2, bx)
00123         for (int i = 0; i < iterCount; ++ i)
00124         {
00125                 NumType tmp = 1 + x [1] - aMin * x [0] * x [0];
00126                 x [1] = bMin * x [0];
00127                 x [0] = tmp;
00128         }
00129         return;
00130 } /* tMapHenon::initialPoint */
00131 
00132 template <class NumType>
00133 template <class InputType, class ResultType>
00134 void tMapHenon<NumType>::image
00135         (const InputType *xMin, const InputType *xMax,
00136         ResultType *yMin, ResultType *yMax) const
00137 {
00138         // extract the rounding class to shorten the notation
00139         typedef tRounding<ResultType> rnd;
00140 
00141         // compute elements of the formulas for the image
00142         ResultType x2Min, x2Max;
00143         openSqr (xMin [0], xMax [0], x2Min, x2Max);
00144         ResultType ax2Min = rnd::mul_down (aMin, x2Min);
00145         ResultType ax2Max = rnd::mul_up (aMax, x2Max);
00146         ResultType y1Min = rnd::add_down (1, xMin [1]);
00147         ResultType y1Max = rnd::add_up (1, xMax [1]);
00148         ResultType bxMin = rnd::mul_down (bMin, xMin [0]);
00149         ResultType bxMax = rnd::mul_up (bMax, xMax [0]);
00150 
00151         // compute the final formulas of the image of the rectangle
00152         yMin [0] = rnd::sub_down (y1Min, ax2Max);
00153         yMax [0] = rnd::sub_up (y1Max, ax2Min);
00154         yMin [1] = bxMin;
00155         yMax [1] = bxMax;
00156 
00157         return;
00158 } /* tMapHenon::image */
00159 
00160 
00161 #endif // _FINRESDYN_MAPHENON_H_
00162 

Generated on Mon Apr 12 15:09:57 2010 for The Finite Resolution Dynamics Software by  doxygen 1.5.3