FYI, CAS independent integration tests, summer 2022 edition completed

194 views
Skip to first unread message

Nasser M. Abbasi

unread,
Aug 21, 2022, 2:15:25 AM8/21/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)

Independent CAS integration tests summer 2022 edition is now complete.
(It took about 5 months since I initially started working on it!)

<https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2022/index.htm>

The following is summary of changes in this version
compared to last year's edition
========================
1. Number of integrals increased to 85,479 from 71,994.

The integrals are made of the following 210 files:

a. Rubi test suite. Files 1 to 208. Thanks to Alert Rich.
Downloaded from <https://github.com/RuleBasedIntegration>
b. IntegrateAlgebraic test file. File 209. Thanks to Sam Blake.
c. Fricas test file. File 210. Thanks to Waldek Hebisch.

2. CAS version changes:
Maple 2021.1 -> 2022.1
Mathematica 12.3 -> 13.01
Giac 1.7.0 -> 1.9.0-13
Sympy 1.8/python 3.8.8 -> 1.10.1/Python 3.10.4
Maxima 5.44 -> 5.46
FriCAS 1.3.7 -> 1.3.8
Sagemath 9.3 -> 9.6

No version change for Mupad at Matlab 2021a and Rubi at 4.16.1
but Rubi was run again on the current Mathematica 13.1 version.

3. General improvements to Latex and other formatting.

4. Flow chart of the test program at
<https://www.12000.org/my_notes/CAS_integration_tests/images/design.svg>

5. Links to download all the 85,483 integrals in plain text in
Mathematica, Rubi, Maple, Mupad, Sympy, and Sagemath (Fricas, Maxima, Giac)
formats are at introduction page of the main page.

6. Regression reports comparing results in 2022 edition to 2021 edition
are also now available. These reports show integrals that failed
in current versions compared to last versions per CAS.

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REGRESSION_REPORTS/index.htm>

Regression per CAS
------------------
This table below gives the number of integrals that failed in
this test (could be due to timeout, exception or not solved) but
are solved in summer 2021 for each CAS.

Number of regression per CAS is (less is better)

Fricas: 16
Maxima: 17
Mathematica: 98
Maple: 114
Giac: 363
Sympy: 379

Tables give details about each integral that failed in regression.

7. Sympy, Sagemath (Fricas, Maxima, Giac) were all run on Linux
inside Oracle Virtual Box. Maple, Rubi, Mupad and Mathematica were
run on windows 10. All on same PC with 128 GB RAM with
Intel Core i9-12900K 3.20 GHz.

RESULTS
=======

Overall solved percentage in summer 2022 edition
=========================================
1. Mathematica 13.1 97.99 %
2. Rubi 4.16.1 94.21 %
3. Maple 2022.1 84.53 %
4. Fricas 1.3.8 79.33 %
5. Giac 1.9.0-13 58.37 %
6. Maxima 5.46 56.86 %
7. Mupad 2021a 56.1 %
8. Sympy 1.10.1 41.89 %

Grading results
=================
Note that mupad is not graded. Default grade of B is given for
any passed integral.

1. Rubi 91.50 %
2. Mathematica 78.58 %
3. Maple 56.34 %
4. Fricas 53.78 %
5. Maxima 43.57 %
6. Giac 42.36 %
7. Sympy 28.49 %
8. Mupad* N/A

Time and leaf size Performance
==============================
Sorted by time performance in average time used per integrals (seconds).

Note for Maple(*) timing: the option method=_RETURNVERBOSE was used
which made Maple run through all integration methods increasing
average time used. For example in summer 2021 edition which did
not use this option, Maple had 0.79 seconds average time on
a slower PC also than the one used for the current tests.

1. Rubi 0.3 (sec)
2. Maxima 0.49 (sec)
3. Giac 0.75 (sec)
4. Fricas 1.17 (sec)
5. Mathematica 2.38 (sec)
6. Mupad 2.75 (sec)
7. Maple* 3.33 (sec)
8. Sympy 5.24 (sec)

General notes
==============
1) Maxima, Fricas and Giac were called via Sagemath. Some integrals
could have failed due to interface issues. These will have F(-2)
error code in the section "Detailed conclusion table per each
integral for all CAS systems" per each report and also in the actual
integral page with the actual exception name shown.

This allows one to see if the cause of the failure is due to
interface issue or internal error from the CAS itself.

For an example, the integral on

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/test_cases/4_Trig_functions/4.7_Miscellaneous/139_4.7.5_x%5Em_trig-a+b_log-c_x%5En-%5Ep/reportsubsection69.htm#53>

Has F(-2) on Fricas output, but looking at the exception

integrate(x*sin(a+b*log(c*x^n))^(1/2),x, algorithm="fricas")

"Exception raised: TypeError >> Error detected within library code:
integrate: implementation incomplete (has polynomial part)"

So this is not interface issue with Sagemath. The exception comes
from Fricas itself.

But this integral

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/test_cases/4_Trig_functions/4.7_Miscellaneous/139_4.7.5_x%5Em_trig-a+b_log-c_x%5En-%5Ep/reportsubsection57.htm#41>

Has F(-2) on Giac result, and looking at the exception it says

integrate(x^2*sin(a+log(c*x^n)*(-1/n^2)^(1/2))^3,x, algorithm="giac")

