Skip to content

Instantly share code, notes, and snippets.

@loliGothicK
Created July 23, 2017 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loliGothicK/3b77e994cdac366929abd6796da5a69d to your computer and use it in GitHub Desktop.
Save loliGothicK/3b77e994cdac366929abd6796da5a69d to your computer and use it in GitHub Desktop.
using state_type = std::array<long double, 3>;
// Lorenz attractor
auto lorenz_system = [&,p = 10.L,r = 28.L,b = 8.L/3](const long double t, const state_type& x) {
state_type dxdt{};
// x=x[0], y=x[1], z=x[2]
dxdt[0] = -p*x[0] + p*x[1]; // dx/dt
dxdt[1] = -x[0] * x[2] + r*x[0] - x[1]; // dy/dt
dxdt[2] = x[0] * x[1] - b*x[2]; // dz/dt
return dxdt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment