FYI, new SQLlite interface to the Independent CAS integration tests available

15 views
Skip to first unread message

Nasser M. Abbasi

unread,
Aug 24, 2022, 5:42:28 AM8/24/22
to FriCAS - computer algebra system
FYI posted at https://groups.google.com/g/fricas-devel and https://groups.google.com/g/sci.math.symbolic 



To make it easier to query the Independent CAS integration tests results,
there is now an SQLite database which contains all relevant results
generated during testing.  This is meant to complement the reports
and the webpages and not replace them.

The database and the reports were all generated from the same CSV tables
after running the integration tests. But using the SQL database it
is much easier to obtain the information needed by issuing SQL commands.

To use the database requires the free sqlite3 software. There is
also a free GUI interface.

There is an initial release of the database now with information how to
install it and the software needed use it at the above link.

The database is not fully populated yet, but can be used immediately.
It will take about another 1-2 weeks. The above page will indicate
when the database is completed.

Examples are given on the above page how to use it.

Any problems/bugs please let me know.

--Nasser

Kurt Pagani

unread,
Aug 24, 2022, 8:54:39 AM8/24/22
to fricas...@googlegroups.com
That's great! By the way, may I ask how the latex (e.g. column
fricas_anti_in_latex) is generated? By sage or fricas itself?

Greetings
Kurt
fricas_in_latex.png

Nasser M. Abbasi

unread,
Aug 24, 2022, 11:47:24 AM8/24/22
to FriCAS - computer algebra system
Hello Kurt;

The latex for Fricas and Maxima and Giac is all generated by sagemath itself. After the call from integrate returns, the test program does 

       anti_in_latex = latex(anti)

In the sagemath/python script. Also the grading is done in the same Python script, all inside sagemath.

--Nasser

Nasser M. Abbasi

unread,
Sep 22, 2022, 7:37:21 AM9/22/22
to FriCAS - computer algebra system
Fyi, 

CAS integrations tests SQL database is now fully build.


After extracting the zip file, the size of the db is 1.3 GB.

Added lots of examples also.  Here are few related to Fricas

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

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

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

Find how many problems Fricas solved
sqlite>  SELECT COUNT(*) from main where fricas_pass=1;
   64582

Total number of intergrals

sqlite> select COUNT(*) from main;
85479


--Nasser

Kurt Pagani

unread,
Sep 22, 2022, 5:31:15 PM9/22/22
to fricas...@googlegroups.com
Hi Nasser

Cool, thanks.

BTW1: <localhost> slipped into your last link ;)
https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/DATA_BASE/index.htm

BTW2: there is a sqlite interface to CL:
https://cl-sqlite.common-lisp.dev/#installation, i.e. the db can be used in
fricas/quicklisp as well.

Kurt Pagani

unread,
Sep 22, 2022, 6:02:59 PM9/22/22
to fricas...@googlegroups.com
Addendum: forgot adding the example .... works well despite the 1.2 GB size now!