"Exception raised: NotImplementedError >>
Unable to parse Giac output:
((-9*i)*sageVARn^4*sageVARx^3*exp((-3*i) *sageVARa)*
exp((3*sageVARn*abs(sageVARn)*ln(sageVARx)+3*abs(sageVARn)*
ln(sageVARc))/sageVARn^2)+27*i*sageVARn^4*sageVARx^3*exp((-i)"

Which indicates it is an interface issue this time. This is
verified by running this integral directly in giac and it is
solved with no error.

CAS integration test program currently does not distinguish
between an exception generated due to a sagemath interface problem
or an exception generated from the CAS itself. I am not
sure if there a robust way to do this for Maxima, Fricas
and Giac. If a way can be found, will add it.

But there seems to be less of these interface problems in the
current Sagemath version than the last one used.

2) The section "List of integrals sorted by grade for each CAS" in each
report shows list of integrals for each grade per CAS. This allows
one to quickly find integrals with specific grade.

3) Also as mentioned before there are a number of integrals for Maxima
which fail when it asks a question in order to complete the
integration as this is not supported by Sagemath or by the
CAS integration test program. If an option can be added to
turn this feature off that will be a good thing and will improve
Maxima score.

4) Any bugs found or problems please let me know and will try my best
to fix them.

--Nasser  

Qian Yun

unread,
Aug 21, 2022, 5:22:44 AM8/21/22
to fricas...@googlegroups.com
Hi Nasser,

What is the meaning of "Listing of integrals solved by CAS which has no
known antiderivatives"?

The integrals listed here has known antiderivatives:
https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2022/indexsection6.htm

Which can be cross verified by:
https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2022/test_cases/5_Inverse_trig_functions/5.3_Inverse_tangent/149_5.3.3-d+e_x-%5Em-a+b_arctan-c_x%5En-%5Ep/reportsubsection14.htm

- Qian

On 8/21/22 14:15, 'Nasser M. Abbasi' via FriCAS - computer algebra

Nasser M. Abbasi

unread,
Aug 21, 2022, 6:31:12 AM8/21/22
to FriCAS - computer algebra system
Thanks Qian for spotting this. 

This seems to have affected only this file (#149) and only the part that detects integrals that are solved but have no known anti-derivatives.

I still need to find out what caused the program to list these integrals as ones with no known antiderivatives.  

But for now, I corrected this section so these integrals for Fricas no longer show there. Yes, these all are integrable and should not have been in that section.

This does not affect any other parts or any overall statistics.  

--Nasser

Kurt Pagani

unread,
Aug 21, 2022, 9:40:06 AM8/21/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
Hi Nasser
Nice work!
Thanks and best regards
Kurt

p.s.
I'm quite surprised by the Sympy performance.
Not bad (IMO) for a pure Python system :)

Qian Yun

unread,
Aug 22, 2022, 6:04:06 AM8/22/22
to fricas...@googlegroups.com
Hi Nasser,

Here is another 2 (minor) problems in your regression report:

https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REGRESSION_REPORTS/fricas/reportsection7.htm#x8-190007

integrate((e*x)^m*(a+b*log(c*log(d*x)^p)),x)

This returns quickly in fricas-1.3.8, it does not timeout.
Can you double check on your side please.

https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REGRESSION_REPORTS/fricas/reportsection9.htm#x10-230009

integrate(cot(f*x+e)^2*(c+d*tan(f*x+e))^(1/3),x)

For this integral, it returns quickly if you don't set
"setSimplifyDenomsFlag true".

(P.S. fricas-1.3.7 gave wrong answer.)

BTW, do you run all FriCAS tests with "setSimplifyDenomsFlag true"?

- Qian

On 8/21/22 14:15, 'Nasser M. Abbasi' via FriCAS - computer algebra

Nasser M. Abbasi

unread,
Aug 22, 2022, 7:13:22 AM8/22/22
to FriCAS - computer algebra system
Thanks Qian for finding this.

I just found the problem and just fixed it. 

It is related to running these tests in spawned process using Python's multiprocessing. I have to run all these integration tests in a spawned process to be able to set a timeout of 3 minutes.

Will rerun all the tests for Fricas/maxima and giac again and rebuild the reports just to make sure there are no other integrals that got affected by this false timeout. Will take me may be a week. Will post reply here when done.

As for using  setSimplifyDenomsFlag, yes. I set to true before each call from Sagemath using

          fricas.setSimplifyDenomsFlag(fricas.true)

So all Fricas integrals are run with this flag set to true.

--Nasser

Qian Yun

unread,
Aug 22, 2022, 7:59:03 AM8/22/22
to fricas...@googlegroups.com
Hi Nasser,

Some follow up comments on this.

About "setSimplifyDenomsFlag true", it can make some integrals faster,
but it can also make many integrals slower (to timeout). I'm not sure
if this flag makes FriCAS be able to solve more or less.
(@Waldek, can we hear your opinion?)

So Nasser, if it is not too much trouble for you, can you run the
FriCAS tests with and without "setSimplifyDenomsFlag true"?
I'm interested in the numbers.

(Or maybe FriCAS should provide a function that, given a timeout,
use half time to run with "setSimplifyDenomsFlag true" and half
time to run without it.)

====

Some other remarks on your report:

1. You give the regression report. Can we also have a report that
shows integrals that solved in new version but not solved in old
version?

