Commit 03313d24 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Still trying to find a normal form

parent 0c53ef28
...@@ -1381,8 +1381,7 @@ normalize_expression(-Expr, ListVar, NExpr) :- !, ...@@ -1381,8 +1381,7 @@ normalize_expression(-Expr, ListVar, NExpr) :- !,
normalize_expression(TExpr, ListVar, NExpr). normalize_expression(TExpr, ListVar, NExpr).
normalize_expression(Term, ListVar, NTerm) :- normalize_expression(Term, ListVar, NTerm) :-
normalize_term(Term, ListVar, TermTempo), normalize_term(Term, ListVar, NTerm).
simplify(TermTempo, NTerm).
normalize_term(Term, ListVar, NewTerm) :- normalize_term(Term, ListVar, NewTerm) :-
...@@ -1464,10 +1463,11 @@ rewrite_term(Numbers, Parameter_list, Variable_list, Denominator, Term) :- ...@@ -1464,10 +1463,11 @@ rewrite_term(Numbers, Parameter_list, Variable_list, Denominator, Term) :-
( (
Denominator = [] Denominator = []
-> ->
Term = Stuff simplify(Stuff, Term)
; ;
multiply_them(Denominator, Den), multiply_them(Denominator, Den),
Term = Stuff/Den simplify(Stuff, SimpleStuff),
Term = SimpleStuff/Den
). ).
multiply_them_rev(List, Term) :- multiply_them_rev(List, Term) :-
......
...@@ -109,7 +109,7 @@ test( ...@@ -109,7 +109,7 @@ test(
clear_model, clear_model,
with_current_ode_system(( with_current_ode_system((
add_ode(d(x)/dt = (1*(k9*k1*k2) + (-1)*(k9*k3*x1) + (-1)*(k9*k8*x*x/(x+k7)))/k9), add_ode(d(x)/dt = (1*(k9*k1*k2) + (-1)*(k9*k3*x1) + (-1)*(k9*k8*x*x/(x+k7)))/k9),
normalize_ode([d(x)/dt=k1*k2+ - (k3*x1)+ -1*k8*x^2/(x+k7)]) normalize_ode([d(x)/dt = k9*k1*k2/k9+ - (k9*k3*x1)/k9+ - (k9*k8*x^2)/((x+k7)*k9)])
)). )).
test( test(
...@@ -117,7 +117,7 @@ test( ...@@ -117,7 +117,7 @@ test(
clear_model, clear_model,
with_current_ode_system(( with_current_ode_system((
add_ode(d(x)/dt = k7+ -1*k8*x + -1*k9*x/(x+k1)), add_ode(d(x)/dt = k7+ -1*k8*x + -1*k9*x/(x+k1)),
normalize_ode([d(x)/dt=k7+ - (k8*x)+ -1*k9*x/(x+k1)]) normalize_ode([d(x)/dt = k7+ - (k8*x)+ - (k9*x)/(x+k1)])
)). )).
:- end_tests(ode). :- end_tests(ode).
Supports Markdown
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