gsl.plt 677 Bytes
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
:- use_module(library(plunit)).

:- begin_tests(ode).

test('van_der_pol', [
    true((
        Table = [FirstRow | OtherRows],
        append(_, [LastRow], OtherRows),
        FirstRow = row(FirstTimeStamp, _, _),
        LastRow = row(LastTimeStamp, _, _),
        FirstTimeStamp < 1e-5,
        LastTimeStamp == 100.0
    ))]) :-
  Options = [
    equations: [x(1), -x(0) + p(0) * x(1) * (v(1) - x(0) ^ v(2))],
    initial_values: [1.0, 0.0],
    initial_parameter_values: [10],
    method: gsl_odeiv2_step_rk8pd,
    error_epsilon: 1e-6,
    initial_step_size: 1e-6,
    precision: 5,
    time_initial: 0,
    time_final: 100],
  solve(Options, Table).

:- end_tests(ode).