gsl.plt 670 Bytes
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1 2
:- use_module(library(plunit)).

Thierry Martinez's avatar
Thierry Martinez committed
3
:- begin_tests(gsl).
Thierry Martinez's avatar
Thierry Martinez committed
4 5 6 7 8 9 10 11 12 13 14

test('van_der_pol', [
    true((
        Table = [FirstRow | OtherRows],
        append(_, [LastRow], OtherRows),
        FirstRow = row(FirstTimeStamp, _, _),
        LastRow = row(LastTimeStamp, _, _),
        FirstTimeStamp < 1e-5,
        LastTimeStamp == 100.0
    ))]) :-
  Options = [
Thierry Martinez's avatar
Thierry Martinez committed
15
    equations: [[1], -[0] + p(0) * [1] * (1 - [0] ^ 2)],
Thierry Martinez's avatar
Thierry Martinez committed
16 17 18 19 20 21 22
    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,
Thierry Martinez's avatar
Thierry Martinez committed
23 24
    time_final: 100
  ],
Thierry Martinez's avatar
Thierry Martinez committed
25 26
  solve(Options, Table).

Thierry Martinez's avatar
Thierry Martinez committed
27
:- end_tests(gsl).