My old project for strange attractors
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

39 lines
985 B

#ifndef LORENZ_HPP
#define LORENZ_HPP
15 years ago
#include "../AttractorKernel.hpp"
15 years ago
class Lorenz3D : public AttractorKernel {
private:
void init() {
std::fill_n(vectorOld, dimension, 1.0);
std::fill_n(vectorNew, dimension, 1.0);
}
public:
Lorenz3D():
AttractorKernel(3, 4) {
init();
}
virtual void generate_random_parameters() {
parameters[0] = rand() / double(RAND_MAX) * 0.01;
parameters[1] = rand() / double(RAND_MAX) * 10.0 + 23.0;
parameters[2] = rand() / double(RAND_MAX) * 4.0 + 8.0;
parameters[3] = rand() / double(RAND_MAX) * 1.5 + 2.0;
init();
}
virtual void operator()() {
std::swap(vectorNew, vectorOld);
vectorNew[0] = vectorOld[0] + parameters[0] * parameters[1] * (vectorOld[1] - vectorOld[0]);
vectorNew[1] = vectorOld[1] + parameters[0] * (vectorOld[0] * (parameters[2] - vectorOld[2]) - vectorOld[1]);
vectorNew[2] = vectorOld[2] + parameters[0] * (vectorOld[0] * vectorOld[1] - parameters[3] * vectorOld[2]);
}
};
#endif // LORENZ_HPP