2. Can we have a page that lists all failed integrals of a system?
(So that we don't have to click through lots of links.)

3. Can we have a report on "elementary integral", "algebraic integral",
"transcendental integral", "special function integral"?

What I meant is to filter through the integral, check if it is
"elementary integral" -- only contains +-*/^ exp log trigs
"algebraic integral" -- only contains +-*/^
"transcendental integral" -- only contains +-*/ exp log trigs
"special function integral" -- contains special functions.

- Qian

On 8/22/22 19:13, 'Nasser M. Abbasi' via FriCAS - computer algebra

Nasser M. Abbasi

unread,
Aug 22, 2022, 8:54:28 AM8/22/22
to FriCAS - computer algebra system

"So Nasser, if it is not too much trouble for you, can you run the
FriCAS tests with and without "setSimplifyDenomsFlag true"?
I'm interested in the numbers. "

I've done this before in 2018. Please see  https://www.mail-archive.com/fricas...@googlegroups.com/msg12255.html  I remember that overall it did not improve the result by turning this flag off, but make it little slower. I can't find the exact message, it is hidden in the above thread I think.

"1. You give the regression report. Can we also have a report that
shows integrals that solved in new version but not solved in old
version?"

Sure.

"2. Can we have a page that lists all failed integrals of a system?
(So that we don't have to click through lots of links.)"

Sure.

"3. Can we have a report on "elementary integral", "algebraic integral",
"transcendental integral", "special function integral"?"

There is section in the introduction called "Performance per integrand type" which shows the final result for each CAS
for each subset of the tests:
  1. Independent tests.
  2. Algebraic Binomial problems (products involving powers of binomials and monomials).
  3. Algebraic Trinomial problems (products involving powers of trinomials, binomials and monomials).
  4. Miscellaneous Algebraic functions.
  5. Exponentials.
  6. Logarithms.
  7. Trigonometric.
  8. Inverse Trigonometric.
  9. Hyperbolic functions.
  10. Inverse Hyperbolic functions.
  11. Special functions.
  12. Sam Blake input file.
  13. Waldek Hebisch input file.

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/indexchapter1.htm#x2-50001.3>

There is also complete separate report on "Elementary algebraic integrals" here done about 2 years ago:

May be these will help.

Regards
--Nasser



Waldek Hebisch

unread,
Aug 22, 2022, 11:35:54 AM8/22/22
to fricas...@googlegroups.com
On Mon, Aug 22, 2022 at 07:57:25PM +0800, Qian Yun wrote:
>
> About "setSimplifyDenomsFlag true", it can make some integrals faster,
> but it can also make many integrals slower (to timeout). I'm not sure
> if this flag makes FriCAS be able to solve more or less.
> (@Waldek, can we hear your opinion?)

ATM setSimplifyDenomsFlag(true) means that we do extra work in
expression arithmetic to remove algebraic irrationalities from
denominators. Removal of irrationalities has its cost, so
computation may be slower. Theoretically, expressions can
grew exponentially due to removal of irrationalities. But
bad cases seem to be rare and in practice cost seem to be
moderate. OTOH without removal of irrationalites common
factors between numerator and denominator can grow without
bound, and this happens in several integration examples
(with removal of irrationalites there may be common factors,
but there are limits).

So at fundamental level default is to have computions which
in favorable cases are faster while setSimplifyDenomsFlag(true)
pays extra overhead to avoid very bad cases.

In case of integration this becomes more complex: integrator
makes decisions based on form of integrand and may take
different code code path depending on setSimplifyDenomsFlag.
Cases where setSimplifyDenomsFlag(true) makes things slower
are borderline bugs: if integrator was smarter it would
probably take better code path.


--
Waldek Hebisch

Waldek Hebisch

unread,
Aug 22, 2022, 12:12:27 PM8/22/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Sat, Aug 20, 2022 at 11:15:25PM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
> FYI,
>
> (Posted at https://groups.google.com/g/fricas-devel and
> https://groups.google.com/g/sci.math.symbolic)
>
> Independent CAS integration tests summer 2022 edition is now complete.
> (It took about 5 months since I initially started working on it!)
>
> <https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2022/index.htm>
>

Thanks for your effort.

I looked at integrals were you report much higher size than
"optimal". For FriCAS there are several cases where you
report size thousends time larger than other systems.
However, when I try the examples I see large result,
but much smaller and quite different than result on
your pages. In particular:

File nr command
25 1276 integrate(1/(b*x^5+a), x)
29 186 integrate((h*x^5+g*x^4+f*x^3+e*x^2+d*x+c)/(-b*x^4+a),x)
42 21 integrate((f*x^2+e*x+d)/(c*x^4+b*x^2+a),x)
43 22 integrate(x^3*(C*x^2+B*x+A)/(c*x^4+b*x^2+a),x)
51 134 integrate(x^2/(-x^4+4*x^3-8*x^2+a+8*x),x)
79 254 integrate(1/(a-b*sin(x)^8),x)
95 79 integrate(1/(a-b*cos(x)^8),x)
103 1257 integrate(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))^(3/2),x)
104 354 integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+b*tan(d*x+c))^(3/2),x)

ATM my guess is that Sage is transforming FriCAS result making
it _much_ larger. AFAICS in all FriCAS result involve implict
algebraic quantities (constants).

BTW: looking earlier I noticed some discrepancies between pages,
summary claimed that result is big, specific page claimed timeout.

--
Waldek Hebisch

Nasser M. Abbasi

unread,
Aug 22, 2022, 4:25:32 PM8/22/22
to FriCAS - computer algebra system
Hello Waldek;

