Commit e93682b3 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Still working on arithmetic and derivation to improve correct_model stuff

parent b36ec00b
......@@ -779,6 +779,7 @@ is_null(Expr) :-
once(is_null_sr(Expr)).
is_null_sr(0).
is_null_sr(0.0).
is_null_sr(-A) :- is_null_sr(A).
is_null_sr(A*B) :- is_null_sr(A); is_null_sr(B).
is_null_sr(A/_B) :- is_null_sr(A).
is_null_sr(A+B) :- is_null_sr(A), is_null_sr(B).
......
......@@ -32,12 +32,34 @@ derivate_raw(A - B, Variable, Aprime - Bprime) :-
derivate_raw(A, Variable, Aprime),
derivate_raw(B, Variable, Bprime).
derivate_raw(A * B, Variable, Aprime * B) :-
derivate_raw(B, Variable, 0),
!,
derivate_raw(A, Variable, Aprime).
derivate_raw(A * B, Variable, A * Bprime) :-
derivate_raw(A, Variable, 0),
!,
derivate_raw(B, Variable, Bprime).
derivate_raw(A * B, Variable, A * Bprime + Aprime * B) :-
!,
derivate_raw(A, Variable, Aprime),
derivate_raw(B, Variable, Bprime).
% simplify a'b - ab' especially for MM case
derivate_raw(A / B, Variable, D / (B ^ 2)) :-
derivate(A, Variable, 0),
!,
derivate_raw(B, Variable, Bprime),
additive_normal_form((- A * Bprime), C),
simplify(C, D).
derivate_raw(A / B, Variable, Aprime/B) :-
derivate(B, Variable, 0),
!,
derivate_raw(A, Variable, Aprime).
derivate_raw(A / B, Variable, D / (B ^ 2)) :-
!,
derivate_raw(A, Variable, Aprime),
......
......@@ -23,7 +23,7 @@ correct_model :-
biocham_command,
doc(''),
single_model(ModelId),
findall(
setof(
Molecule,
identifier_kind(ModelId, Molecule, object),
List_Molecule
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment