Chapter 2
Examples of SQL commands

 2.1 Find rowid of all intergals that rubi scored grade A and Mathematica scored B
 2.2 Obtain the leaf size of the integrals in above example
 2.3 Find the optimal and its leaf size in the first test file only
 2.4 Find all integrals with optimal antiderivative that has the function polylog
 2.5 Find all integrals with optimal antiderivative that has FresnelS or FresnelC
 2.6 Find the integral with the most used Rubi steps used to solve it.
 2.7 Find the integrals with the most used Rubi rules to solve it
 2.8 Find the integral with the largest optimal leaf size
 2.9 Find the integrals which used one Rubi step to solve
 2.10 Find the integrals which used two Rubi step to solve
 2.11 Find the integrals which used four Rubi step to solve and shows the rules used
 2.12 Find the integral with most uses rubi number of steps
 2.13 Find how all CAS system scored on the above problem
 2.14 Find the maximum number of rules Rubi used on a problem
 2.15 Find how many problems used this maximum number of rules
 2.16 Find the problem with max leaf size of the optimal solution
 2.17 Find the problem with max leaf size of the optimal solution
 2.18 Find the leaf size of solutions of all other CAS system for the above problem
 2.19 Display the above problem
 2.20 Find how many problem Fricas uses special functions Frensel
 2.21 Find how many problem Fricas uses Weierstrass special functions
 2.22 Find how many problem Maple uses Frensel
 2.23 Find number of integral solved by a CAS

The following section gives examples of SQL commands on the CAS integration tests database. In these examples rowid is the main unique key for each row in the table. There is one row per integral. So total number of rows is 85479 (when fully build). Basically any valid SQL command can be used to query the test results.

2.1 Find rowid of all intergals that rubi scored grade A and Mathematica scored B

sqlite> select rowid from main where rubi_grade="A" and mma_grade="C"; 
41 
98 
113 
175 
176 
179 
181 
....
 

2.2 Obtain the leaf size of the integrals in above example

sqlite> select mma_leafsize,rubi_leafsize from main where 
            rubi_grade="A" and mma_grade="C"; 
34|172 
37|22 
24|21 
17|103 
....
 

2.3 Find the optimal and its leaf size in the first test file only

sqlite> select optimal_leaf_size,optimal_in_maple from main 
           where input_file_number=1; 
13|1/3*(1+2*x)^(3/2) 
18|-2/27*(1+3*x)^(3/2)+2/45*(1+3*x)^(5/2) 
21|2/3*(1+x)^(3/2)-4/5*(1+x)^(5/2)+2/7*(1+x)^(7/2) 
18|2/27*(2-3*x)^(3/2)-4/9*(2-3*x)^(1/2) 
14|-1/4/(x^2+2*x+2)^2 
....
 

2.4 Find all integrals with optimal antiderivative that has the function polylog

Find all integrals with optimal antiderivative that has the function polylog in them, and show the file number and the integral number in that file.

sqlite> select input_file_number,integral_number_in_file, 
            command_in_sage,optimal_in_maple from main where 
            optimal_in_maple LIKE '%polylog%'; 
|156|integrate(log(t)/(1+t),t, algorithm="fricas")|ln(t)*ln(1+t)+polylog(2,-t) 
2|7|....
 

2.5 Find all integrals with optimal antiderivative that has FresnelS or FresnelC

Find all integrals with optimal antiderivative that has FresnelS or FresnelC in the optimal, and show the file number and the integral number in that file.

sqlite> select input_file_number,integral_number_in_file, 
               command_in_sage,optimal_in_maple from main where 
               optimal_in_maple LIKE '%FresnelS%' OR'%FresnelC%'; 
2|4|integrate(sin(x)/(1+x)^(1/2),x, algorithm="fricas")|cos(1)*FresnelS(2^(1/2)/Pi^(1/2)*(1+x)^(1/2))*2^(1/2)*Pi^(1/2)-FresnelC(2^(1/2)/Pi^(1/2)*(1+x)^(1/2))*sin(1)*2^(1/2)*Pi^(1/2) 
...
 

2.6 Find the integral with the most used Rubi steps used to solve it.

sqlite> select input_file_number,integral_number_in_file, 
               rubi_number_of_steps from main where 
               rubi_number_of_steps =(SELECT max(rubi_number_of_steps) from main); 
11|29|359
 

2.7 Find the integrals with the most used Rubi rules to solve it

sqlite> select input_file_number,integral_number_in_file, 
           rubi_number_of_rules from main where 
           rubi_number_of_rules =(SELECT max(rubi_number_of_rules) from main); 
2|6|9 
2|14|9 
4|23|9 
5|129|9 
7|4|9 
9|220|9 
9|235|9 
9|236|9 
10|114|9 
10|227|9 
10|259|9 
10|298|9 
10|398|9 
...
 

2.8 Find the integral with the largest optimal leaf size

sqlite> select rowid,input_file_name,input_file_number, 
               integral_number_in_file,optimal_leaf_size from main where 
               optimal_leaf_size =(SELECT max(optimal_leaf_size) from main); 
