gsl.plt 672 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
test('van_der_pol', [condition(flag(slow_test, true, true))]) :-
Thierry Martinez's avatar
Thierry Martinez committed
6
  Options = [
Thierry Martinez's avatar
Thierry Martinez committed
7
    equations: [[1], -[0] + p(0) * [1] * (1 - [0] ^ 2)],
Thierry Martinez's avatar
Thierry Martinez committed
8 9
    initial_values: [1.0, 0.0],
    initial_parameter_values: [10],
10
    method: rk8pd,
11 12
    error_epsilon_absolute: 1e-6,
    error_epsilon_relative: 1e-6,
Thierry Martinez's avatar
Thierry Martinez committed
13
    initial_step_size: 1e-6,
14
    maximum_step_size: 1,
Thierry Martinez's avatar
Thierry Martinez committed
15 16
    precision: 5,
    time_initial: 0,
Thierry Martinez's avatar
Thierry Martinez committed
17 18
    time_final: 100
  ],
19 20 21 22 23 24 25 26 27 28 29 30
  solve(Options, Table),
  (
    append(_, [LastRow], Table),
    LastRow = row(LastTimeStamp, _, _),
    LastTimeStamp == 100.0
  ->
    true
  ;
    print(Table),
    nl,
    fail
  ).
Thierry Martinez's avatar
Thierry Martinez committed
31

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