Yes, I saw these very large results.

Did you try with the setSimplifyDenomsFlag true? 

I just did, on sagemath,  and I see the size of the Fricas anti derivatives becomes much much larger due to this.

Please see the following folder


I put 2 plain text files there. 
One was run on the first integral you show which is 

25 1276 integrate(1/(b*x^5+a), x)

with the flag false (default) and the second file shows the output when the flag is true.
The result when the flag is true is indeed much much larger. 

I will be happy to run Fricas tests with this flag on or off. But I have to pick one. Last year's tests were all run with this flag true also.

Regards
--Nasser

Nasser M. Abbasi

unread,
Aug 22, 2022, 4:36:00 PM8/22/22
to FriCAS - computer algebra system

" BTW: looking earlier I noticed some discrepancies between pages,
summary claimed that result is big, specific page claimed timeout."

Can you please give specific link(s) to these pages so I can look and see what is the issue?

Thanks
--Nasser

On Monday, August 22, 2022 at 11:12:27 AM UTC-5 Waldek Hebisch wrote:

Waldek Hebisch

unread,
Aug 22, 2022, 9:28:46 PM8/22/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Mon, Aug 22, 2022 at 01:25:32PM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
> Hello Waldek;
>
> Yes, I saw these very large results.
>
> Did you try with the setSimplifyDenomsFlag true?
>
> I just did, on sagemath, and I see the size of the Fricas anti derivatives
> becomes much much larger due to this.
>
> Please see the following folder
>
> https://12000.org/tmp/Fricas_size_diff/
>
> I put 2 plain text files there.
>
> Fricas_flag_false.txt
> <https://12000.org/tmp/Fricas_size_diff/Fricas_flag_false.txt>
> Fricas_flag_true.txt
> <https://12000.org/tmp/Fricas_size_diff/Fricas_flag_true.txt>
>
> One was run on the first integral you show which is
>
> 25 1276 integrate(1/(b*x^5+a), x)
>
> with the flag false (default) and the second file shows the output when the
> flag is true.
> The result when the flag is true is indeed much much larger.
>
> I will be happy to run Fricas tests with this flag on or off. But I have to
> pick one. Last year's tests were all run with this flag true also.

Please see actual FriCAS result (with setSimplifyDenomsFlag(true)):

http://www.math.uni.wroc.pl/~hebisch/fricas/int_size.txt

it has 5171 characters. With defaul setSimplifyDenomsFlag(false)
the result is sligtly larger: 5366 characters.

Sage result that you post is 2223955 characters, that is 430 times
larger than FriCAS result. As you can see setSimplifyDenomsFlag
has little influence on size of FriCAS result. OTOH differences in
those results apparently have dramatic influence on what Sage
is doing to the result. Note that even with default setting
Sage result is about 7 times larger than FriCAS result.

IIUC size of Sage result is due to Sage limitations that
are unlikely to change in near future. However, in such
cases size of result as seen via Sage interface in meaningless
compared to true size of FriCAS result.

--
Waldek Hebisch

Nasser M. Abbasi

unread,
Aug 22, 2022, 9:56:10 PM8/22/22
to FriCAS - computer algebra system
You are right. This problem only shows up when using sagemath to call Fricas.

So what should I do? 

Since I use sagemath and not Fricas directly, would like me to re-run all Fricas tests in sagemath with setSimplifyDenomsFlag as false (default) or should I keep this flage as true but report this as a bug to sagemath and wait to see if it get fixed in some future version of sagemath?

--Nasser

Waldek Hebisch

unread,
Aug 22, 2022, 9:56:47 PM8/22/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Mon, Aug 22, 2022 at 01:36:00PM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
>
> " BTW: looking earlier I noticed some discrepancies between pages,
> summary claimed that result is big, specific page claimed timeout."
>
> Can you please give specific link(s) to these pages so I can look and see
> what is the issue?

Sorry, I did not write down specific link. IIRC it was one of integrals
on the list in my previous message.

--
Waldek Hebisch

Waldek Hebisch

unread,
Aug 23, 2022, 8:18:02 AM8/23/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Mon, Aug 22, 2022 at 06:56:10PM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
> You are right. This problem only shows up when using sagemath to call
> Fricas.
>
> So what should I do?
>
> Since I use sagemath and not Fricas directly, would like me to re-run all
> Fricas tests in sagemath with setSimplifyDenomsFlag as false (default)

No, I expect that setSimplifyDenomsFlag setting will mostly re-arrage
results with some getting better and some worse. And it will not
address core problem at all.

> or
> should I keep this flage as true but report this as a bug to sagemath and
> wait to see if it get fixed in some future version of sagemath?

Please tell Sage folks about the problem. I admit that I would
prefer testing FriCAS without Sage in the loop. Just now I think
that a little explanation on web pages would be good (similar
to what you do for other problems).

--
Waldek Hebisch

Ralf Hemmecke

unread,
Aug 23, 2022, 8:27:23 AM8/23/22
to fricas...@googlegroups.com
> I admit that I would prefer testing FriCAS without Sage in the loop.

Nasser, I guess, it is easier for you to provide the input through Sage
to ensure that you test the same integral on different systems.

Now the question is whether FriCAS already receives "bigger" input
(maybe renaming of variables) or whether the output of FriCAS is made
bigger in order to show it inside Sage (or both).

