formal_derivation.plt 462 Bytes
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1 2 3 4
:- use_module(library(plunit)).

:- begin_tests(formal_derivation).

Thierry Martinez's avatar
Thierry Martinez committed
5 6
test('dx/dt(x) = 1', [true(E == 1)]) :-
  derivate([x], x, E).
Thierry Martinez's avatar
Thierry Martinez committed
7

Thierry Martinez's avatar
Thierry Martinez committed
8 9
test('dx/dt(y) = 0', [true(E == 0)]) :-
  derivate([y], x, E).
Thierry Martinez's avatar
Thierry Martinez committed
10

Thierry Martinez's avatar
Thierry Martinez committed
11 12
test('dx/dt(x^2) = 2x', [true(E == 2 * [x])]) :-
  derivate([x] ^ 2, x, E).
Thierry Martinez's avatar
Thierry Martinez committed
13

Thierry Martinez's avatar
Thierry Martinez committed
14 15 16
test('dx/dt(cos(sqrt(x))) = - 0.5 / sqrt(x) * sin(sqrt(x))',
     [true(E == - (0.5 / sqrt([x])) * sin(sqrt([x])))]) :-
  derivate(cos(sqrt([x])), x, E).
Thierry Martinez's avatar
Thierry Martinez committed
17 18

:- end_tests(formal_derivation).