1509|0_Independent_test_suites/Timofeev_Problems.txt|10|446|6084 
... 
sqlite> select command_in_mma from main where rowid=1509; 
Integrate[(Sec[x]^2*Tan[x]*((1 - 3*Sec[x]^2)^(1/3)*Sin[x]^2 + 3*Tan[x]^2))/((1 - 3*Sec[x]^2)^(5/6)*(1 - Sqrt[1 - 3*Sec[x]^2])),x] 
 
sqlite> select rubi_time,rubi_grade,rubi_number_of_rules, 
           rubi_rules_used from main where rowid=1509; 
3.3722113|A|16|{4446, 6874, 6816, 267, 6829, 348, 59, 632, 210, 31, 6820, 272, 43, 65, 212, 25}
 

2.9 Find the integrals which used one Rubi step to solve

sqlite>select command_in_mma from main where rubi_number_of_steps=1; 
Integrate[(-1 + 2*x)^(-1) - (1 + 2*x)^(-1),x] 
Integrate[x/(1 - x^2)^5,x] 
...
 

2.10 Find the integrals which used two Rubi step to solve

sqlite>select command_in_mma from main where rubi_number_of_steps=2; 
Integrate[(-3 + x)*(-7 + 4*x^2),x] 
Integrate[(-7 + 4*x^2)/(3 + 2*x),x] 
...
 

2.11 Find the integrals which used four Rubi step to solve and shows the rules used

sqlite>select command_in_mma,rubi_rules_used from main where rubi_number_of_steps=4; 
Integrate[(a*x^2 + b*x^3)/(c*x^2 + d*x^3),x]|{1607, 1598, 45} 
Integrate[x^4/(4 + 5*x^2 + x^4),x]|{1136, 1180, 209} 
...
 

2.12 Find the integral with most uses rubi number of steps

sqlite> select rowid,input_file_number,integral_number_in_file,rubi_number_of_steps,rubi_number_of_rules,command_in_mma  from main where rubi_number_of_steps =(SELECT max(rubi_number_of_steps) from main); 
 
80438|210|5294|1980|17|Integrate[(-24*x^3*Log[20] + E^x*(x^3 - 2*x^4)*Log[20])/(-2641807540224*E^2 + 990677827584*E^(2 + x) - 165112971264*E^(2 + 2*x) + 16052649984*E^(2 + 3*x) - 1003290624*E^(2 + 4*x) + 41803776*E^(2 + 5*x) - 1161216*E^(2 + 6*x) + 20736*E^(2 + 7*x) - 216*E^(2 + 8*x) + E^(2 + 9*x)),x]
 

2.13 Find how all CAS system scored on the above problem

Find how all CAS system scored on the above problem (1 is pass, 0 is failed)

sqlite> select mma_pass,rubi_pass,maple_pass,fricas_pass,maxima_pass,mupad_pass,giac_pass,sympy_pass from main where rowid=80438; 
 
      1|1|1|1|1|1|1|1
 

So all solved it

2.14 Find the maximum number of rules Rubi used on a problem

sqlite> SELECT DISTINCT rubi_number_of_rules from main where rubi_number_of_rules =(SELECT max(rubi_number_of_rules) from main); 
 
   9
 

2.15 Find how many problems used this maximum number of rules

SELECT COUNT(*) from main where rubi_number_of_rules =9; 
 
   2364
 

2.16 Find the problem with max leaf size of the optimal solution

select rowid,optimal_leaf_size from main where optimal_leaf_size =(SELECT max(optimal_leaf_size) from main); 
 
  66679|6520
 

The above says it is problem #66679 in the database, with leaf size for optimal of 6520

2.17 Find the problem with max leaf size of the optimal solution

select rowid,optimal_leaf_size from main where optimal_leaf_size =(SELECT max(optimal_leaf_size) from main); 
 
  66679|6520
 

The above says it is problem #66679 in the database, with leaf size for optimal of 6520

2.18 Find the leaf size of solutions of all other CAS system for the above problem

select rubi_leafsize,maple_leafsize,fricas_leafsize,mma_leafsize,maxima_leafsize,giac_leafsize,sympy_leafsize from main where rowid=66679; 
 
6520|0|0|0|0|0|0
 

zero for leaf size means it was not solved. The above means only Rubi solved it.

2.19 Display the above problem

sqlite> select command_in_maple from main where rowid=66679; 
 
      int((a+b*arctanh(c*x^2))^2/(d*x)^(5/2),x)
 

2.20 Find how many problem Fricas uses special functions Frensel

Find how many problem Fricas uses special functions Frensel in its solution

sqlite> select COUNT(*) from main where fricas_anti LIKE '%fresnel_sin%' OR'%fresnel_cos%'; 
 
      395
 

2.21 Find how many problem Fricas uses Weierstrass special functions

Find how many problem Fricas uses Weierstrass special functions in its solution

sqlite>select COUNT(*) from main where fricas_anti LIKE '%weierstrass%'; 
 
     4054
 

2.22 Find how many problem Maple uses Frensel

sqlite> select COUNT(*) from main where maple_anti LIKE '%fresnel%'; 
 
    670
 

2.23 Find number of integral solved by a CAS

To find the real number of integral solved by a CAS, we must account for the cases for the no known antiderivative.

Compare

sqlite> select count(*) from main where fricas_pass=1; 
       64582
 

With

sqlite>  select count(*) from main where fricas_pass=1 
           or (fricas_pass=0 and has_known_anti=0); 
 
     67589
 

It is the second number above which should be used.