I believe that the Sage and FriCAS notation for your integrals are
pretty close so that it makes sense to write a little awk (or python)_
script that does the adaptation from your input format into something
that FriCAS understands.

Do you actually need the translation back into Sage for testing and
verifying FriCAS results?

Ralf

Martin R

unread,
Aug 23, 2022, 8:55:29 AM8/23/22
to FriCAS - computer algebra system
If I understand correctly, FriCAS' result of integrate(1/(b*x^5+a), x) contains some algebraic numbers with placeholders like %%G0.  To convert the result into a sage expression, these are substituted back.  Unfortunately, these expressions may be extremely large, and this effect multiplies when the constants appear multiple times.

If you have any suggestions on how to improve the situation, I'd be happy to hear it.  Leaving them out is not really an option, because one may want to do further computations with the integral.

Martin

-1/10*sqrt(1/2)*sqrt(sqrt(5)/(a^4*b)^(2/5) - 5/(a^4*b)^(2/5)) - 1/20*sqrt(5)/(a^4*b)^(1/5) - 1/20/(a^4*b)^(1/5)
sage: fricas("%%G1").sage()
-1/3*(1/2)^(2/3)*((sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)^2/(a^4*b)^(2/5) - 6*(sqrt(2)*(sqrt(5)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) - (a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5))) + 4)/(a^4*b)^(2/5))*(-I*sqrt(3) + 1)/(16000*(sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)^3/(a^4*b)^(3/5) - 144000*(sqrt(2)*(sqrt(5)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) - (a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5))) + 4)*(sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)/(a^4*b)^(3/5) + 432000*(sqrt(2)*((a^4*b)^(3/5)*((sqrt(5) - 5)/(a^4*b)^(2/5))^(3/2) - sqrt(5)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + 13*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5))) - 8*sqrt(5) - 8)/(a^4*b)^(3/5) + 9*sqrt(-2048000000*sqrt(5)*sqrt(2)*(sqrt(5) - 5)^(5/2) - 20480000000/3*(a^4*b)^(3/5)*(9*sqrt(5)*sqrt(2) + 5*sqrt(2))*((sqrt(5) - 5)/(a^4*b)^(2/5))^(3/2) - 1024000000/3*(9*sqrt(5) - 305)*(sqrt(5) - 5)^2 + 15872000000/3*(sqrt(5) - 5)^3 - 35840000000/3*(sqrt(5) - 5)*(sqrt(5) - 51) - 102400000000/3*(a^4*b)^(1/5)*(11*sqrt(5)*sqrt(2) + 7*sqrt(2))*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + 778240000000/3*sqrt(5) + 2662400000000/3)/(a^4*b)^(3/5))^(1/3) - 1/2400*(1/2)^(1/3)*(16000*(sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)^3/(a^4*b)^(3/5) - 144000*(sqrt(2)*(sqrt(5)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) - (a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5))) + 4)*(sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)/(a^4*b)^(3/5) + 432000*(sqrt(2)*((a^4*b)^(3/5)*((sqrt(5) - 5)/(a^4*b)^(2/5))^(3/2) - sqrt(5)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + 13*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5))) - 8*sqrt(5) - 8)/(a^4*b)^(3/5) + 9*sqrt(-2048000000*sqrt(5)*sqrt(2)*(sqrt(5) - 5)^(5/2) - 20480000000/3*(a^4*b)^(3/5)*(9*sqrt(5)*sqrt(2) + 5*sqrt(2))*((sqrt(5) - 5)/(a^4*b)^(2/5))^(3/2) - 1024000000/3*(9*sqrt(5) - 305)*(sqrt(5) - 5)^2 + 15872000000/3*(sqrt(5) - 5)^3 - 35840000000/3*(sqrt(5) - 5)*(sqrt(5) - 51) - 102400000000/3*(a^4*b)^(1/5)*(11*sqrt(5)*sqrt(2) + 7*sqrt(2))*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + 778240000000/3*sqrt(5) + 2662400000000/3)/(a^4*b)^(3/5))^(1/3)*(I*sqrt(3) + 1) + 1/60*(sqrt(2)*(a^4*b)^(1/5)*sqrt((sqrt(5) - 5)/(a^4*b)^(2/5)) + sqrt(5) - 3)/(a^4*b)^(1/5)

Waldek Hebisch

unread,
Aug 23, 2022, 10:22:38 AM8/23/22
to 'Martin R' via FriCAS - computer algebra system
On Tue, Aug 23, 2022 at 05:55:29AM -0700, 'Martin R' via FriCAS - computer algebra system wrote:
> If I understand correctly, FriCAS' result of integrate(1/(b*x^5+a), x)
> contains some algebraic numbers with placeholders like %%G0. To convert
> the result into a sage expression, these are substituted back.
> Unfortunately, these expressions may be extremely large, and this effect
> multiplies when the constants appear multiple times.

Those are not placeholders, they are roots of polynomials in
implict form. MMas call them RootOf.

> If you have any suggestions on how to improve the situation, I'd be happy
> to hear it. Leaving them out is not really an option, because one may want
> to do further computations with the integral.

Represent them faithfully as implicit roots. AFAICS Sage expands
them to explicit form and this is _much_ larger than necessary.
Worse, explicit form is problematic for later computations.

BTW: Could you try the the attached patch? The patch is not
ready to be included now, but once problems are worked out
many integrals will produce result like below. In this example
with the patch I get:

