JSFHThis maple file illustrates the use of the main procedures of the package RationalFirstIntegrals writen by A. Bostan, G. Ch\303\250ze, T. Cluzeau, and J.-A. Weil.
For explanations and details about the algorithms behind the procedures, see our related paper: Efficient algorithms for computing rational first integrals of planar polynomial vector fields.restart:We load our package and the gfun package needed for the procedure HeuristicRationalFirstIntegral: with(gfun);
with(RationalFirstIntegrals);We define the planar polynomial vector field {x'=A(x,y), y'=B(x,y)} by giving the polynomials A and B:A := 4*(x-1)*(x+1) ; B := 1+(-4*x^2+4)*y^2-4*x*y ;We need a point pt for which A(pt,y) <> 0:pt:=0;
check_pt:=eval(A,x=pt);COMPUTATION OF RATIONAL FIRST INTEGRALSWe can now use our procedures to search for rational first integrals of degree less than or equal to a given N:N:=4;The first procedure is called GenericRationalFirstIntegral:GenericRationalFirstIntegral(A,B,pt,N);This means that the planar polynomial vector field {x'=A(x,y), y'=B(x,y)} does not have any rational first integral of degree
less than or equal to 4 but we can of course search for a rational first integral of greater degree: N:=5;GenericRationalFirstIntegral(A,B,pt,N);
F:=%:Here, the planar polynomial vector field {x'=A(x,y), y'=B(x,y)} has a rational first integral of degree N=5. We can check this:check_RFI:=simplify(A*diff(F,x)+B*diff(F,y));In practice, this first procedure is not very efficient so it is better to use one of the next procedures:For example, one may use our probabilistic algorithm ProbabilisticRationalFirstIntegral.
This procedure requires two rational numbers c1 and c2 that can be chosen arbitrarily (so that A(pt,ci) <> 0): c1:=0;
c2:=1;N:=4;
ProbabilisticRationalFirstIntegral(A,B,pt,[c1,c2],N);N:=5;
ProbabilisticRationalFirstIntegral(A,B,pt,[c1,c2],N);F:=%:
check_RFI:=simplify(A*diff(F,x)+B*diff(F,y));One may also use our deterministic algorithm DeterministicRationalFirstIntegral which runs recursively ProbabilisticRationalFirstIntegral.
This procedure requires an interval [a,b] in which the rational numbers needed for ProbabilisticRationalFirstIntegral are chosen. a:=-1;
b:=1;N:=4;
DeterministicRationalFirstIntegral(A,B,pt,[a,b],N);N:=5;
DeterministicRationalFirstIntegral(A,B,pt,[a,b],N);F:=%:
check_RFI:=simplify(A*diff(F,x)+B*diff(F,y));Finally, one may use our heuristic HeuristicRationalFirstIntegral. This procedure requires the gfun package.
This procedure requires two rational numbers c1 and c2 that can be chosen arbitrarily (so that A(pt,ci) <> 0):c1:=-1;
c2:=1;N:=3;
HeuristicRationalFirstIntegral(A,B,pt,[c1,c2],N);
Here our heuristic fails so that we can not conclude. N:=4;
HeuristicRationalFirstIntegral(A,B,pt,[c1,c2],N);
F:=%:
check_RFI:=simplify(A*diff(F,x)+B*diff(F,y));Note that gfun is not using a notion of global degree so that, contrary to the previous procedures, we find a rational first integral by running
the procedure HeuristicRationalFirstIntegral with N=4 since the degree of the rational first integral in each variable x and y is lower than 4! SIMPLIFICATION OF RATIONAL FIRST INTEGRALSOur package includes a procedure called SimplifyRFI which can be used to obtain a rational first integral written in more compact (simpler) form
than the ones returned by the previous procedures. F1:=SimplifyRFI(A,B,F);check_RFI:=simplify(A*diff(F1,x)+B*diff(F1,y));COMPUTATION OF DARBOUX POLYNOMIALSOur package also inlcude a last procedure for computing all the irreducible Darboux polynomials of the planar polynomial vector field {
x'=A(x,y), y'=B(x,y)} of degree lower than or equal to a given bound N.N:=4;
Darboux:=[DarbouxPolynomials(A,B,pt,N)];Here we have a set of 3 irreducible Darboux polynomials. This can be checked by computing the corresponding cofactors. Cofactors:= [seq( normal(simplify(A*diff(Darboux[i],x)+B*diff(Darboux[i],y))/Darboux[i]),i=1..nops(Darboux))];N:=5;
Darboux:=[DarbouxPolynomials(A,B,pt,N)];As there exists a rational first integral of degree 5 (see the above calculations), we know from the theory that there exists an infinite number of Darboux
polynomials of degree lower than or equal to 5. The second output of the DarbouxPolynomials procedure is a "generic" Darboux polynomial indexed by c.
We can check that the cofactor does not depend on c (i.e., on the Darboux polynomial).Cofactor:=normal(simplify(A*diff(Darboux[2],x)+B*diff(Darboux[2],y))/Darboux[2]);Note that, as GenericRationalFirstIntegral, the procedure DarbouxPolynomial is not very efficient so that it is difficult to use it when A and B have high degrees
or with a high value of N! JSFH