The Conley-Morse Graphs Software
m_lorenz_a.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2///
3/// @file m_lorenz_a.h
4///
5/// An approximate time-t map for the Lorenz equations.
6/// This map defines a sample time-t map for an ODE.
7///
8/// @author Pawel Pilarczyk
9///
10/////////////////////////////////////////////////////////////////////////////
11
12// Copyright (C) 1997-2014 by Pawel Pilarczyk.
13//
14// This file is part of my research software package. This is free software:
15// you can redistribute it and/or modify it under the terms of the GNU
16// General Public License as published by the Free Software Foundation,
17// either version 3 of the License, or (at your option) any later version.
18//
19// This software is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with this software; see the file "license.txt". If not,
26// please, see <https://www.gnu.org/licenses/>.
27
28// Started on June 26, 2012. Last revision: June 26, 2012.
29
30
31#ifndef _CMGRAPHS_LORENZAPPR_H_
32#define _CMGRAPHS_LORENZAPPR_H_
33
34
35// include local header files
36#include "maptype.h"
37#include "odeapprox.h"
38
39
40// --------------------------------------------------
41// ------------ the Lorenz time-t map ------------
42// --------------------------------------------------
43
44/// An approximate time-t map for the Lorenz equations.
46{
47public:
48 /// The constructor of a Lorenz map object.
50
51private:
52 /// The vector field.
53 void vectorField (double, const double *x, double *y, int dim) const;
54
55}; /* class MapLorenzApprox */
56
57// --------------------------------------------------
58
60 MapOdeApprox (0.05/20, 20, 4)
61{
62 return;
63} /* MapLorenzApprox::MapLorenzApprox */
64
65inline void MapLorenzApprox::vectorField (double,
66 const double *x, double *y, int dim) const
67{
68 if (dim != 3)
69 throw "This model is valid in dimension 3 only.";
70
71 // is this the Lorenz equation with reversed time?
72 const bool reversed = false;
73
74 // retrieve the parameters (the left bound only)
75 double sigma = getLeftParam (0);
76 double rho = getLeftParam (1);
77 double beta = getLeftParam (2);
78
79 // compute the vector field
80 y [0] = sigma * (x [1] - x [0]);
81 y [1] = x [0] * (rho - x [2]) - x [1];
82 y [2] = x [0] * x [1] - beta * x [2];
83
84 // reverse the vector field if requested to
85 if (reversed)
86 {
87 for (int i = 0; i < dim; ++ i)
88 y [i] = -y [i];
89 }
90
91 return;
92} /* MapLorenzApprox::vectorField */
93
94
95#endif // _CMGRAPHS_LORENZAPPR_H_
96
An approximate time-t map for the Lorenz equations.
Definition: m_lorenz_a.h:46
void vectorField(double, const double *x, double *y, int dim) const
The vector field.
Definition: m_lorenz_a.h:65
MapLorenzApprox()
The constructor of a Lorenz map object.
Definition: m_lorenz_a.h:59
This class defines a map for the nonlinear density dependent overcompensatory Leslie population model...
Definition: odeapprox.h:61
const double & getLeftParam(int n) const
Returns the left value of the given parameter.
Definition: maptype.h:196
An abstract map type.
A generic method for computing a time-t map for ODEs in an approximate way.