(1) -> integrate(1/(b*x^5+a), x)

--+
(1) > %E log(x + 5 %E a)
--+
4 5
3125 a b %E - 1 = 0
Type: Union(Expression(Integer),...)
(2) -> %::EXPR(INT)::InputForm

(2)
(%root_sum (* %E (log (+ x (* (* 5 %E) a)))) %E
(/ (+ (* (* (* 3125 (^ %E 5)) (^ a 4)) b) - 1) (* (* 3125 (^ a 4)) b)))
Type: InputForm


--
Waldek Hebisch
IR2F.diff

Dima Pasechnik

unread,
Aug 23, 2022, 11:07:37 AM8/23/22
to fricas...@googlegroups.com
Behind the scene, Sage uses pynac (a clone of ginac) for its handling of symbolics. Implicit roots are supported. Docs say:

--------

"By default, all the roots are required to be explicit rather than implicit. To get implicit roots, pass explicit_solutions=False to .roots()

------

I am not sure how well fricas interface is handling these,
though.

Dima


--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/20220823142241.GA29641%40fricas.math.uni.wroc.pl.

Waldek Hebisch

unread,
Aug 23, 2022, 2:35:32 PM8/23/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Mon, Aug 22, 2022 at 05:54:28AM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
>
> "3. Can we have a report on "elementary integral", "algebraic integral",
> "transcendental integral", "special function integral"?"
>
> There is section in the introduction called "Performance per integrand
> type" which shows the final result for each CAS
> for each subset of the tests:
>
> 1. Independent tests.
> 2. Algebraic Binomial problems (products involving powers of binomials
> and monomials).
> 3. Algebraic Trinomial problems (products involving powers of
> trinomials, binomials and monomials).
> 4. Miscellaneous Algebraic functions.
> 5. Exponentials.
> 6. Logarithms.
> 7. Trigonometric.
> 8. Inverse Trigonometric.
> 9. Hyperbolic functions.
> 10. Inverse Hyperbolic functions.
> 11. Special functions.
> 12. Sam Blake input file.
> 13. Waldek Hebisch input file.
>

Well, this classification makes some sense for Rubi, but really
is wrong one for other systems. Namely, what integration algorithm
should do depends _much_ more on form of integral than on form
of integrand. So, crude but useful classification could be:

1) "optimal" result is elementary
2) "optimal" result contains elliptic integrals
3) "optimal" result contains Ei, li, Ci, Si
4) "optimal" result contains erf, erfi, fresnelS, fresnelS
5) "optimal" result contains polylogs
6) "optimal" result contains other special functions

There are some subtleties above, namely some instances of AppelF1
are in fact elliptic, but even simple classification without attempt
to simplify special functions would be useful. One could also
do more detailed distinctions, if interested I can share some
ideas.

Another simple thing to do would be to stratify Rubi testsuite
by number of Rubi steps needed to do integral. So, layer 1
would be integrals for which Rubi needs 1 step, layer 2
ones needing 2 steps, etc. Note that Rubi testsute gives
number of Rubi step, so this should be relatively easy
to do. Maybe extra explanation why this could be useful:
most Rubi rules do integration by parts which any decent
integrator should be able to do. So Rubi abilities are
mainly due to other rules. AFAICS vast majority of other
rules are final rules, so they should appear already in
one step results. But apparently there are few other rules
which appear only in 2 or more step results. So it is
interesting to look at correlations between layers.
If layers are strongly correlated (as I suspect) this
would allow to estimate integrator performance on
much smaller and less time consuming testsuite (higher
layers add bulk which increase integration time).

--
Waldek Hebisch

Martin R

unread,
Aug 23, 2022, 6:34:18 PM8/23/22
to FriCAS - computer algebra system
Dima, could you open a ticket for this?  I didn't know about `explicit_solutions` when I wrote that code.

Martin

Nasser M. Abbasi

unread,
Aug 24, 2022, 4:34:02 AM8/24/22
to FriCAS - computer algebra system
" So, crude but useful classification could be:

1) "optimal" result is elementary
2) "optimal" result contains elliptic integrals
3) "optimal" result contains Ei, li, Ci, Si
4) "optimal" result contains erf, erfi, fresnelS, fresnelS
5) "optimal" result contains polylogs
6) "optimal" result contains other special functions"

I think these all can be done using the new SQL interface to the CAS integration tests database I am working on.

By issuing SQL commands, one can make any type of query they want on the test results.

Will make a post soon on how to do that.

--Nasser

Dima Pasechnik

unread,
Aug 24, 2022, 4:59:47 AM8/24/22
to fricas...@googlegroups.com
On Tue, Aug 23, 2022 at 11:34 PM 'Martin R' via FriCAS - computer
algebra system <fricas...@googlegroups.com> wrote:
>
> Dima, could you open a ticket for this? I didn't know about `explicit_solutions` when I wrote that code.

done, see https://trac.sagemath.org/ticket/34420

Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/4c7fc330-c2a7-4824-9d67-085ad948ccb7n%40googlegroups.com.

Qian Yun

unread,
Aug 24, 2022, 8:55:42 AM8/24/22
to fricas...@googlegroups.com
Hi Nasser,

Another comment:

I'd like to submit to you a new list of integrals, which format should I
use?

The idea is to select integrals from your existing lists, then "expand"
them to confuse the "integration by part heuristic", for example:

expand (A+B)^n, expand A/B+C/D to (AD+BC)/BD.

