6.5.1 Instructions and examples using the Kovacic package

The Kovacic class is included in the file KOV.mpl and the Kovacic testsuite module is in the file kovacic_tester.mpl. These two files accompany the arXiv version of this paper.

To use these, download these two files to some directory at your computer. For example, on windows, assuming the files were downloaded to c:/my_folder/, then now start Maple and type

read "c:/my_folder/KOV.mpl" 
read "c:/my_folder/kovacic_tester.mpl"

The above will load the kovacic_class and the testsuite module. Once the above is successfully completed, then to solve an ode the command is

ode  := diff(y(x),x$2)+diff(y(x),x)+y(x)=0; 
o    := Object(kovacic_class,ode,y(x)); #create the object 
sol  := o:-dsolve();

The above command will automatically try all the cases that have been detected one by one until a solution is found. If no solution is found, it returns FAIL. To verify the solution, the command is

if sol<>FAIL then 
   odetest(sol,ode); 
fi;

Which returns \(0\) if the solution is correct.

A note on the type of ode’s supported: it is recommenced to use only ode’s with numeric coefficients and not symbolic coefficients. This is because the Kovacic algorithm needs to decide if the degree \(d\) of the polynomial \(p(x)\) is non-negative or not. If some of the coefficients are purely symbolic, then it can fail to decide this. An example of this is given in the original Kovacic paper as example 2 on page 14, which is to solve the Bessel ode \(y'' = \left (\frac {4 n^{2}-1}{4 x^{2}}-1\right ) y\). This will now return FAIL since the algorithm can not decide if \(d\) is non-negative integer without knowing any assumptions or having numerical value for \(n\). Replacing \(n\) by any half odd integer, then it can solve it as follows

ode :=diff(diff(y(x),x),x)=((4*n^2-1)/(4*x^2)-1)*y(x); 
n   :=-3/2; 
o   := Object(kovacic_class,ode,y(x)); 
sol := o:-dsolve();

To solve an ode using specific case number, say case \(2\), the command is

ode   := ...; 
o     := Object(kovacic_class,ode,y(x)); 
sol   := o:-dsolve_case(2);

If the ode happened to satisfy cases \(1\) and \(2\) for an example, then the above command will only use case \(2\) to solve it and will skip case \(1\). If the command o:-dsolve() was used instead, then the ode will be solved using case \(1\) instead as that is the first one tried. Case \(2\) will only be tried is no solution is found using case \(1\).

The object created above, named as “o”, has additional public methods that can be invoked. The following is description of all public methods available.

To run the full testsuite of \(3000\) ode’s that comes with the package, the command is

kovacic_tester:-unit_test_main_api(); 
                   "Test ", 6735, " PASSED " 
                   "Test ", 6736, " PASSED " 
                   "Test ", 6737, " PASSED " 
                             . 
                             . 
                   "Test ", 7579, " PASSED " 
                   "Test ", 7580, " PASSED " 
                   "Test ", 7581, " PASSED "

To run testsuite using specific cases only, the commands are

kovacic_tester:-unit_test_case_1(); 
kovacic_tester:-unit_test_case_2(); 
kovacic_tester:-unit_test_case_3();