70 #include "boost/numeric/interval.hpp" 76 #include "chomp/system/config.h" 77 #include "chomp/system/textfile.h" 78 #include "chomp/system/timeused.h" 79 #include "chomp/system/arg.h" 97 Finite Resolution Dynamics - computations for the Henon attractor.\n\ 98 Ver. 0.01, April 12, 2010. Copyright (C) 1997-2010 by Pawel Pilarczyk.\n\ 99 This is free software. No warranty. Consult 'license.txt' for details.";
103 This program accompanies the paper \"Finite resolution dynamics\"\n\ 104 by S. Luzzatto and P. Pilarczyk. It runs computations aiming at proving\n\ 105 that the Henon attractor is mixing at all resolutions > some epsilon.\n\ 106 Call this program with the following arguments:\n\ 107 -p N - the number of cover parts in each direction (must be given),\n\ 108 -b filename.bmp - a file to save a plot of the cover to (default: none),\n\ 109 -w N - the width of the BMP file (default: 1000 pixels),\n\ 110 -s filename.txt - a text file to save the actual cover to (def: none),\n\ 111 -h - to display this brief help information only and exit.\n\ 112 For more information consult the accompanying documentation (if available)\n\ 113 or ask the program's author at http://www.PawelPilarczyk.com/.";
121 template <
class NumType>
123 int bitmapWidth,
const char *saveFilename)
125 using chomp::homology::timeused;
127 sout <<
"--- Running computations for the Henon map. ---\n";
128 sout << std::setprecision (12);
140 NumType aNumerator = 14;
141 NumType aDenominator = 10;
142 NumType bNumerator = 3;
143 NumType bDenominator = 10;
144 sout <<
"Parameters of the Henon map: a = " <<
145 aNumerator / aDenominator <<
146 ", b = " << bNumerator / bDenominator <<
".\n";
150 bNumerator, bDenominator);
153 NumType leftCorner [dim] = {-1.4, -0.5};
154 NumType boxWidths [dim] = {2.8, 1.0};
155 for (
int i = 0; i < dim; ++ i)
157 sout << (i ?
") x (" :
"Phase space box: (") <<
158 leftCorner [i] <<
"," <<
159 (leftCorner [i] + boxWidths [i]);
164 int partCounts [dim];
165 partCounts [0] = parts;
166 for (
int i = 1; i < dim; ++ i)
168 partCounts [i] =
static_cast<int> 169 (parts * boxWidths [i] / boxWidths [0] + 0.5);
171 NumType *overlap = 0;
172 double partsCount = 1;
173 for (
int i = 0; i < dim; ++ i)
175 sout << (i ?
" x " :
"Number of cover elements: ") <<
177 partsCount *= partCounts [i];
179 sout <<
" = " << partsCount <<
".\n";
181 for (
int i = 0; i < dim; ++ i)
183 double size =
static_cast<double> (boxWidths [i]) /
185 sout << (i ?
" x " :
"Size of each box: ") << size;
189 sout <<
"Area of each box: " << area1 <<
".\n";
193 partCounts, overlap);
200 NumType initialPoint [dim] = {0.61989426930989, 0.17586130934794};
204 int iterCount = 1000;
207 int maxCoverSize = 0;
210 sout <<
"Computing a cover of the attractor...\n";
213 initialPoint, iterCount, maxCoverSize);
214 double percentage =
static_cast<double> (cover. size ()) * 100 /
216 sout <<
"A cover consisting of " << cover. size () <<
217 " elements (" << percentage <<
"%) constructed.\n";
218 sout <<
"Computed in " << coverTime <<
".\n";
220 for (
int i = 0; i < dim; ++ i)
221 area *= boxWidths [i] / partCounts [i];
222 area *= cover. size ();
223 sout <<
"Approximate area of the cover: " << area <<
".\n";
224 sout <<
"Max square of the diameter of map images: " <<
225 maxDiameter2 <<
".\n";
226 sout <<
"Approx. max diameter of map images: " <<
227 std::sqrt (maxDiameter2) <<
".\n";
228 sout <<
"The map graph has " << graph. countEdges () <<
234 sout <<
"Plotting the computed cover in a " 235 "black-and-white bitmap image...\n";
236 plotCover (cover, bitmapFilename, bitmapWidth);
242 sout <<
"Saving the computed cover to a text file...\n";
247 sout <<
"Releasing the cover from the memory...\n";
250 chomp::homology::PointBase::forget ();
251 sout <<
"Memory released in " << forgetTime <<
".\n";
254 sout <<
"Checking if the graph is strongly connected...\n";
255 timeused strConnTime;
256 if (graph. checkStronglyConnected ())
257 sout <<
"Yes! The graph is strongly connected.\n";
259 throw "The constructed graph is not strongly connected.\n";
260 sout <<
"Verified in " << strConnTime <<
".\n";
263 sout <<
"Checking if the graph is aperiodic...\n";
265 if (graph. checkAperiodic ())
266 sout <<
"Good! The graph is aperiodic.\n";
268 throw "The constructed graph is not aperiodic.\n";
269 sout <<
"Verified in " << aperTime <<
".\n";
271 sout <<
"--- The computations completed successfully. ---\n";
282 int main (
int argc,
char *argv [])
284 using namespace chomp::homology;
287 program_time =
"Aborted after";
291 char *bitmapFilename = 0;
292 int bitmapWidth = 1000;
293 char *saveFilename = 0;
298 arg (a,
"b", bitmapFilename);
299 arg (a,
"w", bitmapWidth);
300 arg (a,
"s", saveFilename);
303 argstreamprepare (a);
304 int argresult = a. analyze (argc, argv);
309 sout <<
title <<
'\n';
314 sout <<
"Call with '--help' for help.\n";
319 if ((argresult > 0) || (parts <= 0))
329 program_time =
"Aborted after:";
332 henonAttractor<double> (parts, bitmapFilename, bitmapWidth,
336 program_time =
"Total time used:";
342 catch (
const char *msg)
344 sout <<
"ERROR: " << msg <<
'\n';
347 catch (
const std::exception &e)
349 sout <<
"ERROR: " << e. what () <<
'\n';
354 sout <<
"ABORT: An unknown error occurred.\n";
Saving a cover to a file.
Various output streams for the program.
const char * helpinfo
Short help information about the program's usage.
A cover of a subset in R^n consisting of open boxes.
void plotCover(const CoverType &cover, const char *filename, int width)
Plotting a cover in a bitmap image file.
A directed graph class with some algorithms built-in.
int main(int argc, char *argv [])
The main function of the program.
void henonAttractor(int parts, const char *bitmapFilename, int bitmapWidth, const char *saveFilename)
Runs the computations for the Henon attractor.
void saveCover(const tCoverBoxes< double > &cover, const char *filename)
Saves the given cover to a text file.
A directed graph class and some algorithms.
Construction of a cover of an attractor.
const char * title
The title of the program with brief licensing information.
double constructAttractor(const MapType &function, CoverType &cover, GraphType &graph, NumArray initialPoint, int iterCount, int maxCoverSize)
Constructs a cover of an attractor for a given dynamical system.