(It may take a while for me to prepare such a list.)

- Qian

On 8/21/22 14:15, 'Nasser M. Abbasi' via FriCAS - computer algebra

Nasser M. Abbasi

unread,
Aug 24, 2022, 12:00:23 PM8/24/22
to FriCAS - computer algebra system
Hello Qian,

Sure. Your file will be file #211 in that case.   The format is easy. One line per integral. Each line should have 3 fields separated by a comma.
The first is the integrand, the second is the variable of integration, and the third is what you think/decide the optimal antiderivative is. 

If it is not integrable, then Unintegrable is put there.  So the following is a valid input file

------------- input file-------------
sin(x),x,-cos(x)
x*cos(x)*cos(k/sin(x))/sin(x)^2,x,Unintegrable
cos(t),t,sin(t)
------------------------------------------

The optimal is used for grading the result against. 

I will then convert the above file to Maple, Mathematica, etc... format/syntax as needed so that those cas systems can read and understand this input.

--Nasser

Nasser M. Abbasi

unread,
Aug 25, 2022, 6:53:45 PM8/25/22
to FriCAS - computer algebra system

" Another simple thing to do would be to stratify Rubi testsuite
by number of Rubi steps needed to do integral. So, layer 1
would be integrals for which Rubi needs 1 step, layer 2
ones needing 2 steps, etc. Note that Rubi testsute gives
number of Rubi step, so this should be relatively easy
to do. Maybe extra explanation why this could be useful:"

Hello Waldek;
FYI,

It is now possible to also obtain all this information using the new SQL interface. I added more examples.

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]
...

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]
...


Find the integrals which used 4 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}

Also the rules used and the actual rules uses are also displayed under each integral in the main report pages.
The rules are also listed at Rubi web page with the rule number showing next to each file


--Nasser

On Tuesday, August 23, 2022 at 1:35:32 PM UTC-5 Waldek Hebisch wrote:

Nasser M. Abbasi

unread,
Sep 15, 2022, 3:43:25 AM9/15/22
to FriCAS - computer algebra system
FYI;

A small update is made for the summer 2022 edition
for CAS integration tests that only affects only Fricas, Maxima
and Giac to verify some result related to timeouts.

This below is the result for Fricas as it just finished. The others are
still running.

The following are  the 9 integrals that fail in 1.3.8 vs. 1.3.7

In these, The integrals that fail due to time out is because of
the setting of setSimplifyDenomsFlag to true. Otherwise they
complete immediately.
========================================

integrate(x*(e*x^3+d)/(c*x^6+b*x^3+a),x)  (time out due to flag)
integrate((e*x^3+d)/(c*x^6+b*x^3+a),x)   (time out due to flag)
integrate((F^((-a*x+1)^(1/2)/(a*x+1)^(1/2)))^n/(-a^2*x^2+1),x) (not solved)
integrate(F^(3*(-a*x+1)^(1/2)/(a*x+1)^(1/2))/(-a^2*x^2+1),x) (not solved)
integrate(F^(2*(-a*x+1)^(1/2)/(a*x+1)^(1/2))/(-a^2*x^2+1),x)  (not solved)
integrate(F^((-a*x+1)^(1/2)/(a*x+1)^(1/2))/(-a^2*x^2+1),x)  (not solved)
integrate(sec(d*x+c)*(a+b*sin(d*x+c))^(5/2),x)  (not solved)
integrate(cot(f*x+e)^2*(c+d*tan(f*x+e))^(1/3),x) (time out due to flag)
integrate(((x^2-3*x-4)*log(1+x)+((-x^3+3*x^2+4*x)*exp(x+7)+3*x^2-10*x-8)*log(x)+(-x^2+3*x+4)*exp(x+7)+x^3-4*x^2-5*x)/(x^3-3*x^2-4*x),x) (not solved)

The report is at

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REGRESSION_REPORTS/fricas/report.htm>

There is also now a new _reverse regression report_. This shows
all integrals that were solved in Fricas 1.3.8 but failed in 1.3.7.  

5,647 such integrals were found for Fricas. Many seem to be solved now
using the new weierstrass, weierstrassZeta, weierstrassPInverse  
special functions introduced in 1.3.8.

The report at

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REVERSE_REGRESSION_REPORT/fricas/report.htm>

It will take another 2-3 weeks to finish building the full
website again and all the individual reports for the other CAS systems
(each will have regression and reverse regression report also)
and the SQL database. Will make a post when done.

Any bugs/problems found please let me know.

--Nasser


Nasser M. Abbasi

unread,
Sep 28, 2022, 6:36:27 AM9/28/22
to FriCAS - computer algebra system

FYI;

The first update to summer 2022 edition of CAS integration test is now complete.

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/index.htm>

Number of integrals remain the same at 85,479.

This update was needed for the following:
=====================================

1. Added new check on Fricas result to detected 0 result
as failed. Before it was counted as passed. There was 124
such case (one of these is valid as integrand is zero)

sqlite> select COUNT(*) from main where fricas_anti=0;
              125

This reduced Fricas % pass score by only  0.15 %. Hopefully
these integrals will be fixed in the next version of Fricas.

2. re-run all of Fricas/Giac/Maxima tests to make sure there was
no false time out by improving the sagemath script. Only few such
false timeouts were found and corrected.

