#include #include #include "test_macros.hpp" using namespace matrix; Vector f(float t, const Matrix & y, const Matrix & u); Vector f(float t, const Matrix & y, const Matrix & u) { float v = -sinf(t); return v*ones(); } int main() { Vector y = ones(); Vector u = ones(); float t0 = 0; float tf = 2; float h = 0.001f; integrate_rk4(f, y, u, t0, tf, h, y); float v = 1 + cosf(tf) - cosf(t0); TEST(isEqual(y, (ones()*v))); return 0; } /* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */