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.

41 lines
1.0 KiB

#include "Lorenz3D.hpp"
#include <algorithm>
Lorenz3D::Lorenz3D():
KernelBasicParameter(4),
KernelBasicVector(3){
init();
}
void Lorenz3D::init() {
// setting some starting values
for ( unsigned int i = 0; i < myDimension; i++ ) {
vectorNew[i] = vectorOld[i] = 1.0;
}
}
// the main function
void Lorenz3D::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]);
}
/*
4D:
new_point[0] = point[0] + param[0] * param[1] * (point[1] - point[0]);
new_point[1] = point[1] + param[0] * (point[0] * (param[2] - point[2]) - point[1] + point[3]);
new_point[2] = point[2] + param[0] * (point[0] * point[1] - param[3] * point[2]);
new_point[3] = point[3] - param[0] * param[4] * point[0];
break;
*/