3. Reduced the size of the pdf's and web pages by only showing
small part of the anti-derivative for a very long result (which
used to take many pages before). There  is an issue with sagemath
interface to Fricas which causes this on some integrals. This
should be fixed in sagemath 9.8.

4. Updated the SQL database for current update.

CAS tested
=================
Mathematica 13.1 (June 29, 2022) on windows 10.
Rubi 4.16.1 on Mathematica 13.0.1 on windows 10.
Maple 2022.1 on windows 10.
Maxima 5.46 using Lisp SBCL 2.1.11.debian via sagemath 9.6.
Fricas 1.3.8  based on sbcl 2.1.11.debian via sagemath 9.6.
Giac/Xcas 1.9.0-13  via sagemath 9.6.
Sympy 1.10.1  Using Python 3.10.4 on Linux.
Mupad using Matlab 2021a on windows 10.


Percentage solved (compared to summer 2021 build)
             2022         2021
             =====       ======
Mathematica  97.99 %     98.39 %
Rubi         94.21 %     99.52 %
Maple        84.53 %     83.58 %
Fricas       79.27 %     68.70 %
Giac         58.45 %     52.43 %
Maxima       56.88 %     52.72 %
Mupad        56.10 %     52.55 %
Sympy        41.89 %     34.47 %

Fricas had the best improvement followed by Sympy and Giac from last year.

Maxima can improve the score more if there is a way to eliminate it
asking question during the integration which cause it to fail
in those cases.

Grading %
===========
System       A       B      C        F
-------      -----   -----  ----     ----
Rubi         91.5    1.95   0.75     5.79
Mathematica  78.58   6.21   13.18    2.01
Maple        56.34   18.53  9.66     15.47
Fricas       53.82   19.55  5.9      20.73
Maxima       43.57   11.69  1.62     43.12
Giac         42.41   14.98  1.06     41.55
Sympy        28.49   9.81   3.6      58.11
Mupad*       4.15    51.95  0.       43.9

(*)Mupad is not graded. B is given as placeholder
for now.

Average Time per second
=========================
Rubi         0.26
Maxima       0.53
Giac         1.55
Fricas       1.97
Mathematica  2.38
Mupad        2.74
Maple*       3.33
Sympy        5.24


Maple(*) timing: the option method=_RETURNVERBOSE was used
which made Maple run through all integration methods increasing
its average time used.

The regression, progress and SQL database can be accessed from the main
page. Here are the direct links

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REGRESSION_REPORTS/index.htm>
<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/REVERSE_REGRESSION_REPORT/index.htm>
<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2022/DATA_BASE/index.htm>

Hopefully no more updates will be needed unless problems are found.

--Nasser

ps. I post this here via google web interface. I have to login to google to do this each time
and the message seems to lose its formatting for some reason.

I wish Fricas will get away from using a google group for communication and use a better platform
where one can edit messages after posting and formatting of messages do not get lost.

Ralf Hemmecke

unread,
Sep 28, 2022, 6:42:07 AM9/28/22
to fricas...@googlegroups.com
Thank you Nasser for the update.

On 28.09.22 12:36, 'Nasser M. Abbasi' via FriCAS - computer algebra
system wrote:
> I post this here via google web interface. I have to login to google
> to do this each time and the message seems to lose its formatting for
> some reason.
Can you try to write a test mail to fricas...@googlegroups.com from
the mail address you usually use. The list fricas-devel is under
moderation, but it is not necessary to login to google for posting (even
as a non-member). I can make an exception for you e-mail address.

Ralf

Nasser M. Abbasi

unread,
Sep 28, 2022, 7:07:53 AM9/28/22
to FriCAS - computer algebra system

Hello Ralf;

I think I tried that once and nothing happened. It will be easier if I can just use normal email.

I just tried it now also. Here is the email I send
=====================

From - Wed, 28 Sep 2022 11:02:58 GMT
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00800000
Message-ID: <ae1a5a6a-3238-0631...@12000.org>
Date: Wed, 28 Sep 2022 06:02:57 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Thunderbird/91.11.0
Reply-To: n...@12000.org
Content-Language: en-US
To: fricas...@googlegroups.com
From: "Nasser M. Abbasi" <n...@12000.org>
Subject: test
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

test message
============================

But I do not see it showing up at the google fricas page  https://groups.google.com/g/fricas-devel/ I am looking at.

I do not know even what is supposed to happen when I send email to "fricas...@googlegroups.com"

Thanks
--Nasser

Ralf Hemmecke

unread,
Sep 28, 2022, 7:24:33 AM9/28/22
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
Hi Nasser,

private mail now, since I do not want to spam the list with that issue.

Interestingly, I do not see that message at google as a pending one.
Strange. Maybe it will appear later.

Oh.... arrrhhhh... what did google do? That looks like the same problem
that caused Waldek from being excluded from the mailing list.

I see a subscription "Nasser M. Abbasi" with the email address
nma%1200...@gtempaccount.com
(member since 18-Aug-2016).

I have no idea why this account was set to a "gtempaccount.com" address.

I think I could delete this account and add a new one with the correct
email address. But before I do this, it would be good to know since when
it does not work and whether something on your site happened with
respect to google. (When I discussed the issue with Waldek, it seemed
that his university decided to use the google service and therefore it
came to a conflict (don't ask me which one) with Waldek's email).

However, you use an email from 12000.org... I wonder what happened here
that you where transferred to a gtempaccount.

Ralf
Reply all
Reply to author
Forward
0 new messages