Open 2b5de62a-05ae-46d3-a99b-c6405c33a11e opened 11 years ago
Attachment: rebuild.gz
shell script to help building the package
I assume that this is somewhere in the sage-combinat queue, but just for completeness, if you could put links to an spkg, the other Sage library files needed, etc., that would be great. I'm constantly amazed at what you guys come up with!
Replying to @kcrisman:
I assume that this is somewhere in the sage-combinat queue, but just for completeness, if you could put links to an spkg, the other Sage library files needed, etc., that would be great. I'm constantly amazed at what you guys come up with!
The shell script (rebuild) builds two spkg. I thought it was simpler that way.
I assume that this is somewhere in the sage-combinat queue, but just for completeness, if you could put links to an spkg, the other Sage library files needed, etc., that would be great. I'm constantly amazed at what you guys come up with!
The shell script (rebuild) builds two spkg. I thought it was simpler that way.
Fair enough for those testing, but in the end I think that the release manager is likely (?) to want an actual spkg. For instance, Sage should be buildable without the internet (that is, once it is downloaded or the tarball is otherwise acquired, the internet should not be a dependency).
Also, is this a proposal for an optional spkg?
Finally, you'll almost certainly need to provide the DifferentialAlgebra.pyx file and the changes to setup.py and the module list as a patch.
But you are right that this script would be very convenient for testing, which hopefully some experts in differential algebra will do!
Interesting! I'll take a careful look at this in the coming weeks as a possible base for a moving-frames/exterior differential geometry package.
I have tried to repackage F. Boulier's code in (what I understand is) the Right Way.
If you want to enjoy the power of the DifferentialAlgebra package, which is yet not-even-optionnal, you have to download the two spkg's, and apply the patch
Note to release manager:
The SPKGs are optional/experimental/whatever but the patch for the Sage library should be merged so that the packages can be used later on
Pretty minor points, though worth thinking about:
module_list.py
in a separate patch; I think that might make them "viewable" in Trac, given its MB limits for viewing.R.sort (L)
which I presume is valid Python syntax, but very different from the rest of the documentation, where we would have R.sort(L)
. I don't know how important this is, but it was a little jarring to me, at least.Less minor, I think:
__ranking
.Good luck! Looks cool.
Reviewer: Charles Bouillaguet, Karl-Dieter Crisman
Author: Nicolas M. Thiéry, François Boulier
Patch and spkg's updated. The package was broken since 5.1, but is now fixed.
Description changed:
---
+++
@@ -1,3 +1,5 @@
+This ticket proposes the inclusion in SAGE of a new package, dedicated to differential algebra.
+
**Introduction**
The `DifferentialAlgebra` Sage package is an analogue of the MAPLE 14 `DifferentialAlgebra` package.
@@ -17,10 +19,11 @@
The computations are performed by the BLAD libraries (C libraries, 60000 lines, LGPL license).
The interface between Sage and BLAD is handled by the BMI library (C library, 10000 lines, LGPL license).
-**Getting started**
-The attached `rebuild` file is a shell command file which should help to build the whole stuff.
-This file was tested on Linux architectures.
+**Release manager : **
+
+* Make [http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg](http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg) an experimental/optional package
+* Apply [attachment: 13268_differential_algebra.patch](https://github.com/sagemath/sage-prod/files/10656030/13268_differential_algebra.patch.gz)
**An example**
@@ -28,102 +31,126 @@
sage: from sage.libs.blad.DifferentialAlgebra import DifferentialRing, RegularDifferentialChain, BaseFieldExtension
sage: leader,order,rank = var ('leader,order,rank')
sage: derivative = function ('derivative') +sage: from sage.libs.blad.DifferentialAlgebra import DifferentialRing, RegularDifferentialChain, BaseFieldExtension +sage: leader,order,rank = var ('leader,order,rank') +sage: derivative = function ('derivative') +```
This example shows how to build the Henri Michaelis Menten formula by differential elimination. One considers a chemical reaction system describing the enzymatic reaction: +This example shows how to build the Henri Michaelis Menten formula by differential elimination. One considers a chemical reaction system describing the enzymatic reaction:
params
, one moves them to the base field of the equations.params
, together with initial values.
+A substrate S is transformed into a product P, in the presence of an enzyme E. An intermediate complex ES is formed.
+ +sage: t = var('t') +sage: k,F_1,E,S,ES,P = function('k,F_1,E,S,ES,P') +sage: params = [k(-1),k(1),k(2)] +sage: params +[k(-1), k(1), k(2)] +
+
+The main assumption is that k(1), k(-1) >> k(2) i.e. that the revertible reaction is much faster than the last one. One performs a quasi-steady state approximation by considering the following differential-algebraic system (it comes from the mass-action law kinetics, replacing the contribution of the fast reactions by an unknown function F_1(t), on the algebraic variety where the fast reaction would equilibrate if they were alone).
+
+ +sage: syst = [diff(E(t),t) == - F_1(t) + k(2)*ES(t), diff(S(t),t) == - F_1(t), diff (ES(t),t) == - k(2)*ES(t) + F_1(t), diff (P(t),t) == k(2)*ES(t), 0 == k(-1)*E(t)*S(t) - k(1)*ES(t) ] +sage: syst +[D[0](E)(t) == k(2)*ES(t) - F_1(t), D[0](S)(t) == -F_1(t), D[0](ES)(t) == -k(2)*ES(t) + F_1(t), D[0](P)(t) == k(2)*ES(t), 0 == k(-1)*E(t)*S(t) - k(1)*ES(t)] +
+
+Differential elimination permits to simplify this DAE. To avoid discussing the possible vanishing of params
, one moves them to the base field of the equations.
+
+ +sage: Field = BaseFieldExtension (generators = params) +sage: Field +differential_field + +sage: R = DifferentialRing (derivations = [t], blocks = [F_1, [E,ES,P,S], params], parameters = params) +sage: R +differential_ring +
+
+The Rosenfeld-Groebner algorithm considers three cases. The two last ones are degenerate cases.
+
+ +sage: ideal = R.RosenfeldGroebner (syst, basefield = Field) +sage: ideal +[regular_differential_chain, regular_differential_chain, regular_differential_chain] +sage: [ C.equations (solved = true) for C in ideal ] +[[E(t) == k(1)*ES(t)/(k(-1)*S(t)), D[0](S)(t) == -(k(-1)*k(2)*S(t)^2*ES(t) + k(1)*k(2)*S(t)*ES(t))/(k(-1)*S(t)^2 + k(1)*S(t) + k(1)*ES(t)), D[0](P)(t) == k(2)*ES(t), D[0](ES)(t) == -k(1)*k(2)*ES(t)^2/(k(-1)*S(t)^2 + k(1)*S(t) + k(1)*ES(t)), F_1(t) == (k(-1)*k(2)*S(t)^2*ES(t) + k(1)*k(2)*S(t)*ES(t))/(k(-1)*S(t)^2 + k(1)*S(t) + k(1)*ES(t))], [S(t) == -k(1)/k(-1), ES(t) == 0, E(t) == 0, D[0](P)(t) == 0, F_1(t) == 0], [S(t) == 0, ES(t) == 0, D[0](P)(t) == 0, D[0](E)(t) == 0, F_1(t) == 0]] +
+
+The sought equation, below, is not yet the Henri-Michaelis-Menten formula. This is expected, since some minor hypotheses have not yet been taken into account
+
+ +sage: ideal [0].equations (solved = true, selection = leader == derivative (S(t))) +[D[0](S)(t) == -(k(-1)*k(2)*S(t)^2*ES(t) + k(1)*k(2)*S(t)*ES(t))/(k(-1)*S(t)^2 + k(1)*S(t) + k(1)*ES(t))] +
+
+Let us take them into account. First create two new constants. Put them among params
, together with initial values.
+
+ +sage: K,V_max = var ('K,V_max') +sage: params = [k(-1),k(1),k(2),E(0),ES(0),P(0),S(0),K,V_max] +sage: params +[k(-1), k(1), k(2), E(0), ES(0), P(0), S(0), K, V_max] + +sage: R = DifferentialRing (blocks = [F_1, [ES,E,P,S], params], parameters = params, derivations = [t]) +sage: R +differential_ring +
+
+There are relations among the parameters: initial values supposed to be zero, and equations meant to rename constants.
+
+ +sage: relations_among_params = RegularDifferentialChain ([P(0) == 0, ES(0) == 0, K == k(1)/k(-1), V_max == k(2)*E(0)], R) +sage: relations_among_params +regular_differential_chain +
+
+Coming computations will be performed over a base field defined by generators and relations
+
+ +sage: Field = BaseFieldExtension (generators = params, relations = relations_among_params) +sage: Field +differential_field +
+Extend the DAE with linear conservation laws. They could have been computed from the stoichimetry matrix of the chemical system.
+ +sage: newsyst = syst +sage: newsyst.append (E(t) + ES(t) == E(0) + ES(0)) +sage: newsyst.append (S(t) + ES(t) + P(t) == S(0) + ES(0) + P(0)) +sage: newsyst +[D[0](E)(t) == k(2)*ES(t) - F_1(t), D[0](S)(t) == -F_1(t), D[0](ES)(t) == -k(2)*ES(t) + F_1(t), D[0](P)(t) == k(2)*ES(t), 0 == k(-1)*E(t)*S(t) - k(1)*ES(t), E(t) + ES(t) == E(0) + ES(0), S(t) + ES(t) + P(t) == S(0) + ES(0) + P(0)] +
+Simplify again. Only one case is left.
+ +sage: ideal = R.RosenfeldGroebner (newsyst, basefield = Field) +sage: ideal +[regular_differential_chain] +
+To get the traditional Henri-Michaelis-Menten formula, one still needs to neglect the term K*E(0)
+ +sage: ideal[0].equations (solved = true, selection = leader == derivative (S(t))) +[D[0](S)(t) == -(K*V_max*S(t) + V_max*S(t)^2)/(K^2 + K*E(0) + 2*K*S(t) + S(t)^2)] +
+One can also get it by computing the right hand side of the equation which gives the evolution of the product P
+ +sage: ideal[0].normal_form (diff(P(t),t)) +V_max*S(t)/(K + S(t)) +
Attachment: 13268_differential_algebra_support_files.patch.gz
Cython library headers for BLAD/BMI
Description changed:
---
+++
@@ -24,6 +24,9 @@
* Make [http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg](http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg) an experimental/optional package
* Apply [attachment: 13268_differential_algebra.patch](https://github.com/sagemath/sage-prod/files/10656030/13268_differential_algebra.patch.gz)
+* Apply [attachment: 13268_differential_algebra_support_files.patch](https://github.com/sagemath/sage-prod/files/10656027/13268_differential_algebra_support_files.patch.gz)
+* Apply [attachment: 13268_module_list.patch](https://github.com/sagemath/sage-prod/files/10656028/13268_module_list.patch.gz)
+
**An example**
tell SAGE about the optional package
Attachment: 13268_module_list.patch.gz
Attachment: 13268_differential_algebra_reference_manual_update.patch.gz
updates the reference manual
Description changed:
---
+++
@@ -26,6 +26,7 @@
* Apply [attachment: 13268_differential_algebra.patch](https://github.com/sagemath/sage-prod/files/10656030/13268_differential_algebra.patch.gz)
* Apply [attachment: 13268_differential_algebra_support_files.patch](https://github.com/sagemath/sage-prod/files/10656027/13268_differential_algebra_support_files.patch.gz)
* Apply [attachment: 13268_module_list.patch](https://github.com/sagemath/sage-prod/files/10656028/13268_module_list.patch.gz)
+* Apply [attachment: 13268_differential_algebra_reference_manual_update.patch](https://github.com/sagemath/sage-prod/files/10656029/13268_differential_algebra_reference_manual_update.patch.gz)
**An example**
Changed author from Nicolas M. Thiéry, François Boulier to Nicolas M. Thiéry, François Boulier, Charles Bouillaguet
Attachment: 13268_differential_algebra.patch.gz
Actual DifferentialAlgebra Class
The ticket description doesn't have a link to the bmi spkg, is it still needed? Also, has anybody considered reviewing this ticket?
Replying to @vbraun:
The ticket description doesn't have a link to the bmi spkg, is it still needed?
I don't think so. I think I updated the spkg to contain both, because it would not make much sense to have both separated.
Also, has anybody considered reviewing this ticket?
I did ask for this several times on the mailing list....
With the switch to git we are really aiming to distribute one upstream tarball for each "spkg" install script if possible. Since the two libraries are distributed separately they should be separate spkgs.
All patches need a commit message, only the first one has one right now.
I'm a bit confused by the code... the DifferentialRing isn't really a ring in the Sage sense (with elements that have ring operations). Am I missing something? The starting point should be a proper differential algebra ring, e.g.
sage: R = DifferentialRing(vars=['x'], functions=['f'])
sage: x = R.var(0)
sage: f = R.function(0)
sage: (2*x*f).parent() is R
True
and perhaps slightly extend the preparser to allow
sage: R.<f(x)> = DifferentialRing()
Dear vbraun,
Thank you for your feedback. I really appreciate it.
There are two ways to "view" differential algebra. Either you view it as an algebraic theory and then, you are right, the starting point should be a differential ring (that's the way Ritt and Kolchin books are written). Or you take a more engineering point of view: the starting point is the system of equations to be solved and differential algebra is one tool among others (such as numerical integration, bifurcation theory, ...) to investigate them. It is the point of view which was chosen for the design. Indeed, I believe this point of view is likely to be the most appealing for many scientists.
The ideal scenario could look like this: A Sage user first enters the differential equations he/she wants to study. After many computations, he/she decides that differential algebra might be useful. He/she loads the package and applies its methods over the equations. He/she is very happy not to have convert all the time objects from one data type to another one.
I hope my explanations make sense :-)
All the best, François
OK, fair enough. I'm happy with thinking of it as a tool to simplify differential equations. But then you shouldn't introduce global names like DifferentialRing that are likely to be used at one point for the more abstract ring of differential operators.
In that spirit, it would be nice if the code were organized in the way you describe it verbally. The starting point should be an object that encapsulates the differential system, e.g.
sage: syst = DifferentialAlgebraicSystem(vars=[t], functions=[f,g], parameters=[phi])
And then everything is a method of that object. There you need to decide whether you want DifferentialAlgebraicSystem to be mutable or immutable; In the immutable case the user interface would be
sage: sys_extd = syst.extend_base_field(phi)
sage: sys_reln = sys_extd.add_relation(f(0) == 0)
sage: sys_reln
Differential algebraic system ... over base field RR(phi) with relation f(0) == 0
sage: ideal = sys_reln.Rosenfeld_Groebner()
and if it is mutable you'd have
sage: syst.extend_base_field(phi)
sage: syst.add_relation(f(0) == 0)
sage: syst
Differential algebraic system ... over base field RR(phi) with relation f(0) == 0
Mutable is slightly simpler but also means that you can't cache intermediate results.
In general, your objects should print something more informative than regular_differential_chain
. It doesn't necessarily have to print all equations, but enough to see if its trivial or not would be nice.
Description changed:
---
+++
@@ -19,14 +19,7 @@
The computations are performed by the BLAD libraries (C libraries, 60000 lines, LGPL license).
The interface between Sage and BLAD is handled by the BMI library (C library, 10000 lines, LGPL license).
-
-**Release manager : **
-
-* Make [http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg](http://www.lifl.fr/~bouillaguet/download/blad-3.9.spkg) an experimental/optional package
-* Apply [attachment: 13268_differential_algebra.patch](https://github.com/sagemath/sage-prod/files/10656030/13268_differential_algebra.patch.gz)
-* Apply [attachment: 13268_differential_algebra_support_files.patch](https://github.com/sagemath/sage-prod/files/10656027/13268_differential_algebra_support_files.patch.gz)
-* Apply [attachment: 13268_module_list.patch](https://github.com/sagemath/sage-prod/files/10656028/13268_module_list.patch.gz)
-* Apply [attachment: 13268_differential_algebra_reference_manual_update.patch](https://github.com/sagemath/sage-prod/files/10656029/13268_differential_algebra_reference_manual_update.patch.gz)
+Upstream: [BLAD](http://www.lifl.fr/~boulier/pmwiki/pmwiki.php?n=Main.BLAD) [BMI](http://www2.lifl.fr/~boulier/pmwiki/pmwiki.php?n=Main.BMI)
**An example**
Here's my (first) attempt at a git version. I downloaded the BLAD and BMI tarballs from upstream, renamed them *.tgz
-> *.tar.gz
, and I was able to install them. However there was no $SAGE_LOCAL/include/bmi.h
created, and so either my build or the module_list.py
isn't correct. So that's where I'm stuck at right now and I don't know how to proceed.
I agree with Volker in that they should remain as separate patches as it makes our lives easier for inclusion in Sage as the upstream packages are updated. I also am against the global name DifferentialRing
as this is ambiguous, so this will need a name change.
I'd love to see this get into Sage as this looks like some cool functionality.
New commits:
545837f | Trac ticket 13268: includes the DifferentialAlgebra optional package |
5d4f14a | 13268_differential_algebra_support_files |
1355811 | Initial attempt at adding and linking the spkgs. |
Branch pushed to git repo; I updated commit sha1. New commits:
ffb4a2b | DifferentialAlgebra: basic changes to make blad/bmi packages build |
6c0a9e1 | DifferentialAlgebra: make DifferentialAlgebra.pyx compile |
8a610ed | Merge tag '8.2' into differential_algebra |
cec9c0b | DifferentialAlgebra: make DifferentialAlgebra.pyx run without exceptions |
73c96aa | DifferentialAlgebra: all doctests pass |
a18e3c0 | DifferentialAlgebra: remove old include statements |
05e8e5b | DifferentialAlgebra: fix bmi's spkg-install |
Description changed:
---
+++
@@ -21,6 +21,16 @@
Upstream: [BLAD](http://www.lifl.fr/~boulier/pmwiki/pmwiki.php?n=Main.BLAD) [BMI](http://www2.lifl.fr/~boulier/pmwiki/pmwiki.php?n=Main.BMI)
+**Installation**
+
+After building Sage, install the experimental packages `blad` and `bmi`, then run `make` or `make build` again, i.e:
+
+```
+make build
+SAGE_ROOT=$(pwd) ./local/bin/sage -i blad
+SAGE_ROOT=$(pwd) ./local/bin/sage -i bmi
+make build
+```
**An example**
Updated to Sage 8.2
I added an Installation section to the ticket description. I think it should be fairly simple now to work with this code, if not, let me know.
I'd also like to see this code in Sage. François Boulier has done a fantastic job with the blad library. I've tried to implement Rosenfeld-Gröbner from scratch, and believe me, François's library is the way to go.
With that said, I do think that this code belongs in sage.rings
and not sage.calculus
. Regarding the discussion between vbraun
and boulier
, I come at it from the opposite angle - I'm working in polynomial rings all the time, and find it annoying to have to constantly convert back and forth to the symbolic ring.
So I'm thinking that DifferentialRing
should behave a lot like PolynomialRing
- it should take a first argument to specify the coefficient field, and implement DifferentialRingElement
and probably DifferentialIdeal
. We should deal with the situation that François described (the user has created a bunch of equations in the symbolic ring and now wants to use differential algebra tools) by making it easier to move from the symbolic ring to polynomial / differential rings, not by basing DifferentialRing
on the symbolic ring (like is done currently).
The code still needs a good bit of work before we mainline it, so I'll try to keep some patches coming on this ticket...
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
5d4f14a | 13268_differential_algebra_support_files |
1355811 | Initial attempt at adding and linking the spkgs. |
ffb4a2b | DifferentialAlgebra: basic changes to make blad/bmi packages build |
6c0a9e1 | DifferentialAlgebra: make DifferentialAlgebra.pyx compile |
8a610ed | Merge tag '8.2' into differential_algebra |
cec9c0b | DifferentialAlgebra: make DifferentialAlgebra.pyx run without exceptions |
73c96aa | DifferentialAlgebra: all doctests pass |
a18e3c0 | DifferentialAlgebra: remove old include statements |
05e8e5b | DifferentialAlgebra: fix bmi's spkg-install |
b65be15 | Trac #13268: clean up docstrings |
I disowned this ticket, since François Boulier indicated to me via email that he's not working on the Sage package anymore.
Branch pushed to git repo; I updated commit sha1. New commits:
dcb261f | Trac #13268: fix docstrings |
Branch pushed to git repo; I updated commit sha1. New commits:
b1b8412 | Trac #13268: move translate_str inside DifferentialRing |
Branch pushed to git repo; I updated commit sha1. New commits:
f8c7f21 | Merge tag '8.7.rc0' into public/optional_spkg/differential_algebra-13268 |
Some quick comments about technicalities:
Why do you want these to be experimental packages, as opposed to optional?
To avoid confusion, there should be a direct link to the upstream tarballs easily visible in the ticket description.
You mention dependencies in SPKG.txt
while the dependencies
files have # no dependencies
The spkg-install
files should use the more modern sdh helpers. Look at some other spkg-install
files if you don't know what I mean.
Compiling with -Werror
is a bad idea: it's likely to break stuff for no good reason.
# This file is automatically generated from the blad header files
: if that's true, include the script to autogenerate those files instead of the output of that script.
In a lot of places, you use bytes
or char*
where you really mean a string. That will break badly on Python 3.
Don't overdo Cython typing: for example, I would write
def __init__(self, derivations=[], blocks=[], parameters=[], notation="D")
instead of
def __init__ (
self,
list derivations = [],
list blocks = [],
list parameters = [],
char* notation = BMI_IX_D)
Remove pointless comments or docstrings like # __init__
and """ The destructor """
Use is None
instead of == None
.
Try to follow PEP 8 style, I find the extra spaces quite annoying: DifferentialRing (derivations = [t], blocks = [u,v])
should be DifferentialRing(derivations=[t], blocks=[u, v])
.
raise Exception, message
should be raise Exception(message)
.
What's up with bmi_strings.pyx
? Why do you write BMI_IX_undefined
instead of just "undefined"
?
There shouldn't be indentation here:
EXAMPLES:
This example shows how to build the Henri Michaelis Menten formula
by differential elimination. One considers a chemical reaction
system describing the enzymatic reaction::
Same problem here:
EXAMPLE:
This example shows how to compute an input/output relation, having
a nice form, for a compartmental model...
and here:
The class DifferentialRing implements differential polynomial rings
Differential rings can be endowed with zero, one or many different
derivations.
Please use the standard copyright notice.
It's preferred to use # distutils: libraries
declarations in Cython files instead of libraries = ["blad", "bmi"]
in module_list.py
. And the language
and depends
in module_list.py
are not needed as far as I can tell.
from cpython cimport bool
is probably not what you want: it refers to the Python bool
class. What you probably want to use is bint
, which is more like a C boolean (using the C int
type).
Do we have a TODO list here? I'm debating working on this.
Replying to @BrentBaccala:
Updated to Sage 8.2
I added an Installation section to the ticket description. I think it should be fairly simple now to work with this code, if not, let me know.
I'd also like to see this code in Sage. François Boulier has done a fantastic job with the blad library. I've tried to implement Rosenfeld-Gröbner from scratch, and believe me, François's library is the way to go.
With that said, I do think that this code belongs in
sage.rings
and notsage.calculus
. Regarding the discussion betweenvbraun
andboulier
, I come at it from the opposite angle - I'm working in polynomial rings all the time, and find it annoying to have to constantly convert back and forth to the symbolic ring.So I'm thinking that
DifferentialRing
should behave a lot likePolynomialRing
- it should take a first argument to specify the coefficient field, and implementDifferentialRingElement
and probablyDifferentialIdeal
. We should deal with the situation that François described (the user has created a bunch of equations in the symbolic ring and now wants to use differential algebra tools) by making it easier to move from the symbolic ring to polynomial / differential rings, not by basingDifferentialRing
on the symbolic ring (like is done currently).The code still needs a good bit of work before we mainline it, so I'll try to keep some patches coming on this ticket...
Replying to @tdupu:
Do we have a TODO list here? I'm debating working on this.
I'd think, first, get it running on the newest Sage release, then hit the issues jdemeyer listed a year ago, then look at implementing a DifferentialRing
class.
We're both on the U.S. East Coast (I'm in the Washington, DC area), so maybe I'll give you a call at your office and we can talk more about it.
Setting spkg proposals that have not seen recent activity to "sage-wishlist".
Are BLAD/BMI still maintained upstream?
This ticket proposes the inclusion in SAGE of a new package, dedicated to differential algebra.
Introduction
The
DifferentialAlgebra
Sage package is an analogue of the MAPLE 14DifferentialAlgebra
package. The underlying theory is the differential algebra of Ritt and Kolchin. Its main tool is a simplifier for systems of polynomial differential equations, ordinary or with partial derivatives, calledRosenfeldGroebner
. It is related to the differential elimination theory. This simplifier decomposes the radical differential ideal I generated by an input system, as an intersection of radical differential ideals presented by regular differential chains (a slight generalization of Ritt characteristic sets). The output permits to test membership in the differential ideal I.Further developments
Software
The package is written in Cython. The computations are performed by the BLAD libraries (C libraries, 60000 lines, LGPL license). The interface between Sage and BLAD is handled by the BMI library (C library, 10000 lines, LGPL license).
Upstream: BLAD BMI
Installation
After building Sage, install the experimental packages
blad
andbmi
, then runmake
ormake build
again, i.e:An example
Borrowed from
DifferentialAlgebra.pyx
, to motivate (hopefully) reviewers.This example shows how to build the Henri Michaelis Menten formula by differential elimination. One considers a chemical reaction system describing the enzymatic reaction:
A substrate S is transformed into a product P, in the presence of an enzyme E. An intermediate complex ES is formed.
The main assumption is that k(1), k(-1) >> k(2) i.e. that the revertible reaction is much faster than the last one. One performs a quasi-steady state approximation by considering the following differential-algebraic system (it comes from the mass-action law kinetics, replacing the contribution of the fast reactions by an unknown function F_1(t), on the algebraic variety where the fast reaction would equilibrate if they were alone).
Differential elimination permits to simplify this DAE. To avoid discussing the possible vanishing of
params
, one moves them to the base field of the equations.The Rosenfeld-Groebner algorithm considers three cases. The two last ones are degenerate cases.
The sought equation, below, is not yet the Henri-Michaelis-Menten formula. This is expected, since some minor hypotheses have not yet been taken into account
Let us take them into account. First create two new constants. Put them among
params
, together with initial values.There are relations among the parameters: initial values supposed to be zero, and equations meant to rename constants.
Coming computations will be performed over a base field defined by generators and relations
Extend the DAE with linear conservation laws. They could have been computed from the stoichimetry matrix of the chemical system.
Simplify again. Only one case is left.
To get the traditional Henri-Michaelis-Menten formula, one still needs to neglect the term K*E(0)
One can also get it by computing the right hand side of the equation which gives the evolution of the product P
CC: @sagetrac-sage-combinat @sagetrac-boulier @burcin @kcrisman @BrentBaccala
Component: packages: optional
Keywords: package, differential algebra, elimination theory
Author: Nicolas M. Thiéry, François Boulier, Charles Bouillaguet
Branch/Commit: public/optional_spkg/differential_algebra-13268 @
81aef63
Reviewer: Charles Bouillaguet, Karl-Dieter Crisman
Issue created by migration from https://trac.sagemath.org/ticket/13268