arXiv:1710.00674v2 [math.CA] 10 May 2021 h n ehv rsne n[,2.I 3,w aeetbihtetheor the establish have we different ordinary [3], (the order In second (2ODEs) 2]. rational alterna with [1, an deal in to is presented background d method have ordinary we This order one first the functions. with deal presenting to (1ODEs) approach new a present we Here Abstract iuila functions, Liouvillian solv of process the Keywords: of steps met intermediate The the ar 1ODEs. 2]. all package results obtaining [1, Maple theoretical allow in a that presented the r in those is , implemented than change in is basis of applicable mathematical and, rate solid is itself the more 1ODEs parameter which c orde solving the of to in number for parameters to 2] great here [1, presenting a present in in problem efficient we used any more that appoach much to is the analogous that Directly, idea method a an produce with to [3] in used technique rpitsbitdt optrPyisCmuiain 1d 11 Communications Physics Computer to submitted Preprint Queiroz) Grant. Research a Funda¸c˜ao for (FAPERJ) Ampar thank Janeiro de to de wish Rio Mota do da Estado L.A.C.P. and Duarte L.G.S. [email protected] or ∗ a mi addresses: Email orsodn author Corresponding nvriaed saod i eJnio nttt eF´ısi de Instituto Janeiro, de Rio do Estado do Universidade b ...Duarte L.G.S. OVN OE IHELEMENTARY WITH 1ODES SOLVING ner nttt ainld erlga uldd Tec e Qualidade Metrologia, de Nacional Instituto - Inmetro OE iheeetr ucin,Plnma etrfields, vector functions, elementary with 1ODEs S fnto ehd.I hspeetppr ecmiethe combine we paper, present this In method). - eo ia 05-0 i eJnio–R,Brazil RJ, – Janeiro de Rio Te´orica, 20559-900 [email protected] S a fnto method -function ....d Mota da L.A.C.P. , LACP aMota), da (L.A.C.P. FUNCTIONS LeapS1ode LGS Duarte), (L.G.S. [email protected] a, ∗ ....Queiroz A.B.M.M. , n ticue commands includes it and a et.d F´ısica de Depto. ca, [email protected] nologia. aPsus do `a Pesquisa o aod 2021 de maio e a equations ial a,b (A.B.M.M. ifferential n the ing na on e ieto tive elated etical ases. hod to r PROGRAM SUMMARY

Title of the software package: LeapS1ode – Liouvillian, elementary, algebraic and polyno- mial Solutions of 1ODEs (first order ordinary differential equations).

Catalogue number: (supplied by Elsevier)

Software obtainable from: CPC Program Library, Queen’s University of Belfast, N. Ire- land.

Licensing provisions: none

Operating systems under which the program has been tested: Windows 10.

Programming languages used: Maple 17.

Memory required to execute with typical data: 200 Megabytes.

No. of lines in distributed program, including On-Line Help, etc.: 1037

Keywords: 1ODEs with functions, Polynomial vector fields, Liouvillian functions, S- function method.

Nature of mathematical problem Search for general solutions of first order ordinary differential equations (1ODEs) with (elementary) functions.

Methods of solution The method of solution is based on an algorithm described in this paper.

Restrictions concerning the complexity of the problem If the 1ODE that is being analysed presents a very high degree in (x,y,θ), then the method may not work well.

Typical running time This depends strongly on the 1ODE that is being analysed.

Unusual features of the program Our implementation can find solutions in many cases where the 1ODE under study can not be solved by other powerful solvers nor by other powerful methods. Besides that, the program can perform (in a very natural way) an analysis of the integrability region of the 1ODE’s parameters. Finally, the package presents some useful research commands.

2 LONG WRITE-UP Apart from their mathematical interest, dealing with first order differen- tial (1ODEs) has its more direct application. Any physical (or, for that matter, any scientific question) that can be formulate as a relationship between the rate of change of some quantity of interest and the quantity itself can be formulated as solving an 1ODE (at some stage). There are many well known phenomena which fall into this category: Concentration and dilution problems are quickly remembered examples. Population models are another such example. More specifically, of non-linear 1ODEs and, as a final example, Astrophysics [4], etc. There are many others and there can be many more lurking around the corner of the many scientific endeavours being pursuit. In this sense, any novel mathematical approach, technique to deal with such 1ODEs are welcome and could prove vital to solve a funda- mental question. So, due to this great importance (theoretical and practical) of solving 1ODEs, many methods have been improved in the last decades. Regarding the search for elementary and Liouvillian solutions1, the methods that use the Darboux-Prelle-Singer approach stand out. In this ‘direction’ we can highlight: [5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20]. We have been studying the existence of (and methods to search for) elementary and Liouvillian first of vector fields in R2 since 2002 [1, 2, 12, 35, 36, 37]. In particular, we tackled the problem of looking for general solutions for 1ODEs with functions in [1, 2]. However, the mathema- tical basis was not laid out in such a solid way and, in addition, the method did not deal well (it was computationally expensive) with the problem of determining Darboux in three or more variables. This time, we managed to combine the technique we used in [3]2 with a reasoning very close to the idea used in [1, 2]3. Our method basically starts with an assumption (the existence of a general solution of a specific type) to arrive at an alge- braic result: the existence (or not) of a Liouvillian first (of a certain type) for a polynomial vector field in three variables and, in the case of a positive answer, the determination of that first integral (and, consequently,

1The methods that use the Lie symmetry approach have also been greatly improved. See, for example [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]. 2In that work we use the (so-called) S-function (introduced in [38] and used by us and other people [3, 39, 40, 37, 41, 42, 44, 45, 46, 47]) that improves greatly the efficiency on the searching for Liouvillian first integrals of 2ODEs. 3The central idea is to ‘transform’ elementary functions into rational functions.

3 of the 1ODE’s general solution). Briefly, we associate the 1ODE (presenting an ) with a polynomial vector field in three variables and then analyze the (possible) existence of a Liouvillian first integral. If the first integral is found we only have to perform the inverse transformation to obtain the general solution of the 1ODE in implicit form.

This paper is organized as follows: In the first section, we present some basic concepts involved in the Darboux- Prelle-Singer (DPS) approach and in the S-function method. In the second section, we show how we can associate a 1ODE with an ele- mentary function to a polynomial vector field in three variables and develop a technique similar to the one we built in [3] (to search for Liouvillian first integrals of rational 2ODEs using the S-function method) in order to search for a Liouvillian first integral of the vector field. We use these two steps to propose a procedure that can succeed even in cases where the integrating fac- tors have Darboux polynomials of very high degree. In the end of this section (after a few examples in order to clarify the steps of the procedure), we pro- pose a semi algorithm to deal with solving 1ODEs presenting an elementary function and we describe it in a more formal way. In the third section, we present a computacional package (in Maple) to search for Liouvillian solutions of 1ODEs presenting an elementary function. We start by giving an overview of the package and presenting a summary of the commands. Then, we go deeper into the description of each command and, in the last subsection, we present an example of the usage of the commands to show how they work in practice. In the fourth section, we discuss the performance of the method. We begin by presenting a set of 1ODEs that the method solves without problems but, we believe, would not be easily solved by any other method. In the following, we present some special features of the package we use to solve / study more complicated cases. Finally, we show a case of a 2ODE (in principle, not treatable by the method) that the package can successfully handle. Finally, we present our conclusions.

1. Basic concepts and results In this section we will set the mathematical basis for presenting our method. In the first subsection we will present the Darboux-Prelle-Singer ap-

4 proach in a nutshell and, in the second, the basics of the S-function method.

1.1. The Darboux-Prelle-Singer approach When we talk succinctly about the Darboux-Prelle-Singer approach to se- eking Liouvillian first integrals of autonomous systems of polynomial 1ODEs in the plane, we can summarize the central idea in one paragraph: Find the Darboux polynomials (DPs) associated with the 1ODE system and use them to determine an integrating factor. Without exaggeration, the determination of the DPs is the most impor- tant and (unfortunately) the most complex part (by far) of the whole process. Thus, with a couple of definitions and results, we can describe (briefly) the DPS approach when applied to vector fields in the plane. To begin, let’s define more formally the concepts we referred to. Consider the following system of polynomial 1ODEs in the plane:

x˙ = f(x, y) (1) ( y˙ = g(x, y), where f and g are coprime polynomials in (x, y) and the dot means with respect to a parameter t (u ˙ ≡ du/dt).

Definition 1.1. A function I(x, y) is called a first integral of the system (1) if I is constant over the solutions of (1).

Definition 1.2. The vector field associated with the system (1),

X ≡ f(x, y) ∂x + g(x, y) ∂y, (2) is called Darboux operator associated with (1).

Remark 1.1. If I(x, y) is a first integral of the system (1), then X(I)=0.

Definition 1.3. The polynomial p(x, y) ∈ C[x, y] is called a Darboux poly- nomial of the vector field X if X(p)= qp, where q is a polynomial denomi- nated cofactor.

Theorem 1.1 (Prelle-Singer). If the system (1) presents an elementary first integral I, then there exists an integrating factor R for the system (1) of the ni form R = i pi , where the pi are Darboux polynomials of system (1) and ni are rational numbers. Q 5 Proof. For a proof see [6].

X(R) ni Since R = − div(X)= −(fx + gy), substituting R = i pi we obtain (see [1]) X(p ) Q n i = n q = −(f + g ), (3) i p i i x y i i i X X where the qi are the cofactors of the pi. Therefore, a possible method to find an elementary first integral is:

Prelle-Singer method:(sketch)

• Determine the DPs pi associated with the system. • Find numbers ni that satisfy i ni qi = −(fx + gy).

• ni Construct the integrating factorP R = i pi and find a first integral I(x, y) by quadratures. Q Remark 1.2. If the system (1) presents a non elementary Liouvillian first integral the Prelle-Singer (PS) method needs some modifications (see the Christopher-Singer (CS) method in [12, 13]).However, the main premisse remains the same: determine the DPs of the system.

Remark 1.3. For vector fields in R3, things get a little more complicated: first, the integrating factor R is no longer a Jacobi multiplier (as it happens in R2). Thus, X(R)/R is no longer a known polynomial and depends on a not determined a priori. Second, we need to determine Darboux polynomials in three variables (a very difficult task since it was no longer easy to determine them in two variables).

1.2. The S-function method The concept of S-function emerged when we were trying to adapt the DPS approach to rational second order ordinary differential equations (ra- tional 2ODEs). The idea was to ’add’ a null 1-form to the 1-form that represented the 2ODE (see [38, 41]). However, the problem of calculating DPs was so costly (in computational terms) that we developed a mixed pro- cedure we called ‘the S-function method’. Briefly, the method did not use the computation of Darboux polynomials (in exchange for the resolution of

6 two 1ODEs). The good news is that the S-function method proved to be more effective precisely in problems in which the Darboux polynomials hada relatively high degree, being a great alternative to be used in these cases. In this section, we will see what the method consists of and its basic operation.

1.2.1. Some basic definitions and results Consider the rational 2ODE given by dz M(x, y, z) z′ = = φ(x, y, z)= , (z ≡ y′), (4) dx N(x, y, z) where M and N are coprime polynomials in C[x, y, z]. Definition 1.4. A function I(x, y, z) is called first integral of the 2ODE (4) if I is constant over the solutions of (4). Remark 1.4. If I(x, y, z) is a first integral of the 2ODE (4) then, over the solution curves of (4), the exact 1-form ω := dI = Ix dx + Iy dy + Iz dz is null. Over the solution curves of (4), we have two independent null 1-forms: α := φ dx − dz, (5) β := z dx − dy. (6) So, the 1-form ω is in the vector space sppaned by the 1-forms α and β, i.e., we can write ω = r1(x, y, z) α + r2(x, y, z) β:

dI = Ix dx + Iy dy + Iz dy = r1 (φ dx − dz) + r2 (z dx − dy)

= (r1 φ + r2 z)dx +(−r2)dy +(−r1)dz. (7)

If we call r ≡ R and r2 ≡ S , we can write 1 r1 dI = R [(φ + zS)dx − S dy − dz] . (8)

Therefore, we have that Ix = R (φ + zS), Iy = −RS, Iz = −R. Definition 1.5. Let γ be a 1-form. We say that R is an integrating factor for the 1-form γ if Rγ is an exact 1-form. Definition 1.6. Let I be a first integral of the 2ODE (4). The function defi- ned by S := Iy/Iz is called a S-function associated with the 2ODE through the first integral I.

7 Remark 1.5. From the above definitions and in view of (8) we can see that R is an integrating factor for the 1-form (φ + zS)dx − S dy − dz and S is a S-function associated with the 2ODE (4) through I .

Theorem 1.2. Let I(x, y, z) be a first integral of the 2ODE (4). If S and R are as in (8), then we can write

Dx(R)+ R (S + φz)=0 , (9)

SDx(R)+ R (Dx(S)+ φy)=0 , (10)

−(Rz S + RSz)+ Ry =0 , (11) where Dx := ∂x + z ∂y + φ(x, y, z) ∂z .

Proof: See [41].

Corollary 1.1. Let S be a S-function associated with the 2ODE z′ = φ(x, y, z). Then S obeys the following equation:

2 Dx(S)= S + φz S − φy . (12)

Proof: See [3]

1.2.2. The Associated 1ODEs From (12) we can see that a S-function associated with the rational 2ODE (4) satisfies a quasilinear 1PDE in the variables (x, y, z). Over the solutions of the 2ODE (4) we have that y = y(x) and z = z(x) and, therefore, the d operator Dx is, formally, dx . So, formally, over the solutions of the 2ODE (4) 2 we can write the 1PDE (12) as a Riccati 1ODE: ds/dx = s + φz s − φy. It is r′(x) of common knowledge that the transformation y(x)= − f(x) r(x) changes the Riccati equation y′(x)= f(x) y(x)2 + g(x) y(x)+ h(x) into the linear 2ODE r′′ = ((f ′(x)+ g(x) f(x)) r′)/f(x) − f(x) h(x) r. So, with the transformation s(x) = −w′(x)/w(x), the Riccati 1ODE turns (over the solutions of the ′′ ′ 2ODE (4)) into the homogeneous linear 2ODE w = φz w +φy w. Therefore, d we can use the formal equivalence Dx ∼ dx to produce a connection between the S-functions and the symmetries (written in a particular form) of the 2ODE. Applying the transformation

D (ν) S = − x (13) ν

8 into equation (12). We obtain:

2 Dx(ν)= φz Dx(ν)+ φy ν. (14)

The equation (14) is the symmetry condition for ν to be an infinitesimal that defines a symmetry generator in the evolutionary form. So, we have:

Theorem 1.3. Let ν be a function of (x, y, z) such that [0, ν] defines a symmetry of the 2ODE (4) in the evolutionary form, i.e., Xe := ν ∂y ge- nerates a symmetry transformation for (4). Then the function defined by S = −Dx(ν)/ν is a S-function associated with the 2ODE (4).

Proof: See [3]

Corollary 1.2. Let S be a S-function associated with the 2ODE (4). Then, the function ν given by (−S) ν ≡ eRx , (15)

(where x is the inverse operator of Dx , i.e., x Dx = Dx x = 1) defines a symmetry of the 2ODE (4) in the evolutionary form. R R R Proof: See [3]

The theorem 1.3 and corollary 1.2 establish a connection between S- functions and Lie symmetries. It is this connection that allowed us to avoid the use of Darboux polynomials in the searching for first integrals for the 2ODE (4). The main concept is the associated 1ODE4, which is an 1ODE that has its general solution defined by one of the first integrals of the 2ODE.

Definition 1.7. Let I be a first integral of the 2ODE (4) and let S(x, y, z) be the S-function associated with (4) through I. The first order ordinary differential equation defined by dz = −S(x, y, z), (16) dy where x is taken as a parameter, is called 1ODE[1] associated with (4) through I.

4This concept was developed in [41], page 222.

9 Theorem 1.4. Let I be a first integral of the 2ODE (4) and let S(x, y, z) be the S-function associated with (4) through I. Then I(x, y, z) = C is a general solution of the 1ODE[1] associated with (4) through I. Proof: See [3]

Remark 1.6. The x (the independent variable of the 2ODE (4)) is just a parameter in the 1ODE (16), so, since any function of x is an invariant for the operator Da ≡ ∂y − S ∂z, i.e., Da(x)=0, the relation between a general solution H(x, y, z) = K of the 1ODE (16) and the first integral I(x, y, z) of the 2ODE (4) is I(x, y, z)= F (x, H), such that Dx(I)= ∂x(F)+(Hx + zHy + φHz) ∂H (F)=0.

in a short way, the S-function method consists in determining the S- function, solving the associated 1ODE and solving the 1ODE that represents the characteristic system of the partial differential equation for F.

Remark 1.7. Some comments:

• Since the S-function is defined as the division of Iy by Iz, we can think if the divisions Ix/Iz and Ix/Iy would have any meaning or utility. The answer is yes: We can define the the S-functions {S1,S2,S3} with similar meanings (see [3]).

• The main advantage of the S-function method is that, in general, it is more efficient to determine the S-function than computing Darboux polynomials precisely in the cases where they (the DPs) have high de- grees.

• A great advantage of having three S-functions is that the difficulty as- sociated with determining each one of them can be very different, i.e., it can be much easier to calculate one of them than the others.

• for more details (and examples) of the application of the method we recommend that the reader see the reference [3].

10 2. A new method to solve 1ODEs with an elementary function In this section we will present a method to find the general solution of 1ODEs with an elementary function5. In the first subsection we will show an equivalence between a certain type of 1ODEs and polynomial vector fields in three variables. In the second, we will show how to use the technique developed in [3] to find a Liouvillian first integral of a polynomial vector field in three variables.

2.1. 1ODEs with functions × polynomial vector fields The method we build is applicable to 1ODEs that can be written in the form dy M(x, y, θ) y′ = = φ(x, y, θ)= (17) dx N(x, y, θ) where φ is a rational function of (x, y, θ), i.e., φ ∈ K = C(x, y, θ)6, θ is an elementary generator over C(x, y)7 and M and N are coprime polynomials in (x, y, θ), i.e., M, N ∈ C[x, y, θ]8. Furthermore, if I(x, y, θ) = c represents a general solution of 1ODE (17) and I is a of (x, y, θ) then for the method to work it is sufficient that the partial of I in relation to x, y and θ can be expressed as

Ix = RP1 (18)

Iy = RP2 (19)

Iθ = RP3 (20) where R is an elementary function of (x, y, θ) and P1, P2, P3 ∈ C[x, y, θ] (i.e., P1, P2 and P3 are polynomials in (x, y, θ) ). The main idea is to perform the transformation z = θ(x, y) that allows the association of 1ODE (17) with a polynomial vector field that has I(x, y, z) as a Liouvillian first integral. Let’s see how this happens:

• In first place, since Dx(I) = 0 where Dx ≡ ∂x + φ ∂y, we have that ∂I ∂I ∂θ ∂I ∂I ∂θ D (I)= ∂ (I)+ φ ∂ (I)= + + φ + . (21) x x y ∂x ∂θ ∂x ∂y ∂θ ∂y  

5This version of the method will be limited to non algebraic elementary functions. 6K = C(x,y,θ) is the differential field of rational functions in the variables (x,y,θ). 7This is a formal way of saying that θ is an elementary function of (x, y) (see [48]). 8C[x,y,θ] is the differential ring of polynomial functions in the variables (x,y,θ).

11 • Second, since θ is an elementary generator over C(x, y), (i.e., θ is in C ∂θ ∂θ an elementary extension of (x, y)) then the derivatives ∂x , ∂y ∈ K = C(x, y, θ).

• In view of this, we can write Dx(I) as

∂I ∂I ∂θ ∂θ ∂I D (I) = + φ + + φ = x ∂x ∂y ∂x ∂y ∂θ   = Ix + φIy +(θx + φ θy) Iθ, (22)

∂θ ∂θ where θx ≡ ∂x and θy ≡ ∂y are rational functions of (x, y, θ).

• From the fact that φ, θx and θy are rational functions of (x, y, θ), we can multiply Dx(I) by the lcm of the denominators of φ, θx and θy φ, obtaining

lcm(denominator(φ, θx, θy φ)) Dx(I)=(f ∂x+g ∂y+h ∂θ)(I(x, y, θ))=0, (23) where f, g and h are polynomials in (x, y, θ) and

f = lcm(denominator(φ, θx, θy φ)), (24)

g = lcm(denominator(φ, θx, θy φ)) φ, (25)

h = lcm(denominator(φ, θx, θy φ)) (θx + φ θy) . (26)

• If we make the substitution θ → z, we have that

(f(x, y, z) ∂x + g(x, y, z) ∂y + h(x, y, z) ∂z)(I(x, y, z))=0. (27)

Therefore, following these steps we can associate the polynomial vector field

χ ≡ f(x, y, z) ∂x + g(x, y, z) ∂y + h(x, y, z) ∂z (28) with the 1ODE (17). Moreover, we can associate the first integral I(x, y, z) of χ (see equation (27)) with the general solution of the 1ODE (17) (i.e., I(x, y, θ)= c). So, if we can find a Liouvillian first integral I(x, y, z) for the vector field χ, we will have found the general solution of 1ODE (17): we only have to apply the substitution z → θ on I(x, y, z)= c.

12 2.2. S-function method adapted to polynomial vector fields in three variables In this section we will show how we can adapt the method described in [3] (S-function method) to polynomial vector fields in three variables. Consider that I(x, y, z) is a Liouvillian first integral of the vector field χ ≡ f ∂x+g ∂y +h ∂z, such that the derivatives Ix, Iy and Iz are given, respectively, by RP1, RP2 and RP3 (see the section 2.1). Now, supose that I(x, y, z) is a Liouvillian first integral of a (hypothetical) rational 2ODE such that x is the independent variable, y is the dependent variable and z is dy/dx. This hypothetical 2ODE would be given by I + zI P + zP M (x, y, z) z′ = Φ(x, y, z)= − x y = − 1 2 = 0 , (29) Iz P3 N0(x, y, z) where M0 and N0 are coprime polynomials in (x, y, z). As we saw in section 1.2, the S-functions S1, S2 and S3 associated with this 2ODE through the first integral I are given by the following rational functions Iy P2 Ix P1 Ix P1 S1 = = , S2 = = , S3 = = , (30) Iz P3 Iz P3 Iy P2 where S1, S2 and S3 obey the equations

2 Dx(S1) = S1 + Φz S1 − Φy, (31) 1 Φ D (S ) = − S 2 + Φ − S − Φ , (32) x 2 z 2 z z 2 x   Φ Φ − z Φy D (S ) = − y S 2 + x S + z Φ , (33) x 3 Φ 3 Φ 3 x where Dx ≡ ∂x +z ∂y +Φ ∂z. Since we do not have the function Φ, we cannot use the equations (31), (32) and (33) to find the S-functions S1, S2 and S3 associated with the hypothetical 2ODE (29). So, in order to use the technique developed in [3], we will need some relationship between the (hypothetical) 2ODE and the vector field (28). We will establish this relationship using the fact that the 2ODE (29) and the vector field χ have in common the first integral I. This fact allows us to establish a result that will give us a way to apply the method used in [3] to our problem. Let’s begin with the following definition:

Definition 2.1. Let f ∂x + g ∂y + h ∂z be a polynomial vector field in three variables presenting a first integral I(x, y, z) and let z′ = Φ(x, y, z) be a

13 rational 2ODE such that it also has I(x, y, z) as a first integral. We say that the 2ODE and the vector field are associated through the first integral I. Remark 2.1. Note that, since the status of the variables (x, y, z) in the vector field f ∂x +g ∂y +h ∂z are the same, there are, in principle, six distinct 2ODEs associated with it:

Ix + zIy Φ1 = − , (34) Iz

Iy + zIx Φ2 = − , (35) Iz

Ix + yIz Φ3 = − , (36) Iy

Iz + yIx Φ4 = − , (37) Iy

Iy + xIz Φ5 = − , (38) Ix

Iz + xIy Φ6 = − . (39) Ix This will be useful in the future process of finding the first integral I through the S-function method (see section 2). Theorem 2.1. Let χ, defined by (28), be a polynomial vector field presenting a Liouvillian first integral I and let the rational 2ODE defined by (29) be associated with the vector field χ through I. If their derivatives are given by

Ix = RP1, (40)

Iy = RP2, (41)

Iz = RP3, (42) where R is a Darboux function of (x, y, z) and P1, P2, P3 ∈ C[x, y, z] then the S-function S1 associated with the rational 2ODE (29) is given by

M0 f − N0 h S1 = , (43) N0 (g − z f) where g − z f =06 .

14 Proof of Theorem 2.1: From the hypotheses we have that

D0(I) = N0 ∂x(I)+ z N0 ∂y(I) + M0 ∂z(I)=0, (44)

χ(I) = f ∂x(I)+ g ∂y(I) + h ∂z(I)=0. (45) where M0 and N0 are, respectively, the numerator and denominator of the 2ODE (29). Defining D1 ≡ f D0 − N0 χ, and applying it to I we obtain:

D1(I)=(f D0−N0 χ)(I)=(z f−g) N0 ∂y(I)+(M0 f−N0 h) ∂z(I)=0. (46)

From eq.(46) we have (see [3]) that Iy/Iz = −(M0 f − N0 h)/(N0 (z f − g)) = S1. 

Remark 2.2. We note that the function S1 as presented in the equation (43) ‘defines’, in a certain sense, the relationship between the vector field χ and the 2ODE (29). So, we can use it to produce an algorithm (semi) to find the 2ODE (M0 and N0) and, in view of (43), the S-function.

2.3. A possible method In this section, we will use the equation (43) in the process of building an algorithm to find the general solution of 1ODE (17). Before describing the steps of a possible algorithm in more detail, let’s outline the main steps of the process and discuss its application to some examples in order to materialize (and clarify) the path we are trying to follow to achieve our goal. The Procedure: (Sketch)

• If the 1ODE can be placed in the form (17) then construct the operator D (22).

• Make the substitution θ → z on the D operator and find the polynomial operator χ (28).

• Construct polynomial candidates Mc and Nc (with undetermined coef- ficients {mi} and {nj}) of some chosen degree in the variables (x, y, z).

15 • Substitute Mc f − Nc h S1 = Nc (g − z f) in the equation for the S-function: ∂Φ ∂Φ D (S )= S 2 + c S − c , x 1 1 ∂z 1 ∂y

where Dx ≡ ∂x + z ∂y + Φc ∂z and Φc ≡ Mc/Nc.

• Solve the polynomial equation for the unknown coefficients {mi} and {nj}, obtaining S1. • Use the S-function method to find de Liouvillian first integral I of the 2ODE z′ = Φ(x, y, z). • Make the substitution z → θ on the first integral I and obtain the desired general solution of the 1ODE.

Before presenting a more formal algorithm let’s discuss some examples: Example 1: Consider the 1ODE given by dy exx3y2 + exx2y2 + 2 exx2y + exxy + exx + y2 + ex = (47) dx x2y2 + exx2 + xy +1 and let’s apply the procedure sketched above:

x x • Choosing θ = e , we have that θx = e = θ and θy = 0. So, the operator D will be: θ x3y2 + θ x2y2 +2 θ x2y + θ xy + θ x + y2 + θ D = ∂ + ∂ +θ ∂ . (48) x x2y2 + θ x2 + xy +1 y θ

• The polynomials f, g and h will be: f = x2y2 + zx2 + xy +1, (49) g = zx3y2 + zx2y2 +2 zx2y + zxy + zx + y2 + z, (50) h = z x2y2 + zx2 + xy +1 . (51)

The operator χ will be: 

χ = f ∂x + g ∂y + h ∂z. (52)

16 • For the degrees degM = 4 and degN = 5 we obtain:

M0 = − (xz − y)(xz + y) , (53) 2 N0 = −x (xy + 1) , (54) x2y2 + x2z + xy +1 S1 = − (55) x (xy + 1)2

• Using S1 in the S-function method, we have the following first integral:

1 I = e xy+1 (zx − y) (56)

• Making the substitution z = ex we finally arrive at the solution:

1 x e xy+1 (x e − y)= C (57)

Now let’s take a closer look at the derivatives of the first integral I (of the vector field χ):

1 e xy+1 I = zx2y2 + zxy + y2 + z , (58) x (xy + 1)2

1  e xy+1 I = − x2y2 + zx2 + xy +1 , (59) y (xy + 1)2

1  e xy+1 I = x(xy + 1)2. (60) z (xy + 1)2

From them we can determine (directly) the integrating factor R, the 2ODE associated (Φ), the polynomials P1, P2 and P3 and the S-functions S1, S2

17 and S3: x2z2 − y2 Φ = , (61) (xy + 1)2 x

1 e xy+1 R = , (62) (xy + 1)2

2 2 2 P1 = x y z + xyz + y + z, (63)

2 2 2 P2 = − x y + x z + xy +1 , (64)

2 P3 = x(xy + 1) ,  (65) x2y2 + zx2 + xy +1 S1 = − , (66) (xy + 1)2 x zx2y2 + zxy + y2 + z S2 = , (67) (xy + 1)2 x zx2y2 + zxy + y2 + z S = − . (68) 3 x2y2 + zx2 + xy +1 The components (f,g,h) of the vector field χ are (see above) f = x2y2 + zx2 + xy +1, (69) g = zx3y2 + zx2y2 +2 zx2y + zxy + zx + y2 + z, (70) h = z x2y2 + zx2 + xy +1 . (71)

Remark 2.3. So, comparing (f,g,h) with the polynomials P1, P2 and P3 and with the numerators and denominators of the S-functions, we can see that: N0 = P3, f = −P2, h = −zP2. (72)

The first of these equations may not surprise, since Φ = −(P1 + zP2)/P3. However, the following two equations are (at first glance) intriguing.

Example 2: Consider now the 1ODE given by dy −ey (e2yx2y − 2 eyxy2 − xeyy + y3 − 1) = . dx e3yx3y+e3yx3 − 2e2yx2y2 − 3e2yx2y+ eyxy3 + eyxy2 + xeyy− xey +1 (73)

18 Applying the whole procedure again we obtain

f = x3yz3 +z3x3 −2x2y2z2 −3z2x2y+xy3z+zxy2 +xzy−zx+1, (74) g = −z z2x2y − 2 zxy2 − xzy + y3 − 1 , (75) h = −z2 z2x2y − 2 zxy2 − xzy + y3 − 1 . (76)  The function S1 is z3x3 − 2 z2x2y + zxy2 + xzy +1 S = . (77) 1 x (z2x2y − 2 zxy2 − xzy + y3 − 1)

From S1 we can determine the first integral (for the vector field χ) and (making the substitution z = ey) the general solution of the 1ODE (73):

1 1 y I = e zx−y (xzy + 1) , e eyx−y (xe y +1) = C. (78)

From the derivatives of the first integral I we can get Φ, the polynomials P1, P2 and P3 and the S-functions S1, S2 and S3:

(zx − y)2 (zx + y) z Φ = , (79) x (z2x2y − 2 zxy2 − xzy + y3 − 1)

2 2 2 3 P1 = z z x y − 2 zxy − xzy + y − 1 , (80)

3 3 2 2 2 P2 = z x − 2 z x y + zxy + xzy +1, (81)

2 2 2 3 P3 = x z x y − 2 zxy − xzy + y − 1 , (82) z3x3 − 2 z2x2y + zxy2 + xzy +1 S = , (83) 1 x (z2x2y − 2 zxy2 − xzy + y3 − 1) z S = , (84) 2 x z (z2x2y − 2 zxy2 − xzy + y3 − 1) S = . (85) 3 z3x3 − 2 z2x2y + zxy2 + xzy +1

19 Remark 2.4. Again, if we compare (f,g,h) with the polynomials P1, P2 and P3 and with the S-functions, we see that:

N0 = P3, g = −P1, h = −zP1. (86) Besides that, as the roles of x and z can be switched in the first integral I (i.e., the transformation x → z, z → x is a symmetry transformation for I) the S-function S2 has a very simple format.

Example 3: Let’s see now an example where we have a function of x and y. Consider the 1ODE

x 5 2 3 3 4 2 2 2 dy xy ln y +(xy − 2 x y + x y + y + x y − 2 xy + x ) y = . dx 2 x  5 2 3 3 3 4 2 2 2 xy ln y + x (−xy +2 x y − x y +2 xy + y − 2 xy + x )   (87) So f = x xy5 − 2 x2y3 + x3y − 2 xy3 − y4 +2 xy2 − 2 zy2 − x2 , (88) g = − xy5 − 2 x2y3 + x3y + y4 + x2y − 2 xy2 + x2 + zx y, (89) h = 2 xy 5 − 4 x2y3 +2 x3y − 2 xy3 + x2y − 2 zy2 + zx.  (90)

The function S1 is xy4 − 2 x2y2 + x3 − 2 xy2 − 2 yz S = . (91) 1 y4 − 2 xy2 + x2 The first integral and the general solution of the 1ODE are

1 1 x I = e y2−x (xy + z) , e y2−x xy + ln = C. (92) y    The polynomials P1, P2, P3 and Φ are:

5 3 2 P1 = y − 2 xy + x y + xy + z, (93)

4 2 2 3 2 P2 = xy − 2 x y + x − 2 xy − 2 yz, (94)

2 2 P3 = −y + x , (95) xy4z−2x2y2z+y5 +x3z−2xy3 −2xy2z+x2y−2yz2 +xy+z Φ = . (96) (−y2 + x)2

20 Remark 2.5. Some comments:

1. This time, looking at the polynomials P1, P2 and P3 in the example 3, we see that none of them is a member of {cf,cg,ch} where c is a constant. 2. A very noticeable difference between examples 1 and 2 and example 3 is that in examples 1 and 2 the elementary function present on the 1ODE was a function of only one variable (x or y) whereas in example 3 the function θ was a function of the two variables (x, y), i.e., θ = θ(x, y). 3. In general it is much simpler (computationally speaking) to calculate the S-function if we already know its numerator or denominator. In these cases the algorithm is much more efficient (i.e., faster and with less memory consumption). 4. What happened in examples 1 and 2 was not a fluke. We can show that, in almost all cases, if θ is an elementary function of only one variable, then one of the coefficients of the vector field χ will divide one of the polynomials (P1,P2,P3). 5. The good news is that, if θ is an elementary function of a rational function, in a lot of cases we can perform a variable transformation that takes θ(x, y) into θ(x) (or θ(y)).

2.4. A possible improvement What was stated in observation 4 (remark 2.5) can be demonstrated and (in conjunction with the fact presented in observation 5) used to greatly improving the efficiency of the algorithm in a wide variety of cases9. Before presenting the alternative method, let’s define (a little more) the type of 1ODE that these improvement can handle. Definition 2.2. Consider that an 1ODE as described by equation (17) has the following characteristics: 1. I(x, y, θ(x, y)) = c (c constant) represents a general solution of the 1ODE (17) and I is a Liouvillian function of (x, y, θ). 2. The function θ(x, y) is in an elementary extension E of the differential field (of characteristic zero) C(x, y) such that E = C(x, y, exp(r)) or E = C(x, y, ln(r)), where r ∈ C(x, y).

9However, although the improvement we are going to present is quite general, the ‘pro- blem solution’ can, in certain cases, introduce complexity to the process, almost canceling the efficiency gain obtained.

21 3. The 1ODE is associated with a vector field χ ≡ f ∂x + g ∂y + h ∂z such that f,g,h ∈ C[x, y, z] and

f = lcm(denominator(φ, ∂x(θ), ∂y(θ) φ))|θ→z,

g = lcm(denominator(φ, ∂x(θ), ∂y(θ) φ)) φ|θ→z,

h = lcm(denominator(φ, ∂x(θ), ∂y(θ) φ)) (∂x(θ)+ φ ∂x(θ)) |θ→z. 4. The derivatives of the first integral I (of the vector field χ) are of the ni form: ∂k(I) = exp(A/B) i pi Pk, k ∈{1, 2, 3}, where A,B,pi,Pk are polynomials in C[x, y, z] and ni are integers. 5. Let T be the transformationQ T = {u = r(x, y), v = y} (or T = {u = x, v = r(x, y)}), where r ∈ C(x, y) is the argument of θ. If T −1 = {x = −1 r1(u, v),y = v} (or T = {x = u,y = r1(u, v)}) denote its inverse, we are assuming that r1 is a rational function of (u, v), i.e., r1 ∈ C(u, v).

We will denote the set of 1ODEs that have these characteristics as LS .

Now, we are going to present a result that, if applied to an 1ODE ∈ LS , can be used to construct an improvement of the method sketched above.

Theorem 2.2. Let χ ≡ f ∂x + g ∂y + h ∂z be the polynomial vector field associated with the 1ODE (17) (φ = M/N, M,N ∈ C[x, y, θ]) and let the first integral I (of the vector field χ) be such that its derivatives are of the form: ni ∂k(I) = exp(A/B) i pi Pk, k ∈{1, 2, 3}, where A,B,pi,Pk are polynomials in C[x, y, z] and ni are rational numbers. We can state that: x Q i) If θ = e then f|P2, h = z f and g|(P1 + zP3). ii) If θ = ln(x) then h|P2, f = x h and g|(xP1 + P3). y iii) If θ = e then g|P1, h = zg and f|(P2 + zP3). iv) If θ = ln(y) then h|P1, g = y h and f|(yP2 + P3).

Proof. We have seen that we can write the operator D ≡ ∂x+φ ∂y – associated with the 1ODE (17) – in the form D = ∂x + φ ∂y +(θx + φ θy) ∂θ, where θx and θy are rational functions of (x, y, θ). In order to obtain the vector field χ we have to multiply D by the lcm of the denominators of φ, θx and θy φ and make the substitution θ → z, obtaining χ = f ∂x + g ∂y + h ∂θ, where f, g and h are polynomials given by

f = lcm(denominator(φ, θx, θy φ))|θ→z,

g = lcm(denominator(φ, θx, θy φ)) φ|θ→z,

h = lcm(denominator(φ, θx, θy φ)) (θx + φ θy) |θ→z.

22 Now we can prove the statements: x i): If θ = e then θx = z and θy =0 and so

f = N(x, y, z), g = M(x, y, z), h = z N(x, y, z). (97)

We have that χ(I)=fIx+gIy+hIz = fRP1+gRP2+hRP3 (by hypothesis) = R (fP1 +gP2 +hP3) = 0. Substituting (97) and noting that R is not null we can write NP1 + MP2 + zNP3 = 0 implying that N (P1 + zP3)= −MP2. Therefore, we can write

MP N (P + zP ) P + zP = − 2 and P = − 1 3 . (98) 1 3 N 2 M

Since M and N are coprime, we have that N|P2 ⇒ f|P2 and M|(P1 + zP3) ⇒ g|(P1 + zP3). ii): If θ = ln(x) ⇒ θx =1/x and θy = 0. We have two cases:

f = x N(x, y, z), g = x M(x, y, z), h = N(x, y, z), (99) if x is not a factor of N or

n n−1 f = x PN (x, y, z), g = M(x, y, z), h = x PN (x, y, z), (100)

n where PN = N/x is a polynomial, n is a positive integer and x and PN are coprime. First case (x and N are coprime): N (xP1 + P3) = −xMP2. Therefore, N|P2 ⇒ h|P2 and x M|(xP1 + P3) ⇒ g|(xP1 + P3). n−1 Second case (x|N): x PN (xP1 + P3) = − MP2. Since M and N are n−1 coprime, we have that x PN (= h) and M are coprime. Therefore, h|P2 and g|(xP1 + P3). y iii): If θ = e then θx = 0 and θy = z and so

f = N(x, y, z), g = M(x, y, z), h = z M(x, y, z). (101)

We can write NP1+MP2+zMP3 = 0 implying that NP1 = −M (P2+zP3). Therefore, we can write

NP M (P + zP ) P + zP = − 1 and P = − 2 3 . (102) 2 3 M 1 N

23 Since M and N are coprime, we have that N|(P2 + zP3) ⇒ f|(P2 + zP3) and M|P1 ⇒ g|P1. iv): If θ = ln(y) ⇒ θx = 0 and θy =1/y. We have two cases:

f = y N(x, y, z), g = y M(x, y, z), h = M(x, y, z), (103) if y is not a factor of M or

n n−1 f = N(x, y, z), g = y PM (x, y, z), h = y PM (x, y, z), (104)

n where PM = M/y is a polynomial, n is a positive integer and y and PM are coprime. First case (y and M are coprime): NyP1 = −M (yP2 + P3). Therefore, M|P1 ⇒ h|P1 and y N|(yP2 + P3) ⇒ f|(yP2 + P3). n−1 Second case (y|M): y PM (yP2 + P3) = − NP1. Since M and N are n−1 coprime, we have that y PM (= h) and N are coprime. Therefore, h|P1 and f|(yP2 + P3). 

Corollary 2.1. If the 1ODE (17) ∈ LS, then there is a rational transforma- −1 tion T (with rational inverse T ) such that the transformed 1ODE[tr] has an associated vector field χ[tr] in which fi|Pj for some fi ∈{f,g,h} and for some Pj ∈{P1,P2}.

Proof. For any 1ODE ∈ LS we can perform a variable transformation that takes θ(x, y) into exp(x), ln(x), exp(y) or ln(y). Thus, any 1ODE ∈ LS can be transformed into an 1ODE that fulfills the premises of the theorem 2.2. Therefore, the conclusion is a direct consequence of the theorem 2.2.  In this point we can use the compatibility conditions for the first integral I of the vector field χ to write the 1PDE for S in terms of f, g and h.

Theorem 2.3. Let χ ≡ f ∂x + g ∂y + h ∂z be the polynomial vector field associated with the 1ODE (17) and let I be a first integral it. Then the S-function associated with χ through I obeys the 1PDE given by

fg − gf gf − fg + fh − hf fh − hf χ(S)= S2 z z + S y y z z − y y . f f f      (105)

24 Proof. See the proof of theorem 1.1 and corollary 1.1 of [3]. 

Since S = Iy/Iz = P2/P3 and the status of the variables (x, y, z) in the vector field f ∂x + g ∂y + h ∂z is the same, we can perform the following variable transformations:

• In first place we can use the transformation T1 such that its inverse is −1 given by T1 = {y1 = x, x1 = r(x, y)} (where r(x, y) is the argument of θ) to obtain an 1ODE[1] such that θ[1] = exp(x1) or θ[1] = ln(x1).

• If θ[1] = exp(x1) we can use the transformation T2 = {x1 = ln(x2),y1 = y2} and obtain an 1ODE[2] such that θ[2] = ln(x2). • For the 1ODE[2], the vector field χ2 associated is given by f2 ∂x2 +

g2 ∂y2 + h2 ∂z2 , where (To make the notation less heavy we omitted index 2 in the following equations):

f = x N(x, y, z), g = x M(x, y, z), h = N(x, y, z), (106)

if x is not a factor of N or

n n−1 f = x PN (x, y, z), g = M(x, y, z), h = x PN (x, y, z), (107)

n where PN = N/x is a polynomial, n is a positive integer and x and PN are coprime (see case (ii) of theorem 2.2).

• Since the status of the variables (x2,y2, z2) in the vector field χ2 is the same, we can make the transformation T3 = {x2 = y3,y2 = z3, z2 = x3} that will make P2 take the place of P3 (which is the denominator of the transformed S-function). The transformed vector field χ3 will be given

by f3 ∂x3 + g3 ∂y3 + h3 ∂z3 , where

f3 = T3(h2),

g3 = T3(f2),

h3 = T3(g2).

At this point we can use the equation (105) to determine the numerator of the transformed S-function S1[3]. We can use S1[3] to find a first integral −1 I[3] for the vector field χ[3]. Applying the inverse trasformation T3 to I[3]

25 we obtain the first integral I[2] for χ[2]. From I[2] we can write the general solution of 1ODE[2] (using z → ln(x)). If we apply the inverse trasformation −1 −1 −1 −1 T2 followed by T1 to I[2] = c, we will obtain I = T1 (T2 (I[2])) = c, which represents the general solution of the original 1ODE. Let’s make these steps clearer with an example:

Example 4: Consider the 1ODE given by

dy 2 (exy)2 x3y2 − exyx3y2 + exyxy3 − 5 exyx2y + exyy2 +2 x = . (108) dx (exy)2 x2y2 + exyx4y − exyx2y2 + exyx3 − 3 xyexy +1

• In first place, let’s make the transformation T1 = {x = x/y, y = y} leading to:

dy y (2 e2 xx3 + exxy3 − exx3 + exy3 − 5 exx2 +2 x) = . (109) dx e2 xx2y3 + 2 e2 xx4 − 2 exxy3 − 4 exx3 + y3 +2 x2

• Next we’re going to apply the transformation T2 = {x = ln(x), y = y} obtaining:

dy y(2 x2 ln(x)3 + x ln(x)y3 − x ln(x)3 + xy3 − 5 x ln(x)2 + 2 ln(x)) = . dx (x2 ln(x)2y3 +2 x2 ln(x)4 −2 x ln(x)y3 −4 x ln(x)3 + y3 + 2 ln(x)2)x (110)

• The vector field χ[2] associated with the 1ODE[2] is defined by:

3 2 2 f2 = y +2 z (xz − 1) x, (111)

2 3 3 3 3 2 g2 = y 2 x z + zxy + xy − xz − 5 z x +2 z , (112)

3 2 2 h2 = y +2 z (xz − 1) .  (113)  • Let’s apply the transformation T3 = {x = y,y = z, z = x} obtaining:

3 2 2 f3 = z +2 x (xy − 1) , (114)

3 2 2 g3 = z +2 x  (xy − 1) y, (115)

3 2 3 3 3 2 h3 = z 2 x y + xyz − x y + yz − 5 x y +2 x . (116) 

26 • Constructing a polynomial P with arbitrary coefficients in (x, y, z) and substituting in the equation (105), we obtain (for degree 5):

3 2 3 2 x z (−z + x ) P = x z −z + x → S1[3] = . (117) (z3 +2 x2)(xy − 1)2  • Using the S-function method we can find a first integral for χ[3]: 1 I = − ln z3 − x2 + 2 ln (z) − . (118) [3] xy − 1  −1 • Applying T3 to I[3] we obtain: 1 I = − ln y3 − z2 + 2 ln (y) − . (119) [2] xz − 1  • From I[2] we can write the general solution of 1ODE[2] (z → ln(x)): 1 − ln y3 − (ln (x))2 + 2 ln (y) − = C . (120) x ln (x) − 1 2  −1 x • Applying T2 = {x = e , y = y} to the general solution of 1ODE[2] we arrive at the general solution of 1ODE[1]: 1 − ln y3 − x2 + 2 ln (y) − = C . (121) xex − 1 1  −1 • Finally, applying T1 = {x = xy, y = y} to the general solution of 1ODE[1] we have the general solution of the original 1ODE: 1 − ln −x2y2 + y3 + 2 ln (y) − = C. (122) xyexy − 1  Remark 2.6. Although the application of a sequence of transformations fol- lowed by the sequence of inverse transformations (applied in reverse order) is a bit tiring to follow, in practice these steps have no algorithmic weight, i.e., they consume virtually no memory or CPU time. The important point is that these transformations lead to a vector field whose associated S-function (to be determined) depends on obtaining only one polynomial (instead of 2). This greatly simplifies the algorithm.

27 2.5. Two possible algorithms In this section we will present two possible algorithms to solve an 1ODE that presents an elementary function.The first is more generic, yet less effi- cient. The second can be more restricted, but much more efficient than the first. Algorithm 2.1 (Lsolv). This algorithm is based on the method described in the section 2.3.

Steps: 1. Construct the vector field χ, i.e., determine [f,g,h] (by using definition 2.2).

2. Choose DegMNP (a list of three positive integers - [dM ,dN ,dP ]) for the degrees of the candidates Mc, Nc and Pc (candidates for the polynomials M0, N0 and P3). 3. Construct three polynomials Mc, Nc and Pc of degrees dM , dN and dP , respectively, with undetermined coefficients.

4. Substitute them in the equation E1 : Mc f − Nc h +(z f − g) Pc =0. 5. Collect the equation E1 in the variables (x, y, z) obtaining a set of (li-

near) equations SE1 for the coefficients of the polynomials Mc, Nc and Pc.

6. Solve SE1 to the undetermined coefficients. 2 7. Substitute the solution of SE1in the equation E2 :Dx(Sc)−Sc −∂z(Φc) Sc+ ∂y(Φc)=0, where Dx ≡ ∂x + z ∂y + Φc ∂z, Φc = Mc/Nc and Sc = Pc/Nc.

8. Collect the numerator of E2 in the variables (x, y, z) obtaining a set of

equations SE2 for the remaining undetermined coefficients of the poly- nomials Mc, Nc and Pc.

9. Solve SE2 for the remaining undetermined coefficients. If no solution is found then FAIL.

10. Substitute the solution of SE2 in Mc and Nc to obtain M0, N0 and in Pc/Nc to obtain S1. 11. Use the S-function method to find the Liouvillian first integral I of the 2ODE z′ = Φ(x, y, z). 12. Make the substitution z → θ on the first integral I and obtain the desired general solution of the 1ODE.

28 Remark 2.7. Some comments:

• Since there is no bound for the degrees [dM ,dN ,dP ] the procedure may never get to a conclusion, i.e., more formally, Lsolv is a semi algo- rithm. • Some of the steps described above are obviously much more complicated than others. Some involve very complex algorithms in themselves, for example, the algorithm that solves nonlinear polynomial systems. Besi- des that, since we are adapting the method of the S function to solve the final part, the penultimate item is itself a very complicated algorithm.

Algorithm 2.2 (F astLs). This algorithm is an improvement of the algo- rithm 2.1 and is based on the theorems 2.2 and 2.3, on the corollary 2.1 and on their consequences (see example 4). It is restricted to 1ODEs ∈ LS. Steps:

1. Use a variable transformation T1 = {x = r(x, y),y = y} where r(x, y) is the argument of θ to obtain an 1ODE[1] such that θ[1] = exp(x) or θ[1] = ln(x). 2. If θ[1] = exp(x) then make a transformation T2 = {x = ln(x),y = y} to obtain an 1ODE[2] such that θ[2] = ln(x). 3. Construct the vector field χ2 = f2 ∂x + g2 ∂y + h2 ∂z associated with the 1ODE[2], where

f2 = x N(x, y, z), g2 = x M(x, y, z), h2 = N(x, y, z), (123) if x is not a factor of N or N(x, y, z) f = N(x, y, z), g = M(x, y, z), h = , (124) 2 2 2 x if x|N. 4. Apply the transformation T3 = {x = y,y = z, z = x} to the vector field χ[2], obtaining χ3 = f3 ∂x + g3 ∂y + h3 ∂z, where

f3 = T3(h2),

g3 = T3(f2),

h3 = T3(g2).

29 5. Choose dP for the degree of the candidate P (candidate for the polyno- mial P2 – numerator of the S-function). 6. Construct a polynomial P in (x, y, z) with arbitrary coefficients and substitute it in the equation E1 : (105).

7. Collect the equation E1 in the variables (x, y, z) obtaining a set of qua-

dratic equations SE1 for the coefficients of the polynomial P .

8. Solve SE1 to the undetermined coefficients. If no solution is found then FAIL.

9. Substitute the solution of SE1 in P/f to obtain S1[3]. 10. Use the S-function method to determine the first integral I[3] of the vector field χ[3]. −1 11. Apply the inverse trasformation T3 and obtain the first integral I[2] of the vector field χ[2]. From I[2] we can have (doing z → ln(x)) the general solution of the 1ODE[2]. −1 12. Aplly T2 to the general solution of the 1ODE[2] and obtain the general solution of the 1ODE[1]. −1 13. Aplly T1 to the general solution of the 1ODE[1] and obtain the general solution of the original 1ODE.

Remark 2.8. The algorithm F astLs uses the equation (105) to determine the polynomial P (the numerator of the S-function). Since (105) has a term of the form S2, we have that it can be written as (see the example 4):

P P 2 fg − gf P gf − fg + fh − hf fh − hf χ = z z + y y z z − y y . f f f f f f       (125) We can isolate the equation (125) for P 2, obtaining P 2 = polynomial. Since the higher degree of P squared cannot cancel, the maximum degree of the polynomial P is bounded. In this case, therefore, the part of F astLs that determines the S-function is a full algorithm.

Remark 2.9. The fact that h|P2, f = x h and g|(xP1 + P3) (see theorem 2.2, case (ii)) does not imply that f = cP2 and that g = −c (P1 + zP3) (c constant). If the polynomials P2 and (xP1 + P3) have a polynomial factor in common, the F astLs algorithm may lose this case.

30 3. The LeapS1ode Package In this section we will present a Maple implementation of the algorithms 2.1 and 2.2 (with some modifications in order to improve flexibility and prac- ticality). Summary of the commands:

• Dx constructs the Dx operator (total derivative over the solutions) as- sociated with the 1ODE.

• Xi constructs the χ operator associated with the 1ODE.

• Tr1ode applies a transformation to the 1ODE and returns the trans- formed 1ODE and the inverse transformation.

• Ode2 tries to determine the 2ODE associated with the vector field χ.

• Sfunction tries to determine a S-function associated with the vector field χ.

• Ode1a determines the rational 1ODE associated with the 2ODE (from the knowledge of a S-function).

• Hfunction tries to find the general solution for an associated rational 1ODE.

• PDEassol constructs and tries to solve the 1PDEs that relate the first integral I with the H-functions.

• Solde tries to determine a Liouvillian general solution of the 1ODE from solving the associated 1PDE.

3.1. Package commands Here we present a description of the main commands of the LeapS1ode package.

31 3.1.1. Command: Dx Feature: This command returns the operator Dx (total derivative over the solutions). Calling sequence: [> Dx(ode); Parameters: ode - The 1ODE.

Synopsis: The command Dx returns the total derivative operator over the solutions of ′ the 1ODE, i.e., the operator dx = ∂x + y ∂y restricted to bound I(x, y)= c (the solution-curves). Since, over the solutions y′ = φ(x, y) this implies that

′ ′ dy D =(∂ + y ∂ )| ′ = ∂ + φ ∂ , y = . (126) x x y y =φ x y dx  

3.1.2. Command: Xi Feature: This command returns the vector field χ. Calling sequence: [> Xi(ode); Parameters: ode - The 1ODE. Extra parameters: FGH - If this parameter is present in the command call then the com- mand returns a list: [f,g,h]. Synopsis: The command Xi returns the vector field χ associated with the 1ODE, i.e., the command returns an operator u → f ∂x(u)+ g ∂y(u)+ h ∂z(u), where f, g and h are polynomials given by (24,25,26). If the extra parameter FGH is present in the entries then the command returns a list with the polynomials f, g and h:[f,g,h].

32 3.1.3. Command: Tr1ode Feature: This command returns the transformed 1ODE and the inverse trans- formation.

Calling sequence:

[> Tr1ode(ode);

Parameters: ode - The 1ODE.

Extra parameters: TR=[x=F(x,y),y=G(x,y)] - Where [x=F(x,y),y=G(x,y)] is an in- vertible transformation. The default is the identity transformation.

Synopsis: The command Tr1ode returns a list with two entries: the transformed 1ODE and the inverse transformation of TR. If the inverse transformation cannot be obtained, the command returns only the 1ODE transformed. If no transfor- mation is provided, the default is the identity transformation.

3.1.4. Command: Ode2 Feature: This command returns the 2ODE(s) associated with the 1ODE.

Calling sequence:

[> Ode2(ode);

Parameters: ode - The 1ODE.

Extra parameters: PS - If this parameter is present in the command call, then the com- mand returns the polynomials P1, P2 and P3:[P1,P2,P3].

Synopsis:

33 The command Ode2 returns the function Φ(x, y, z)= M0(x, y, z)/N0(x, y, z) of the 2ODE associated with the 1ODE. This 2ODE is one of six possible 2ODEs, namely, the one that considers x as the independent variable, y as the dependent variable and z as the first derivative. If the extra parameter PS is present in the entries then the command returns a list with the polynomials P1, P2 and P3:[P1,P2,P3].

3.1.5. Command: Sfunction

Feature: This command tries to find the S-function S1.

Calling sequence:

[> Sfunction(ode);

Parameters: ode - The 1ODE.

Extra parameters: Deg = n - Where n is a positive integer denoting the degree of the polynomial P (the numerator or denominator of S1). The default is 3. DegMNP = [degM,degN,degP] - Where [degM,degN,degP] is a list with the degrees of the candidates for M0, N0 and P2, respectively. Den = deno - Where deno is the denominator (presumed) of the S- function.

Synopsis: The command Sfunction tries to find a S-function associated with the rational 2ODE (Φ = M0/N0) through a Liouvillian first integral I. The command computs (if possible) the rational function S1 or a polynomial P that is the numerator (or denominator) of S1 (this case only if we are using the F astLs algorithm). The S-function is the basis for finding the Liouvillian first integral of the vector field χ associated with the 1ODE (see section 2.1). In the case where the numerator or the denominator of S1 is (presumed) one of the polynomials {f,g,h}, we can use the parameter Deg to inform the program of the degree we will use for the candidate Pc. Associated with this case we have also the parameter Den that can acelerate the process by

34 indicating the numerator (or denominator – this case only if we are using the F astLs algorithm) of S1. In the case where none of the polynomials {f,g,h} is the numerator (or denominator) of S1, we use the parameter DegMNP which is, actually, a list with three integers [degM,degN,degP] that tell the command the degree of candidates Mc, Nc and Pc, respectively.

3.1.6. Command: Ode1a Feature: This command determines the associated 1ODE.

Calling sequence:

[> Ode1a(ode);

Parameters: The same as above. Extra parameters: The same as above and:

SF = S1 - Where S1 is a S-function S1.

Synopsis: The command Ode1a uses the S-function to construct the associated 1ODE. The first extra parameters are the same of the Sfunction command and the last extra parameter (SF = S1) allows the user to pass the S-function S1 to the Ode1a command.

3.1.7. Command: Hfunction Feature: This command tries to find the solution of the associated 1ODE.

Calling sequence, parameters and extra parameters: Same as above.

3.1.8. Command: PDEsol Feature: This command constructs and tries to solve the 1PDE that relates the H-function to the first integral I.

Calling sequence, parameters and extra parameters: Same as above.

35 3.1.9. Command: Solde Feature: This command tries to find a Liouvillian general solution for the 1ODE (or, equivalently, first integral of the vector field χ ). It returns a I(x, y, θ)= c, where θ is an elementary function of (x, y).

Calling sequence: [> Solde(ode);

Parameters: The same as above. Extra parameters: The same as above and: II - If this parameter is present in the command call, then the com- mand returns a list with the Liouvillian first integral of the vector field χ and the z → θ transformation: [I(x, y, z), z = θ(x, y)].

Synopsis: The command Solde is the final part of the process, i.e., it returns (if possible) the general solution of the 1ODE. With the parameter II the user can make the command to return the first integral of the vector field χ (together with z → θ transformation).

Remark 3.1. The extra parameters are not mandatory – some are even redundant. For example, if we are to provide the S-function we do not need to provide the degree of the polynomial candidate Pc. If these redundant parameters are supplied simultaneously, the package will take care of doing (hopefully) the best choice.

3.2. Example of the usage of the package commands In this section we will show the commands of the LeapS1ode package simulating its use on a Maple platform to exemplify in a practical way its operation. Consider the 1ODE (example presented in the section 2.3)

dy exx3y2 + exx2y2 + 2 exx2y + exxy + exx + y2 + ex = . (127) dx x2y2 + exx2 + xy +1 After opening a Maple session, we will load the following packages:

36 [> with(DEtools): read(‘LeapS1ode.txt‘):

The : sign after the command line avoids printing (on-screen) of the result. The DEtools package loads several commands to handle ODEs. The read (‘LeapS1ode.txt‘): command loads our package. We will load 1ODE (127) by typing

[> _1ode := diff(y(x),x) = (exp(x)*x^3*y(x)^2+exp(x)*x^2*y(x)^2 +2*exp(x)*x^2*y(x)+exp(x)*x*y(x)+exp(x)*x+y(x)^2+exp(x))/(x^2*y (x)^2+exp(x)*x^2+x*y(x)+1):

First, we can find the associated vector field:

[> X := Xi(_1ode): [> fgh := Xi(_1ode,FGH);

The command X := Xi( 1ode): assigns X as the vector field and fgh := Xi( 1ode,FGH); assigns fgh as a list with its coefficients [f,g,h]: fgh := [x2y2 +zx2 +xy+1, zx3y2 +zx2y2 +2 zx2y+zxy+zx+y2 +z, z x2y2+

zx2 + xy +1 ]

We can find the S-function S1 by typing  [> S1 := op(Sfunction(_1ode,Deg=5)); x2y2 + x2z + xy +1 S1 := − (128) x (xy + 1)2

From S1 we can determine the associated 2ODE: [> M0N0 := Ode2(_1ode,SF=S1);

M0N0 := [(zx − y)(zx + y) , x (xy + 1)2] (129)

[> _2odeas := M0N0 [1]/M0N0 [2]; (zx − y)(zx + y) 2odeas := (130) x (xy + 1)2

In order to obtain the polynomials P1, P2 and P3, we simply add the para- meter PS to the entry of the Ode2 command:

37 [> PPP := Ode2(_1ode,SF=S1,PS); PPP := [zx2y2 + zxy + y2 + z, −x2y2 − zx2 − xy − 1, x (xy + 1)2] (131)

Using the function S1 we can (by applying the S-function method – see [3]) find the first integral of the vector field χ (by applying the command Solde with the parameter II): [> Inv := Solde(_1ode,SF=S1,II); −1 Inv := [e(xy+1) (zx − y) , z = ex] (132) Finally, we can (by doing the substitution z → θ or apllying directly the Solde command) obtain the general solution of the 1ODE (127): [> sol1ode := Solde(_1ode,SF=S1); −1 sol1ode := e(xy+1) (exx − y)= C1 (133) We can now test the solutions found: [> DX := Dx(_1ode): [> X(Inv[1]); [> DX(lhs(sol1ode)); 0 0

4. Performance The analysis presented in this section is divided in three parts10: • In the first subsection, we solve (with our package) a set of 1ODEs that we could not solve using the traditional methods (and even non- traditional methods) implemented in the Maple computer algebra sys- tem (Maple CAS). • In the following, we present the special features of the LeapS1ode in action, to solve more complex 1ODEs. • Finally, we present an example of a 1ODE with parameters. In that case we use the integrability analysis provided by using the Par parameter in the Sfunction command.

10In this paper all the computational data (time of running etc) was obtained on the same computer with the following configuration: Intel(R) Core(TM) i5-8265U @ 1.8 GHz.

38 4.1. A set of ‘hard’ 1ODEs In this section we present a set of 1ODEs which the powerful methods implemented in the Maple ODE solver (release 17) – dsolve command – cannot solve. Bellow, we show the CPU time and memory that the package LeapS1ode spends to find the solutions (through the use of Solde command). Consider the following 1ODEs: 1. The following five 1ODEs have an elementary Liouvillian solution. We will refer to them as 1ODEs 1, 2, 3, 4, 5:

dy x 2 (ln (x))2 x4y2 + 2 ln (x) x2y + 2 ln (x) y2 − yx2 + y2 +2 = 2 4 2 4 2 dx (ln (x)) x y + ln (x) x + ln (x) x y +1  (134)

dy 3 (ex)2x4y4 +(y4 −y3x4 −x3y3 +6 x3y2 + xy4) ex +3 x2 = (135) dx (ex)2 x2y4 +(x4y2 − xy3 +2 xy2) ex − x3 + y +1

dy (2 x3y4 − 4 x2y2 − x2 + ln (y)+2 x) y = − (136) dx −2 x4y2 − x2y4 + 2 ln (y) x2y2 +2 xy2 − 1

dy 3 (ey)2 x4y2 − 7 eyx3y +3 x2 − y = − (137) dx x (ey)2 x4y2 − 3 eyx3y − x3ey + x2 − y − 1 dy 4 x3y6 +8 x4y3 +4 x5 − x4 + cos(y)  = − (138) dx (y6 +2 xy3 + x2) sin (y) − 3 x4y2 +3 cos(y) y2

2. The following five 1ODEs have a non-elementary Liouvillian solution. We will refer to them as 1ODEs 6, 7, 8, 9, 10.

dy (2 x2 − y) (ln (x) y2 − x2y − 1) y = dx x (ln (x))2 y3 − ln (x) x2y2 − (ln (x))2 y2 + 2 ln (x) x2y − x4 − ln (x) y (139) 

dy (ln (x))2 xy2 − 2 ln (x) x2y − ln (x) xy + ln (x) y2 + x3 = − (140) dx x (ln (x))2 y

39 dy (−e2 xx6y2 − 2 e2 xx5y2 + e2 xx4y2 + exx4y + 3 exx3y +1)e−x = dx x3 (exx3y − x − 1) (141)

dy (ln (y))2 xy4 − (ln (y))2 y4 − x2 ln (y) y2 + ln (y) xy2 + x3 = − dx xy (2 ln (y) + 1) (ln (y) y2 − x2 − x) (142)

dy y3 (−xy3 + ey + 1) = (143) dx eyx2y6 +3 x2y5 − 2 eyxy3 − 3 eyxy2 − 3 xy2 + ey

Applying the Solde command to each one of them, we have:

[> t0 := time(): solde[1] := Solde(_1ode[1],Deg=7); time()-t0; ln (x2 − y) ln (x) x2y + ln (x2 − y)+1 solde[1] := − = C1 ln (x) x2y +1 0.563

[> t0 := time(): solde[2] := Solde(_1ode[2],Deg=7); time()-t0;

xy2ex +1 solde[2] := − = C1 ex ln (x3 − y) xy2 + ln (x3 − y)+ y 1.078

[> t0 := time(): solde[3] := Solde(_1ode[3],Deg=5); time()-t0;

x 2 solde[3] := −x + ln (y) e xy2−1 = C1 0.209 

[> t0 := time(): solde[4] := Solde(_1ode[4],Deg=5); time()-t0;

40 eyxy ln (x3ey + 1) − ln (x3ey +1)+1 solde[4] := − = C1 xyey − 1 0.625

[> t0 := time(): solde[5] := Solde(_1ode[5],Deg=7); time()-t0;

−iy4 − iyx +1 solde[5] := ln −2 eiyx4 + e2 iy +1 + = C1 y3 + x 3.687 

[> t0 := time(): solde[6] := Solde(_1ode[6],Deg=5); time()-t0;

− − − 2 1 Ei 1, − (ln (x) y − x2) 1 y + e(ln(x)y x ) solde[6] := − = C1  y  0.203

[> t0 := time(): solde[7] := Solde(_1ode[7],Deg=7); time()-t0;

− −1 −1 solde[7] := Ei 1, (ln (x) y − x) 1 e(ln(x)y−x) + x e−(ln(x)y−x) = C1  0.218 

[> t0 := time(): solde[8] := Solde(_1ode[8],Deg=9); time()-t0;

− −1 x 2 − 1 solde[8] := Ei 1, − exx2y − 1 x + e(e x y 1) x−1 = C1   0.687  

[> t0 := time(): solde[9] := Solde(_1ode[9],Deg=6); time()-t0; x 2 x solde[9] := x eln (y) y − x + Ei 1, − = C1 ln (y) y2 − x   0.437

41 [> t0 := time(): solde[10] := Solde(_1ode[10],Deg=6); time()-t0;

− − − 3− 1 −1 3− 1 e (xy 1) Ei 1, − xy3 − 1 + ey e(xy 1) = C1   0.297   1ODE Time (sec.) Memory (MB) 1 (134) 0,672 21,07 2 (135) 1,078 35,60 3 (136) 0,209 4,18 4 (137) 0,625 33,18 5 (138) 3,687 28,47 6 (139) 0,329 17,41 7 (140) 0,218 16,18 8 (141) 0,687 21,26 9 (142) 0,437 29,86 10 (143) 0,297 18,42

Remark 4.1. Some comments: • When we start a Maple session, the simple loading of the basic pac- kages that are activated with the opening of the program’s standard platform already uses 4.18 MB. So, when that number appears (in the table above), the meaning is basically ‘almost no memory expenditure’. • For the measurement of consumed CPU time, a similar problem occurs: the time measurement provided is ‘variable from session to session’. However, the number representing the time spent is always reasonably close to the average of the values obtained in different rounds. In the data placed in the table above, we avoid averaging over many sessions (which means that the last two digits are not significant) because we were focused on a more qualitative result. • Another piece of information (quite relevant for those who don’t fre- quently use the Maple command dsolve) is that the memory consumed in each one of the ten 1ODEs is relatively low. • Another interesting detail is that most of the time consumed (even in cases where the time consumed is very short) is generally used in de- termining the S-function, that is, in addition to validating our method, the previous result is also a reaffirmation of the S-function method.

42 • Finally, looking at the table below, we can see why these 1ODEs cause difficulties for the vast majority of methods. We only need to pay atten- tion to the Lie symmetries or to the integrating factors of the 1ODEs’ set. We see that only 1ODEs 3, 5 and 10 have integrating factors in which the θ function is absent (and, even so, they are not simple).

1ODE Symmetry (ν) Integrating Factor 2 −1 (x2y ln(x)+1)2 e(x y ln(x)+1) 1 (134) − 2 −1 2 2 e(x y ln(x)+1) ((ln(x))2x4y2+ln(x)x4+x2y ln(x)+1) (x y ln(x)+1) −y y 2 x 2 xy2ex+1 2 x 2 (135) − (xy e +1) e e xy e +1 (ex)2x2y4+exx4y2−exxy3+2 xy2ex−x3+y+1 (xy2ex+1)2 −x x 2− 2 xy2−1 2− 3 (136) (xy 1) y e − e xy 1 −2 x4y2−x2y4+2 ln(y)x2y2+2 xy2−1 y (xy2−1)2 y −1 y −1 y− 2 (1−xye ) (xye −1) y 4 (137) (xye 1) e −e e eyx((ey)2x4y2−3 eyx3y−x3ey+x2−y−1) (xyey−1)2 3 −1 − 3 2 (−y −x) (y3+x) 1 5 (138) (y +x) e −e (sin(y)y6−3 x4y2+2 sin(y)xy3+3 cos(y)y2+sin(y)x2) (y3+x)2 2 −1 − − 2 2 2 (x −ln(x)y) (ln(x)y−x2) 1 6 (139) (ln(x)y x ) y e −e (ln(x))2y3−ln(x)x2y2−(ln(x))2y2+2 ln(x)x2y−x4−ln(x)y (ln(x)y−x2)2xy2 −1 (ln(x)y−x)2 −e−(ln(x)y−x) 7 (140) − e−(ln(x)y−x) 1 (ln(x))2 y (ln(x)y−x)2 x x 3 − x 3 − e x y x+1 e x y−x+1 exx2y−1 x 2 − 2 x 2 − 8 (141) e (e x y 1) −e e x y 1 x (exx3y−x−1) x2(exx2y−1)2 − x x ln(y)y2−x 2− 2 y y2−x 9 (142) e (ln(y)y x) −e ln( ) y (2 ln(y)+1) (ln(y)y2−x2−x) (ln(y)y2−x)2 x 3 −1 − −(xy −1) 3− 2 (xy3−1) 1 10 (143) e (xy 1) −e eyx2y6+3 x2y5−2 eyxy3−3 eyxy2−3 xy2+ey (xy3−1)2 Remark 4.2. For all 1ODEs in Kamke’s book [49] that obey the conditions of application of the algorithm our method does very well in all cases. As they are much simpler cases than those shown in the table, we decided not to include them in order not to increase the presentation unnecessarily.

4.2. Special features As we can see, in the ten 1ODEs shown in the section 4.1 we have that θ is a function of only one variable (x or y). In these cases, as shown in the section 2.4 (theorem 2.2), we can use an improvement that allows us to calculate only one polynomial instead of two (F astLs algorithm). However, due to some technical details, we decided to leave the first part of the F astLs algorithm in the hands of the package user. In this section we will show you

43 how to use the commands in the package to achieve the solution in more difficult cases. Consider the 1ODE given by:

2 3 x5y2 − 6 ln x x4y +3 ln x x3 − x4y + x3 + xy2 − y y dy y y =   .      2 dx 4 2 3 x 2 x 3 2 x x y + x y − 2 ln y xy + ln y y + x − xy − y       (144) After loading the package and the 1ODE (144), we can try (first) to find the S-function using the Sfunction command. However, if we type [> t0 := time(): S1 := op(Sfunction(_1ode,Deg=7)); time()-t0; we get 1 S1 := (145) y 11.812 after ≈ 12 seconds (and spending 215 MB of memory). However, if we type [> sol := Solde(_1ode,SF=S1); The output is sol := (146) which would probably leave us intrigued, because as the S-function is simple the method should have found the solution. What is actually happening is that the following invariant is found for the vector field associated χ: I = − ln(x)+ln(y)+z. Now, if we pay attention to the fact that the function θ present in 1ODE is θ = ln(x/y), making the substitution z → θ we will obtain I = − ln(x) + ln(y) + ln(x/y) = 0 that represents the identity θ = ln(x/y) (and therefore, as it is not an answer to what we seek, the program discards it). We can try using the parameter DegMNP which is, actually, a list with three integers [degM,degN,degP] which gives to the Sfunction command the degrees of the polynomials that are candidates for M0, N0 and P2. This, however, results in a very large consumption of resources and on a memory ‘overflow’. However, we can still succeed using the command Tr1ode to transform the 1ODE (144) into an 1ODE such that θ is a function of just one variable. We can do this by typing (for example)

44 [> _1odetr := Tr1ode(_1ode,TR=[x=x*y,y=y]); and obtaining a transformed 1ODE given by: dy −y 3 x5y6 − 6 x4 ln (x) y4 − x4y4 +3 x3 ln (x)2 y2 + x3y2 + xy2 − 1 = 6 6 5 4 5 4 4 2 2 3 4 2 2 2 2 2 dx 3x y −6x ln(x)y −2x y +3x ln(x) y −x y +2ln(x)x y +2x y −xln(x) (147) So, in the transformed 1ODE, we have that θ = ln(x). Now, we can apply again the command Sfunction (and, in this case, using the F astLs algo- rithm)

[> t0:=time(): s1tr := Sfunction(_1odetr[1],Deg=11); time()-t0; that returns us 3x5y6 −6x4zy4 −2x4y4 +3x3y2z2 −x2y4 +2zxy2 +2xy2−z2 s1tr := (148) y (x3y2 − 1)   2.375 i.e., the algorithm finds the S-function in less than 3 seconds (and consuming only 30 MB). At this point, we just have to type

[> soltr := Solde(_1odetr[1],ST=op(s1tr)); to obtain the general solution of the transformed 1ODE (147) in 0.3 seconds:

−xy2ln(x3y2 −1)−xy2ln(y)+ln(x) ln(x3y2 −1)+ln(x) ln(y)−1 soltr := = C1 xy2 − ln (x) (149) and

[> Itr := Solde(_1odetr[1],ST=op(s1tr),II); to obtain the first integral of the transformed vector field:

xy2ln(x3y2 −1)+xy2ln(y)− z ln(x3y2 −1)− z ln(y)+1 Itr := , z = ln(x) −xy2 + z  (150) The command Tr1ode returns (as second output) the inverse transformation. So, by typing

45 [> itr := _1odetr[2]: [> Ior := subs(itr,Itr[1]); we obtain the first integral of the vector field associated with the 1ODE (144):

x3 x3 xy ln y − 1 + xy ln (y) − z ln y − 1 − z ln (y)+1 Ior := (151)   z − yx   We can check this with [> X := Xi(_1ode): [> X(Ior); 0 Finally, doing the substitution z → ln(x/y), we find the general solution of the original 1ODE (144): [> DX := Dx(_1ode): [> sol := subs(z=ln(x/y),Ior=_C1); [> DX(Ior);

x3 x x3 x xy ln y − 1 + xy ln (y) − ln( y ) ln y − 1 − ln( y ) ln (y)+1 sol := = C1   x   ln( y ) − yx (152) 0

4.3. Integrability analisys In addition to the features shown above, we will present in this sec- tion a very useful way to apply the LeapS1ode package: the Par parameter. When we are studying an ODE presenting parameters, we can use the para- meter Par in the entries of the Sfunction command. Thus, if the command was unable to find a S-function for generic parameter values, the entry Par = {α,β, ...} tells the command to try to find a S-function for some relati- onship between them, i.e., the method brings us the possibility of an analysis of the integrability region of the 1ODE’s parameters.

To see a real case of using the package in the search for integrability regions in terms of Liouvillian functions (closed solutions), let’s take as an

46 example an 1ODE obtained from the study of 2ODEs that model nonlinear oscillation phenomena. In our case, the 1ODE we are going to present appe- ars in the reduction of a Levinson-Smith equation11 [50]

x¨ + F (x, x˙)x ˙ + G(x)=0, (153) a 2ODE that is a generalization of the Li´enard equation 12 [52]

x¨ + F (x)x ˙ + G(x)=0. (154)

As 2ODE (153) does not explicitly depend on time, we can do the following coordinate transformation to reduce its order: x = x, x˙ = y, (155)  dy  x¨ = dx y. The application of this transformation to the 2ODE (153) leads to the 1ODE given by dy F (x, y) y + G(x) = − . (156) dx y We can now, from very generic F and G functions, try to obtain integrable cases in terms of Liouvilian functions (i.e., closed form solutions). Let’s analyze the following case:

dy −fx2yex − ex2ex − xexyb − y2c − dx − ya = (157) dx y Applying the Sfunction command and using the parameter Par as assigned below

[> _1ode := diff(y(x),x)= \cdots: [> ss1 := [Sfunction(_1ode,Par={b,d,e},DegMNP=[6,4,5])]: [> for i from 3 by 3 to nops(ss1) do for j to nops(ss1[i]) do

11The Levinson-Smith equation has applications in astrophysics [51]. 12There is a vast literature on the use of this equation to model various phenomena: ranging from electrical circuits, study of heartbeat, neuron activity, chemical kinetics to turbulence phenomena [53, 54, 55, 56].

47 print([i,j],______,traperror(factor(subs(ss1[i][j], ss1[i-2]))),subs(ss1[i][j],[‘b=‘,b,‘c=‘,c,‘d=‘,d,‘e=‘,e,‘f=‘,f])); trys[i,j]:=traperror(factor(subs(ss1[i][j],ss1[i-1][1]/ss1[i-1][2]))); print(trys[i,j]); end do; end do; we obtain13 . . cz [3, 4], , − [‘b = ‘, b, ‘c = ‘, c, ‘d = ‘, 0, ‘e = ‘, 0, ‘f = ‘, f] cy + a (cfx2z + bcxz + c2y + ac + cy + cz + a) z cy + a . . Using the determined region on 1ODE (157) we finally obtain [> new1ode := subs(ss1[3][4],_1ode); d −fx2y (x) ex − xexy (x) b − (y (x))2 c − y (x) a y (x)= dx y (x) (158) that can be solved with [> s1 := ss1[1]; [> new1ode := subs(ss1[3][4],_1ode); [> Solde(new1ode,SF=s1): cz − cy + a d −fx2y (x) ex − xexy (x) b − (y (x))2 c − y (x) a y (x)= dx y (x) Rearranging the solution we have

f ex (c + 1)2 x2 − 2 (c + 1) x +2 b ex ((c + 1) x − 1) a y = − 3 − 2 − + C1 (c + 1)  (c + 1) c !

13We omit the full output because it is too long.

48 Replacing y with z and x with y, we will obtain the first integral of the Levinson-Smith equation (for the parameter regions we find):

f ey (c + 1)2 y2 − 2 (c + 1) y +2 b ey ((c + 1) y − 1) a I = z + 3 + 2 + (c + 1)  (c + 1) c !

5. Conclusion

In this work we developed a new method to solve 1ODEs presenting an elementary function. Our procedure is applicable to 1ODEs that have a general Liouvillian solution and, in addition, it is restricted to 1ODEs that can be expressed in the following form: dy M(x, y, θ) y′ = = φ(x, y, θ)= (159) dx N(x, y, θ) where φ is a rational function of (x, y, θ) and θ is an elementary function of (x, y) (M and N are co-polynomials in (x, y, θ)). The method is based on a connection between an 1ODE with an elemen- tary function θ and a polynomial vector field in three variables. The main point is that, if this 1ODE has a Liouvillian general solution, we can associ- ate a rational 2ODE with the vector field and, therefore, use the S-function method (see [3]) to find a first integral for the vector field and (using the simple substitution z → θ) find the general solution of the 1ODE. One might consider that exchanging the problem of solving a 1ODE for the problem of finding a first integral of a 2ODE may not seem like a good idea at first. However, there are two facts that make this exchange result in a very efficient procedure: first, the 1ODE has an elementary function whereas the 2ODE is rational; second, the S-function method is effective in cases where the search for first integrals of 2ODEs by procedures such as the Lie symmetries method and Darboux approaches are particularly problematic. The method we developed first (Lsolv algorithm) was (in a first assess- ment) reasonably efficient compared to the more canonical alternative that would be to try a DPS approach or the Lie symmetry method. However, the appearance of an unexpected result, increased our work by far exceeding our expectations. These result (expressed in the theorems 2.2 and 2.3) allowed

49 the creation of the F astLS algorithm that, for a very comprehensive range of 1EDOs (the class LS - see the definition 2.2, performed very well. The algorithms Lsolv and F astLS were implemented in a computatio- nal package (LeapS1ode) on the Maple symbolic computing platform. The package, in addition to solving 1ODEs using the methods mentioned above, presents commands that materialize all stages of the process. The commands also make use of several parameters that help both in the search for solutions as well as in the research in physics and mathematics. Finally, due to the nature of the algorithm search process, we can perform an analysis of integrability regions for 1ODEs that present parameters (see the example in section 4.3).

Referˆencias

[1] L.G.S. Duarte, S.E.S.Duarte, L.A.C.P. da Mota and J.F.E. Skea, Exten- sion of the Prelle-Singer Method and a MAPLE implementation, Com- puter Physics Communications, Holanda, v. 144, n. 1, p. 46-62 (2002).

[2] J.Avellar, L.G.S.DuarteL.A.C.P.da Mota, PSsolver: A Maple implemen- tation to solve first order ordinary differential equations with Liouvillian solutions, Computer Physics Communications Volume 183, Issue 10, Oc- tober 2012, Page 2313

[3] J. Avellar, M.S. Cardoso, L.G.S. Duarte, L.A.C.P. da Mota Dealing with Rational Second Order Ordinary Differential Equations where both Darboux and Lie Find It Difficult: The S-function Method, Computer Physics Communications, 234, (2019) 302-314.

[4] J.-M. Hur´e, F. Hersant A new equation for the mid-plane potential of power law disks Volume 467 / No 3 (June I 2007) Astronomy & As- trophysica (A&A), 467 3 (2007) 907-910

[5] G. Darboux, M´emoire sur les ´equations diff´erentielles alg´ebriques du premier ordre et du premier degr´e(M´elanges), Bull. Sci. Math. 2`eme s´erie 2, 60-96, 2, 123-144, 2, 151-200 (1878).

[6] M. Prelle and M. Singer, Elementary first integral of differential equati- ons. Trans. Amer. Math. Soc., 279 215 (1983).

50 [7] M. Singer, Liouvillian First Integrals, Trans. Amer. Math. Soc., 333 673-688 (1992).

[8] C. Christopher, Liouvillian first integrals of second order polynomial differential equations, Electron. J. Differential Equations, 49, (1999), 7 pp. (electronic).

[9] L. Cair´oand J. Llibre, Darboux Integrability for 3D Lotka-Volterra sys- tems, J. Phys. A: Math. Gen., 33 2395-2406 (2000).

[10] C. Christopher, J. Llibre, C. Pantazi and X. Zhang, Darboux integrability and invariant algebraic curves for planar polynomial systems, J. Phys. A, 35, (2002) 2457–2476. https://doi.org/10.1088/0305-4470/35/10/310

[11] J. Chavarriga, H. Giacomini, J. Gin´eand J. Llibre, Darboux integrabi- lity and the inverse integrating factor, J. Differential Eqs., 194, (2003) 116–139. https://doi.org/10.1016/S0022-0396(03)00190-6

[12] J. Avellar, L.G.S. Duarte, S.E.S. Duarte, L.A.C.P. da Mota, Integrating First-Order Differential Equations with Liouvillian Solutions via Qua- dratures: a Semi-Algorithmic Method, Journal of Computational and Applied Mathematics 182, 327-332, (2005).

[13] AVELLAR, Jayr ; DUARTE, L G S ; Duarte, S.E.S. ; da MOTA, L. A. C. P. . Determining Liouvillian First Integrals for Dynamical Systems in the Plane. Computer Physics Communications, v. 177, p. 584-596, 2007. https://doi.org/10.1016/j.cpc.2007.05.014

[14] C. Christopher, J. Llibre and J.V. Pereira, Multiplicity of Invariant Al- gebraic Curves in Polynomial Vector Fields, Pacific Journal of Mathe- matics, 229, (2007) 63-117. https://doi.org/10.2140/pjm.2007.229.63

[15] C. Christopher, J. Llibre, C. Pantazi and S. Walcher, In- verse problems for invariant algebraic curves: Explicit com- putations, Proc. Roy. Soc. Edinburgh, 139, (2009) 287-302. https://doi.org/10.1017/S0308210507001175

[16] C. Christopher, J. Llibre, C. Pantazi and S. Walcher, Darboux integra- ting factors: inverse problems, J. Differential Equations, 250, (2011) 1-25. https://doi.org/10.1016/j.jde.2010.10.013

51 [17] X. Zhang, Liouvillian integrability of polynomial differen- tial systems, Trans. Amer. Math. Soc., 368, (2016) 607-620. https://doi.org/10.1090/S0002-9947-2014-06387-3

[18] A. Ferragut and H. Giacomini, A New Algorithm for Finding Rational First Integrals of Polynomial Vector Fields, Qual. Theory Dyn. Syst., 9, (2010) 89–99. https://doi.org/10.1007/s12346-010-0021-x

[19] A. Bostan, G. Ch`eze, T. Cluzeau and J.-A. Weil, Efficient algorithms for computing rational first integrals and Darboux polynomials of planar polynomial vector fields, Mathematics of Computation, 85, (2016) 1393- 1425. https://doi.org/10.1090/mcom/3007

[20] G. Ch`eze and T. Combot, Symbolic Computations of First Integrals for Polynomial Vector Fields, Foundations of Computational Mathematics, (2019). https://doi.org/10.1007/s10208-019-09437-9

[21] P.J. Olver, Applications of Lie Groups to Differential Equations, Springer-Verlag, (1986).

[22] N.H. Ibragimov, Elementary Lie Group Analysis and Ordinary Diffe- rential Equations, Wiley: Chichester, (1999).

[23] G.W. Bluman and S.C. Anco, Symmetries and Integration Methods for Differential Equations, Applied Mathematical Vol. 154, Springer- Verlag, New York, (2002).

[24] F. Schwarz, Algorithmic Lie Theory for Solving Ordinary Differential Equations, Chapman Hall / CRC – Taylor and Francis Group, (2008).

[25] E.S. Cheb-Terrab, L.G.S. Duarte and L.A.C.P. da Mota, Computer Al- gebra Solving of First Order ODEs Using Symmetry Methods. Com- put.Phys.Commun., 101, 254, (1997).

[26] E.S. Cheb-Terrab, L.G.S. Duarte and L.A.C.P. da Mota, Computer Al- gebra Solving of Second Order ODEs Using Symmetry Methods. Com- put.Phys.Commun., 108, 90, (1998).

[27] B. Abraham-Shrauner and A. Guo, Hidden Symmetries Associated with the Projective Group of Nonlinear First-Order Ordinary Differential Equations. J. Phys. A: Math.Gen., 25, 5597-5608, (1992).

52 [28] K.S. Govinder and P.G.L Leach, A group theoretic approach to a class of second-order ordinary differential equations not possesing Lie point symmetries. J. Phys. A: Math. Gen., 30, 2055-68, (1997).

[29] A.A. Adam and F.M. Mahomed, Non-local symmetries of first-order equations. IMA J. Appl. Math., 60, 187-98, (1998).

[30] M.S. Bruz´on, M.L. Gandarias and M. Senthilvelan, Nonlocal symmetries of Riccati and Abel chains and their similarity reductions. Journal of Mathematical Physics, 53, 023512 (2012).

[31] C. Muriel and J.L. Romero, New methods of reduction for ordinary dif- ferential equations, IMA J. Appl. Math., 66(2), 111-125, (2001).

[32] C. Muriel and J.L. Romero, C ∞-Symmetries and reduction of equations without Lie point symmetries, J. Lie Theory, 13(1), 167-188, (2003).

[33] E. Pucci and G. Saccomandi, On the reduction methods for ordinary differential equations. J. Phys. A: Math. Gen., 35, 6145-6155, (2002).

[34] M.C. Nucci, Jacobi Last Multiplier and Lie Symmetries: A Novel Ap- plication of an Old Relationship, Journal of Nonlinear Mathematical Physics, 12(2), 284-304, (2005).

[35] L.G.S. Duarte, S.E.S.Duarte and L.A.C.P. da Mota, A method to tackle first order ordinary differential equations with Liouvillian functions in the solution, in J. Phys. A: Math. Gen., 35 3899-3910 (2002).

[36] L.G.S. Duarte, S.E.S.Duarte and L.A.C.P. da Mota, Analyzing the Structure of the Integrating Factors for First Order Ordinary Differen- tial Equations with Liouvillian Functions in the Solution, J. Phys. A: Math. Gen., 35 1001-1006 (2002).

[37] J. AvellarL.G.S. Duarte, S.E.S.Duarte and L.A.C.P. da Mota, A semi- algorithm to find elementary first order invariants of rational second or- der ordinary differential equations, Appl. Math. Comp., 184 2-11 (2007).

[38] L.G.S. Duarte, S.E.S.Duarte, L.A.C.P. da Mota and J.F.E. Skea, Sol- ving second order ordinary differential equations by extending the Prelle- Singer method, J. Phys. A: Math.Gen., 34 3015-3024 (2001).

53 [39] M. Lakshmanan and S. Rajasekar, Nonlinear Dynamics: Integrability, Chaos and Patterns. New York: Springer-Verlag (2003).

[40] V.K. Chandrasekar, M. Senthilvelan and M. Lakshmanan, On the com- plete integrability and linearization of certain second order nonlinear or- dinary differential equations. Proceedings of the Royal Society London Series A, 461, Number 2060, 2005.

[41] L.G.S.Duarte and L.A.C.P.da Mota, Finding Elementary First Integrals for Rational Second Order Ordinary Differential Equations, J. Math. Phys., 50, (2009).

[42] L.G.S.Duarte and L.A.C.P.da Mota, Finding Elementary First Integrals for Rational Second Order Ordinary Differential Equations, J. Phys. A: Math. Theor. 43, n.6, (2010).

[43] P. R. Gordoa, A. Pickering and M. Senthilvelan, The Prelle-Singer method and Painleve hierarchies, J. Math. Phys., 55, 053510 (2014)

[44] A. K. Tiwari, S. N. Pandey, V. K. Chandrasekar, M. Senthilvelan and M. Lakshmanan, The inverse problem of a mixed Li´enard-type nonlinear oscillator equation from symmetry perspective, Acta Mechanica, 227, Issue 7, (2016) 2039–2051.

[45] R. Mohanasubha, V. K. Chandrasekar, M. Senthilvelan, M. Lakshma- nan Interplay of symmetries and other integrability quantifiers in finite- dimensional integrable nonlinear dynamical systems Proc. R. Soc. A., 472: 220150847 (2016). http://doi.org/10.1098/rspa.2015.0847

[46] C Muriel and J L Romero First integrals, integrating factors and λ- symmetries of second-order differential equations Journal of Physics A: Mathematical and Theoretical, 42, Number 36

[47] C Muriel and J L Romero Contribution to the Special Issue “Symmetries of Differential Equations: Frames, Invariants and Applications” Nonlo- cal Symmetries, Telescopic Vector Fields and λ-Symmetries of Ordinary Differential Equations SIGMA 8 (2012), 106

[48] J.H. Davenport, Y. Siret and E. Tournier, Computer Algebra: Systems and Algorithms for Algebraic Computation. Academic Press, Great Bri- tain (1993).

54 [49] E. Kamke, Differentialgleichungen: L¨osungsmethoden und L¨osungen, Chelsea Publishing Co, New York (1959).

[50] N. Levinson and O. Smith, A general equation for relaxation oscillations, Duke Mathematical Journal, 9, (1942), 382-403.

[51] Z. Ran, One exactly soluble model in isotropic turbulence, Advances and Applications in Fluid Mechanics, 5, (2009), 41-47.

[52] A. Li´enard, Revue g´en´erale de l’´electricit´e, 23, (1928), 901- 912, 946- 954.

[53] B. van der Pol, On relaxtion-oscillations, The London, Edinburgh and Dublin Philosophical Magazine and Journal of Science, 2, (1927) 978- 992.

[54] B. van der Pol and J. van der Mark, The heart beat considered as a relaxation oscillations and an electrical model of the heart, The London, Edinburgh and Dublin Philosophical Magazine and Journal of Science, 6, (1928), 763-775.

[55] F. Fitzhugh, Impulses and physiological states in theoretical models of nerve membranes, Biophysics Journal, 1, (1961), 445-466.

[56] S. H. Strogatz, Nonlinear Dynamics and Chaos, Addison-Wesley, Rea- ding, Massachussets, (1994).

55