(ql:quickload :sqlite)
(use-package :sqlite)
(defvar *db* (connect "/home/kfp/Desktop/cas_integration_tests.db"))
*DB*
(execute-single *db* "select COUNT(*) from main where fricas_anti LIKE
'%weierstrass%'")
4054
(execute-single *db* "select COUNT(*) from main where fricas_anti LIKE
'%fresnel_sin%'
OR'%fresnel_cos%'")
395
(execute-to-list *db* "select fricas_anti from main limit 10")

(("1/3*(2*x + 1)^(3/2)") ("2/135*(27*x^2 + 3*x - 2)*sqrt(3*x + 1)")

("2/105*(15*x^3 + 3*x^2 - 4*x + 8)*sqrt(x + 1)")

("-2/27*(3*x + 4)*sqrt(-3*x + 2)") ("-1/4/(x^4 + 4*x^3 + 8*x^2 + 8*x + 4)")

("1/3*cos(x)^3 - cos(x)") ("3/28*(4*z^2 - z - 3)*(z - 1)^(1/3)")

("1/2/(cos(x)^2 - 1)") ("1/3*(sin(2*x) - 4)*sqrt(-sin(2*x) + 4)")

("1/(cos(x) + 3)"))

*

Waldek Hebisch

unread,
Sep 24, 2022, 10:09:24 AM9/24/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Thu, Sep 22, 2022 at 04:37:21AM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
> Fyi,
>
> CAS integrations tests SQL database is now fully build.
>

Thanks for the database. I looked at result in terms of Rubi
steps and FriCAS performace is decreasing with number of Rubi
steps (first is number of steps, second is fraction solved
by FriCAS):

[1.0, 0.8345051379_1238507301]
[2.0, 0.8338310374_7230517291]
[3.0, 0.8501565276_2501057619]
[4.0, 0.8362068965_5172413793]
[5.0, 0.8186005976_0956175299]
[6.0, 0.8175120430_7169169736]
[7.0, 0.7909229984_7016828149]
[8.0, 0.7562585343_6504324078]
[9.0, 0.7237969676_994067238]
[10.0, 0.6470033034_4502123643]
[11.0, 0.6482444733_4200260078]
[12.0, 0.6384388807_0692194404]
[13.0, 0.6023007395_2341824158]
[14.0, 0.6090225563_9097744361]
[15.0, 0.5511288180_6108897742]
[16.0, 0.6092307692_3076923077]
[17.0, 0.5546719681_9085487078]
[18.0, 0.5558510638_2978723404]
[19.0, 0.5223880597_0149253731]
[20.0, 0.5607843137_2549019608]


BTW: I am not sure how you maintain "has_known_anti". The following
9 have has_known_anti = 0, but belong to well-known class having
elementary integrals:

integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x, algorithm="fricas")
integrate(cos(d*x+c)^2/(a+b*sin(d*x+c)^3)^2,x, algorithm="fricas")
integrate(1/(a+b*sin(d*x+c)^3)^2,x, algorithm="fricas")
integrate(sec(d*x+c)^2/(a+b*sin(d*x+c)^3)^2,x, algorithm="fricas")
integrate(sec(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x, algorithm="fricas")
integrate(sinh(d*x+c)^3/(a+b*tanh(d*x+c)^3),x, algorithm="fricas")
integrate(sinh(d*x+c)/(a+b*tanh(d*x+c)^3),x, algorithm="fricas")
integrate(csch(d*x+c)/(a+b*tanh(d*x+c)^3),x, algorithm="fricas")
integrate(csch(d*x+c)^3/(a+b*tanh(d*x+c)^3),x, algorithm="fricas")

FriCAS, Maple and almost surely MMa can do them. I suspect that
Maple or MMa answer is nicer, so you can use it as optimal one.
There is buch of others, one would have to check if they are correct.
But the above are easy ones.

--
Waldek Hebisch

Nasser M. Abbasi

unread,
Sep 24, 2022, 11:46:35 AM9/24/22
to FriCAS - computer algebra system
" BTW: I am not sure how you maintain "has_known_anti". The following
9 have has_known_anti = 0, but belong to well-known class having
elementary integrals:"

Hello;

I myself do not edit or modify the input files. The Rubi input files are maintained by Albert Rich. 
This way there is only only source. If I modify or edit these files, then things will get out of sync.

I will forward these integrals you found to Albert Rich and let him know that these have known 
anti-derivatives so he can update the files on his end for next release. But first I would 
need to know the list of the known antiderivatives for these to send them as well.

For example the first integral in your list is integral number 399 in file 
4_Trig_functions/4.1_Sine/4.1.7-d_trig-^m-a+b-c_sin-^n-^p.txt

And the Rubi input file says

{Cos[c + d*x]^4/(a + b*Sin[c + d*x]^3)^2, x, 0, Unintegrable[Cos[c + d*x]^4/(a + b*Sin[c + d*x]^3)^2, x]}

It is the 4th field above which says it is not integrable.  Otherwise it will have the optimal
antiderivative there.

Mathematica gives solution but in terms of rootsof

In[2]:= Integrate[Cos[c+d*x]^4/(a+b*Sin[c+d*x]^3)^2,x]
Out[2]= (1/(18 a b d))(-I RootSum[-I b+3 I b #1^2+8 a #1^3-3 I b #1^4+I b #1^6&,(2 b ArcTan[Sin[c+d x]/(Cos[c+d x]-#1)]-I b Log[1-2 Cos[c+d x] #1+#1^2]+4 I a ArcTan[Sin[c+d x]/(Cos[c+d x]-#1)] #1+2 a Log[1-2 Cos[c+d x] #1+#1^2] #1+12 b ArcTan[Sin[c+d x]/(Cos[c+d x]-#1)] #1^2-6 I b Log[1-2 Cos[c+d x] #1+#1^2] #1^2-4 I a ArcTan[Sin[c+d x]/(Cos[c+d x]-#1)] #1^3-2 a Log[1-2 Cos[c+d x] #1+#1^2] #1^3+2 b ArcTan[Sin[c+d x]/(Cos[c+d x]-#1)] #1^4-I b Log[1-2 Cos[c+d x] #1+#1^2] #1^4)/(b #1-4 I a #1^2-2 b #1^3+b #1^5)&]+(24 Cos[c+d x] (a+b Sin[c+d x]))/(4 a+3 b Sin[c+d x]-b Sin[3 (c+d x)]))

And Rubi does not solve it

In[4]:= Int[Cos[c+d*x]^4/(a+b*Sin[c+d*x]^3)^2,x]
Out[4]= Int[Cos[c+d x]^4/(a+b Sin[c+d x]^3)^2,x]

Maple gives solution is also in terms of rootof

sol:=int(cos(c + d*x)^4/(a + b*sin(c + d*x)^3)^2,x):
lprint(sol)
-2/3/d/(tan(1/2*d*x+1/2*c)^6*a+3*tan(1/2*d*x+1/2*c)^4*a+8*tan(1/2*d*x+1/2*c)^3*
b+3*tan(1/2*d*x+1/2*c)^2*a+a)/a*tan(1/2*d*x+1/2*c)^5+2/3/d/(tan(1/2*d*x+1/2*c)^
6*a+3*tan(1/2*d*x+1/2*c)^4*a+8*tan(1/2*d*x+1/2*c)^3*b+3*tan(1/2*d*x+1/2*c)^2*a+
a)/b*tan(1/2*d*x+1/2*c)^4+8/3/d/(tan(1/2*d*x+1/2*c)^6*a+3*tan(1/2*d*x+1/2*c)^4*
a+8*tan(1/2*d*x+1/2*c)^3*b+3*tan(1/2*d*x+1/2*c)^2*a+a)/a*tan(1/2*d*x+1/2*c)^3+4
/3/d/(tan(1/2*d*x+1/2*c)^6*a+3*tan(1/2*d*x+1/2*c)^4*a+8*tan(1/2*d*x+1/2*c)^3*b+
3*tan(1/2*d*x+1/2*c)^2*a+a)/b*tan(1/2*d*x+1/2*c)^2+2/3/d/(tan(1/2*d*x+1/2*c)^6*
a+3*tan(1/2*d*x+1/2*c)^4*a+8*tan(1/2*d*x+1/2*c)^3*b+3*tan(1/2*d*x+1/2*c)^2*a+a)
/a*tan(1/2*d*x+1/2*c)+2/3/d/(tan(1/2*d*x+1/2*c)^6*a+3*tan(1/2*d*x+1/2*c)^4*a+8*
tan(1/2*d*x+1/2*c)^3*b+3*tan(1/2*d*x+1/2*c)^2*a+a)/b+2/9/d/a/b*sum((_R^4*b+_R^3
*a+_R*a+b)/(_R^5*a+2*_R^3*a+4*_R^2*b+_R*a)*ln(tan(1/2*d*x+1/2*c)-_R),_R =
RootOf(_Z^6*a+3*_Z^4*a+8*_Z^3*b+3*_Z^2*a+a))

Looking at Fricas I see it timed out on this:

sqlite> select fricas_anti from main where rowid=37649;
Timed out

But this must be because of the use of the flag set to true.
When I tried it now without setting the flag:

ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);

Fricas gave a very large output also using Root object.  But you said antiderivative is
in terms of elementary functions? 

I did not look at the rest of the list you showed.

Regards,
--Nasser

Waldek Hebisch

unread,
Sep 24, 2022, 6:01:17 PM9/24/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
Well, that is known weakness of Rubi.

> Maple gives solution is also in terms of rootof
>
<snip>
>
> Looking at Fricas I see it timed out on this:
>
> sqlite> select fricas_anti from main where rowid=37649;
> Timed out

As I wrote large size/timeout on such integrals is artifact of
Sage interface. You can see answer on FriCAS command line.

> But this must be because of the use of the flag set to true.
> When I tried it now without setting the flag:
>
> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
>
> Fricas gave a very large output also using Root object. But you said
> antiderivative is
> in terms of elementary functions?

Yes, RootSum (and rootof) are considered elementary functions.
And results of integration look exactly as they should.
Here (in all 9 examples) in fact implicit roots are only used
to provide constants.

--
Waldek Hebisch

Nasser M. Abbasi

unread,
Sep 25, 2022, 2:35:21 AM9/25/22
to FriCAS - computer algebra system

"As I wrote large size/timeout on such integrals is artifact of
Sage interface. You can see answer on FriCAS command line."

But it hangs using Fricas directly. When I tried it above I was not using sagemath at all.

=========================
(1) -> setSimplifyDenomsFlag(true)
   (1)  false
                                                                Type: Boolean
(2) -> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
===========================

The above hangs on my computer. I am using 1.3.8.   I waited for more than  30 
minutes and had to stop it. But this below completes in about 1 minute:

=============================
1) ->  setSimplifyDenomsFlag(false)
   (1)  false
                                                                Type: Boolean
(2) -> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
==============================

I am using 
======================
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
                       FriCAS Computer Algebra System
                            Version: FriCAS 1.3.8
=====================
On Linux Manjaro.

If this is not what you are also seeing, then I wonder why then it hangs on my system.

I am running Linux inside a virtual box. But this should not have anything to do with it.

"Yes, RootSum (and rootof) are considered elementary functions."

Ah, I see. For some reason I thought these are not considered  elementary functions. 
This is good to know.

I will email Albert links to these integrals you showed.

But in addition, all such integrals that are solved but marked as non-integrable in 
the Rubi input files, are already tagged as such in the reports generated by CAS integration 
test to make it easy for anyone to view them.

These integrals are listed as bold letters in the main page, chapter 2
"links to individual test reports"


"The list of numbers in the curly brackets after that (if any) is the list of the integrals 
in that specific test which were solved by any CAS which are known not to have antiderivative. 
This makes it easier to find these integrals and do more investigation into them."

It will be up to Albert Rich to decide to update his Rubi input files based on this finding. But 
I will let him know as well.

Regards
--Nasser

Grégory Vanuxem

unread,
Sep 25, 2022, 10:34:13 AM9/25/22
to fricas...@googlegroups.com
Hello,

Le dim. 25 sept. 2022 à 08:35, 'Nasser M. Abbasi' via FriCAS - computer algebra system <fricas...@googlegroups.com> a écrit :

"As I wrote large size/timeout on such integrals is artifact of
Sage interface. You can see answer on FriCAS command line."

But it hangs using Fricas directly. When I tried it above I was not using sagemath at all.

=========================
(1) -> setSimplifyDenomsFlag(true)
   (1)  false
                                                                Type: Boolean
(2) -> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
===========================

The above hangs on my computer. I am using 1.3.8.   I waited for more than  30 
minutes and had to stop it. But this below completes in about 1 minute:

=============================
1) ->  setSimplifyDenomsFlag(false)
   (1)  false
                                                                Type: Boolean
(2) -> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
==============================
 
Idem, I can reproduce this with a Debian unstable based distribution.
If setSimplifyDenomsFlag(false): 59:35 sec  otherwise I don't know it was too long (more than 1O minutes).
 
__
Greg

Waldek Hebisch

unread,
Sep 25, 2022, 11:36:54 AM9/25/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Sat, Sep 24, 2022 at 11:35:21PM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
>
> "As I wrote large size/timeout on such integrals is artifact of
> Sage interface. You can see answer on FriCAS command line."
>
> But it hangs using Fricas directly. When I tried it above I was not using
> sagemath at all.
>
> =========================
> (1) -> setSimplifyDenomsFlag(true)
> (1) false
> Type:
> Boolean
> (2) -> ii:=integrate(cos(d*x+c)^4/(a+b*sin(d*x+c)^3)^2,x);
> ===========================
>
> The above hangs on my computer. I am using 1.3.8. I waited for more than
> 30
> minutes and had to stop it.

I see. I am using version with various uncommited patches and it
finishes resonably quickly (in few seconds). Usually my developement
version gives the same results (and in comparable time) as release,
but this case is different...


--
Waldek Hebisch

Nasser M. Abbasi

unread,
Oct 1, 2022, 2:46:31 AM10/1/22
to FriCAS - computer algebra system

FYI

With the help of the SQL database I am using now for CAS integration tests, I was able to generate 
some more interesting observations. Added new statistic section called "Performance based on Rubi rules"


 This section basically looks at how percentage solved by each CAS correlate to how 
many rules and how many steps Rubi itself used to solve the same integral. I also added histograms 
showing distribution of leaf size of anti-derivatives for each CAS. 

 Hope this is something that is useful to see.

--Nasser

On Saturday, September 24, 2022 at 9:09:24 AM UTC-5 Waldek Hebisch wrote:
Reply all
Reply to author
Forward
0 new messages