formal_derivation.plt 528 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
test('dx/dt(x) = 1', [true(E == 1)]) :-
Thierry Martinez's avatar
ode  
Thierry Martinez committed
6
  derivate(x, x, E).
Thierry Martinez's avatar
Thierry Martinez committed
7

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

Thierry Martinez's avatar
ode  
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
test('dx/dt(cos(sqrt(x))) = - 0.5 / sqrt(x) * sin(sqrt(x))',
15
     [true(E == - (1 / sqrt(x) / 2 * sin(sqrt(x))))]) :-
Thierry Martinez's avatar
ode  
Thierry Martinez committed
16
  derivate(cos(sqrt(x)), x, E).
Thierry Martinez's avatar
Thierry Martinez committed
17

18 19 20
test('derivate quotient', [true(E == -1*x / y^2)]) :-
  derivate(x/y, y, E).

Thierry Martinez's avatar
Thierry Martinez committed
21
:- end_tests(formal_derivation).