Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

# Yet another integration test

130 views

### anti...@math.uni.wroc.pl

Sep 7, 2021, 8:39:45 PM9/7/21
to

I have created a file of 10335 random testcases of exp-log
functions. This should be relatively easy test: with
high probablity such functions are transcendental. Also
pobablity of hitting problematic case is relatively low.

However, it seems that some system have trouble with such
easy cases. Already exmple number 9, that is integral of

(((-2)*x^3+34*x^2+392*x+800)*log((((-25)*x+(-100))*log(x)+(x^2+x))/(25*x+100))+((-6)*x^3+102*x^2+1176*x+2400))/((25*x^3+200*x^2+400*x)*log(x)+((-1)*x^4+(-5)*x^3+(-4)*x^2))

is returned unevaluated by maxima 5.44 and Maple 15.
It works in FriCAS and Mathematica 12.0.0.

So, can your system do easy integrals?

You can find test file at

http://www.math.uni.wroc.pl/~hebisch/fricas/rand3c.input

The format is

do_test(f, i)

where 'f' is the integrand and 'i' is integral. In fact, 'i'
is randomly generated, filtering out nonsense like log(0),
and 'f' is expanded derivative of 'i'. Random distribution
is uniform on unary-binary trees having 15 nodes. Tree
is decorated with random binary operations ('+', '-', '*' and '/')
and unary ('log', 'exp' and square) operators. Leaf nodes
get variable 'x' with probablity 0.5 or integers from 1 to 5
each with probablity 0.1.

To try it in FriCAS on the command line do

)set break resume
do_test(f, i) == integrate(f, x)

The first line is to avoid stopping in case of errors: FriCAS
signals error on hitting unplemented part of Risch algoritm
which happens in few examples that are in fact algebraic.
The second line define 'do_test' as integration of first
argument with respect to 'x' (of course you could provide
more fancy function). Third line reads file containging
example.

To try other system you need appropriate definition of
'do_test'. Functions use FriCAS syntax which is mostly
compatible with Maple and Maxima (the example above is
accepted without changes by FriCAS, Maple and Maxima).
For other system you need to change syntax...

--
Waldek Hebisch

### nob...@nowhere.invalid

Sep 8, 2021, 12:23:42 AM9/8/21
to

anti...@math.uni.wroc.pl schrieb:
>
> I have created a file of 10335 random testcases of exp-log
> functions. This should be relatively easy test: with
> high probablity such functions are transcendental. Also
> pobablity of hitting problematic case is relatively low.
>
> However, it seems that some system have trouble with such
> easy cases. Already exmple number 9, that is integral of
>
> (((-2)*x^3+34*x^2+392*x+800)*log((((-25)*x+(-100))*log(x)+(x^2+x))/(25*x+100))+((-6)*x^3+102*x^2+1176*x+2400))/((25*x^3+200*x^2+400*x)*log(x)+((-1)*x^4+(-5)*x^3+(-4)*x^2))
>
> is returned unevaluated by maxima 5.44 and Maple 15.
> It works in FriCAS and Mathematica 12.0.0.
>
> So, can your system do easy integrals?
>

Derive 6.10 has no problem with that one:

INT((((-2)*x^3 + 34*x^2 + 392*x + 800)*LN((((-25)*x + -100)*LN(x) +
(x^2 + x))/(25*x + 100)) + ((-6)*x^3 + 102*x^2 + 1176*x + 2400))/
((25*x^3 + 200*x^2 + 400*x)*LN(x) + ((-1)*x^4 + (-5)*x^3 + (-4)*x^2)),
x)

LN((x*(x + 1) - 25*(x + 4)*LN(x))/(x + 4))^2 + LN((25*(x + 4)*LN(x) -
x*(x + 1))/(x + 4))*(6 - 4*LN(5))

This answer is as good as instantaneous. I haven't tried any of the
other integrands yet.

Martin.

### nob...@nowhere.invalid

Sep 12, 2021, 5:03:38 PM9/12/21
to

"clicl...@freenet.de" schrieb:
According to the 9th entry in the test file at:

<http://www.math.uni.wroc.pl/~hebisch/fricas/rand3c.input>

this antiderivative should equal the simpler:

(LN((x*(x + 1) - 25*(x + 4)*LN(x))/(25*(x + 4))) + 3)^2

up to some piecewise constant, which plotting on Derive indeed
confirms.

Martin.

### Nasser M. Abbasi

Sep 17, 2021, 10:47:19 AM9/17/21
to
On 9/7/2021 7:39 PM, anti...@math.uni.wroc.pl wrote:

>
> So, can your system do easy integrals?
>
> You can find test file at
>
> http://www.math.uni.wroc.pl/~hebisch/fricas/rand3c.input
>

Hello;

I plugged in your file to the independent CAS integration test program
and this is the result.

<https://www.12000.org/my_notes/CAS_integration_tests/index.htm>
<https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2021/test_cases/10_Hebisch/report.htm>

There are 10,335 integrals in this file. This is the
largest file now in CAS integration tests and took the program
10 days running 24 hrs to complete. There are now
a total of 210 files in the CAS integration test suite.

Here is summary of the result copied from the above link

CAS systems used
==================
1. Mathematica 12.3.1 (64 bit) on windows 10.
2. Rubi 4.16.1 on Mathematica 12.3.1 on windows 10.
3. Maple 2021.1 (64 bit) on windows 10.
4. Maxima 5.45 on Linux. (via sagemath 9.4)
5. Fricas 1.3.7 on Linux (via sagemath 9.4)
6. Giac/Xcas 1.7 on Linux. (via sagemath 9.4)
7. Sympy 1.8 under Python 3.8.8 using Anaconda distribution.
8. Mupad using Matlab 2021a with Symbolic Math Toolbox Version 8.7 under windows 10 (64 bit)

This is the final result of percentage passed

system % passed
======== ===========
1. Fricas 99.92
2. Maple 97.49
3. Mathematica 97.37
4. Sympy 95.43
5. Maxima 93.17
7. Giac 85.09
8. Rubi 63.38

The following is the grading result (notice that Mupad is not currently

======= ======== ========= ===== =======
Mathematica 88.51 7.80 0.81 2.63
Fricas 81.60 18.18 0.15 0.08
Maple 79.98 9.78 7.73 2.51
Sympy 77.10 18.16 0.17 4.57
Maxima 63.97 23.97 5.23 6.83
Giac 63.83 20.98 0.28 14.91
Rubi 49.55 12.19 1.64 36.62

The following is performance table

system Mean time (sec) Normalized mean
to solve one integral size of antiderivative
======== =========== =======================
Mathematica 0.36 4.02
Maple 0.50 8.38
Fricas 0.59 1.53
Maxima 0.68 2.49
Rubi 0.74 2.95
Giac 0.83 2.47
Sympy 1.77 1.42

Zip files that contains all integrals used in plain text format
in Mathematica, Maple, Sagemath, and Sympy format are also available
on the web page.

Any problems found, please let me know and will correct
and re-run the test.

--Nasser

### nob...@nowhere.invalid

Sep 17, 2021, 6:12:09 PM9/17/21
to

"Nasser M. Abbasi" schrieb:
>
> On 9/7/2021 7:39 PM, anti...@math.uni.wroc.pl wrote:
>
> >
> > So, can your system do easy integrals?
> >
> > You can find test file at
> >
> > http://www.math.uni.wroc.pl/~hebisch/fricas/rand3c.input
> >
>
> [...]
>

numbers or functions. The declining performance from Fricas to Maple
to Mathematica to Sympy to Maxima may reflect this fraction, or it may
just reveal deficiencies of their non-algebraic Risch implementations.
At 63.38%, Rubi is surprisingly successful for a purely rule-based
integrator. I have no idea what types of integrator Mupad and Giac are
fielding.

The large number of random integrands should imply that performance
differences in excess of 1% are statistically significant. Do you
agree?

Martin.

### anti...@math.uni.wroc.pl

Sep 18, 2021, 1:59:03 PM9/18/21
to
FriCAS tells me that only 31...

> The declining performance from Fricas to Maple
> to Mathematica to Sympy to Maxima may reflect this fraction, or it may
> just reveal deficiencies of their non-algebraic Risch implementations.

It seems that there are deficiences in implementation of transcendental
part of Risch algorithm. Or, possibly effect of incompletness of
whatever alternative they use...

--
Waldek Hebisch

### nob...@nowhere.invalid

Sep 18, 2021, 5:32:00 PM9/18/21
to

anti...@math.uni.wroc.pl schrieb:
Perhaps those accidental algebraics would then better be removed from
the suite, leaving 10,335 - 31 = 10,304 integrands?

Martin.

### anti...@math.uni.wroc.pl

Sep 18, 2021, 8:36:48 PM9/18/21
to
Maybe. That would remove 8 cases when FriCAS fails. One of
those cases is

(((-1)*x+2)*exp(log(4*x^2*exp(x+2))/2))/(x*exp(x))

which FriCAS essentially treats as

(((-1)*x+2)*sqrt(4*x^2*exp(x+2)))/(x*exp(x))

Arguably, this can be written without using algebraics. Also
I think that systems which simply ignore algebraic dependencies
should do them without trouble.

--
Waldek Hebisch

### Валерий Заподовников

Dec 27, 2021, 3:27:43 AM12/27/21
to
Does not mathematica also treat exp(log) like that?
Can you publish all 8 cases that FriCAS fails on? Are
those unimplemented branches, like constant residues?

Also please test on Integrate from Wolfram Math. 13.0.0,
since it has IntegrateAlgebraic indide. Also on your example
with 10 integrals the cos^2 example works in elementary functions
in 13.0.0, but there is an obvious bug in Mathematica that returns
complex stuff for some Integrals, it is still not fixed and as
one can see from IntegrateAlgebraic open code even they did such a
mistake.

https://github.com/stblake/algebraic_integration/commit/4a12cdbc4986982cb27dabf203d32e4a5b694a6e

### Nasser M. Abbasi

Dec 27, 2021, 5:48:09 AM12/27/21
to
On 12/27/2021 2:27 AM, Валерий Заподовников wrote:

>
> Also please test on Integrate from Wolfram Math. 13.0.0,
> since it has IntegrateAlgebraic indide.

There should be a new build of CAS independent integration
tests which will have Mathematica V 13.0. But waiting for
Maple 2022 and sagemath 9.6 and most important for the next
version of Rubi to be released with its new test input files

This is because it takes about 2 months and lots of effort and
time to run all these tests, and do not want to do this now
and then have to do it again few months later.

Hopefully sometime next year.

--Nasser

### Richard Fateman

Dec 28, 2021, 7:09:45 PM12/28/21
to
The long expression posted previously that Maxima could not integrate can be expanded and much of it is then integrated.

v:
(((-2)*x^3+34*x^2+392*x+800)*log((((-25)*x+(-100))*log(x)+(x^2+x))/(25*x+100))+((-6)*x^3+102*x^2+1176*x+2400))/((25*x^3+200*x^2+400*x)*log(x)+((-1)*x^4+(-5)*x^3+(-4)*x^2));
((-2*x^3+34*x^2+392*x+800)*log(((-25*x-100)*log(x)+x^2+x)/(25*x+100))-6*x^3+102*x^2+1176*x+2400)/((25*x^3+200*x^2+400*x)*log(x)-x^4-5*x^3-4*x^2)

There's one piece of the expansion that doesn't come out in the wash,

integrate((3*x^6-119*x^5-608*x^4+27320*x^3+339296*x^2+1411200*x+1920000)/((150*x^2+1200*x+2400)*log(x)-6*x^3-30*x^2-24*x),x)

So this after tossing out what I thought were extraneous to come up with a simple
"bug report" I came to the problem integrate( 1/(log(x)+x), x) which Maxima 5.45.1 apparently cannot do.
Also in Maxima, risch(...) returns unchanged, which suggests that this is not integrable in terms of elementary functions,
but I don't really trust that.

In Mathematica 13, the integral also returns unchanged.

I do not have a recent version of Maple or any version of Fricas.

It seems to me that one can generate increasingly more challenging examples in a systematic fashion that would illustrate points of failure more effectively than trying out random algebraic tree generation.
For instance, irreducible polynomials of increasing degrees; one, two, ... more logarithmic extensions, exponential extensions, both, ..
RJF

### nob...@nowhere.invalid

Dec 29, 2021, 1:12:21 AM12/29/21
to

Richard Fateman schrieb:
>
> The long expression posted previously that Maxima could not integrate
> can be expanded and much of it is then integrated.
>
> v:
> (((-2)*x^3+34*x^2+392*x+800)*log((((-25)*x+(-100))*log(x)+(x^2+x))/(25*x+100))+((-6)*x^3+102*x^2+1176*x+2400))/((25*x^3+200*x^2+400*x)*log(x)+((-1)*x^4+(-5)*x^3+(-4)*x^2));
> ((-2*x^3+34*x^2+392*x+800)*log(((-25*x-100)*log(x)+x^2+x)/(25*x+100))-6*x^3+102*x^2+1176*x+2400)/((25*x^3+200*x^2+400*x)*log(x)-x^4-5*x^3-4*x^2)
>
> There's one piece of the expansion that doesn't come out in the wash,
>
> integrate((3*x^6-119*x^5-608*x^4+27320*x^3+339296*x^2+1411200*x+1920000)/((150*x^2+1200*x+2400)*log(x)-6*x^3-30*x^2-24*x),x)
>
> So this after tossing out what I thought were extraneous to come up
> with a simple "bug report" I came to the problem
> integrate( 1/(log(x)+x), x) which Maxima 5.45.1 apparently
> cannot do.
> Also in Maxima, risch(...) returns unchanged, which suggests that
> this is not integrable in terms of elementary functions, but I don't
> really trust that.
>
> In Mathematica 13, the integral also returns unchanged.
>
> I do not have a recent version of Maple or any version of Fricas.
>
> It seems to me that one can generate increasingly more challenging
> examples in a systematic fashion that would illustrate points of
> failure more effectively than trying out random algebraic tree
> generation.
> For instance, irreducible polynomials of increasing degrees; one,
> two, ... more logarithmic extensions, exponential extensions, both,
> ..
> RJF

You seem to be referring to the integral:

INT((((-2)*x^3 + 34*x^2 + 392*x + 800)*LN((((-25)*x + -100)*LN(x) +
(x^2 + x))/(25*x + 100)) + ((-6)*x^3 + 102*x^2 + 1176*x + 2400))/
((25*x^3 + 200*x^2 + 400*x)*LN(x) + ((-1)*x^4 + (-5)*x^3 + (-4)*x^2)),
x)

with solution:

LN((x*(x + 1) - 25*(x + 4)*LN(x))/(x + 4))^2 + LN((25*(x + 4)*LN(x) -
x*(x + 1))/(x + 4))*(6 - 4*LN(5))

which is elementary (by construction, in fact). If Maxima can separate
out an integrable part by integrand expansion, then the remaining part
must be integrable in elementary terms too. But INT(1/(LN(x)+x), x)
pretty certainly isn't, as the web interface of FriCAS at

<http://fricas-wiki.math.uni.wroc.pl/FriCASIntegration#bottom>:

when instructed as follows:

\begin{axiom}
)set output tex off
)set output algebra on
setSimplifyDenomsFlag(true)
unparse(integrate(1/(log(x)+x), x)::InputForm)
)set output algebra off
)set output tex on
\end{axiom}

returns the integral unevaluated.

Martin.

### Валерий Заподовников

Dec 29, 2021, 11:18:53 AM12/29/21
to
So without expansion it works even in Mathematica 12
and with it that part does not work even in 13? Wow. Strange.

Still, IMHO, mathematica can solve much less of what you
think it can. Because complex stuff should not (except in +C) be
present in antiderivative, yet it is and you do not consider it a bug!!
Opened a bug for Sam Blake.
See: https://github.com/stblake/algebraic_integration/issues/2

So can you publish 8 failures for FriCAS?? please!

BTW, one failure mentioned on github can now be solved by 13.0:
Integrate[Log (1 + x)/x/(1 + (1 + x)^(1/2))^(1/2), x]
See my comment. https://github.com/fricas/fricas/issues/19#issuecomment-997099394

So Risch is far from being optimal in this case but we knew it (for Logs).

### Nasser M. Abbasi

Jan 2, 2022, 6:21:38 AM1/2/22
to
On 12/29/2021 10:18 AM, Валерий Заподовников wrote:

> So can you publish 8 failures for FriCAS?? please!
>

If you mean the 8 integrals FriCAS did not solve in
the 10,335 integrals test you are replying to, then
this is all given in the above link of the message you

Here it is again:

<https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/test_cases/10_Hebisch/report.htm>

They are numbers { 833, 975, 2446, 3878, 5066, 5285, 5642, 8482 }

Here they are

integrate(((4*exp(x^2)-4*x)*log(exp(x)*exp(x^2)-exp(x)*x)*log(log(exp(x)*exp(x^2)-exp(x)*x))+(8*x+4)*exp(x^2)-
4*x-4)*(exp(x)*log(log(exp(x)*exp(x^2)-exp(x)*x)))^(2/9)/(9*exp(x^2)-9*x)/log(exp(x)*exp(x^2)-exp(x)*x)/log(lo
g(exp(x)*exp(x^2)-exp(x)*x)),x, algorithm="giac")

----------------

integrate(((4*exp(x)+3*log(2/5)+6)*exp(1/3*log(exp(x)+log(2/5)+2)+x)+(-3*exp(x)-3*log(2/5)-6)*log(x)-3*exp(x)-
3*log(2/5)-6)/(3*exp(x)+3*log(2/5)+6),x, algorithm="fricas")

Exception raised: TypeError >> Error detected within library code: integrate: implementation incomplete (co
nstant residues)
------------------

integrate(1/48*(-x^(1/4)*exp(x^(1/4)-4)-12*x*log(3))*exp(-1/3*exp(x^(1/4)-4)-x*log(3))/x,x, algorithm="fricas"
)
Exception raised: TypeError >> Error detected within library code: alglogextint: unimplemented
-------------------

integrate((((2*x^2+8)*log(x^2+4)^2+4*x^2+16)*log(log(x^2+4)^2+2)+8*x^2*log(x^2+4))*exp(1/2*log(-12*x*log(log(x
^2+4)^2+2)+15)-5)/(((4*x^3+16*x)*log(x^2+4)^2+8*x^3+32*x)*log(log(x^2+4)^2+2)+(-5*x^2-20)*log(x^2+4)^2-10*x^2-
40),x, algorithm="fricas")

Exception raised: TypeError >> Error detected within library code: integrate: implementation incomplete (co
nstant residues)
---------------------------

integrate((6*exp(4)*log(x)-2*exp(4)^2+(6-4*x)*exp(4)-2*x^2+6*x)*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(
4)))-1)*exp(2*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(4)))-1))/((9*x*exp(4)+9*x^2)*log(x)-3*x*exp(4)^2-6
*x^2*exp(4)-3*x^3),x, algorithm="fricas")

Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel
----------------------------------

integrate((((-x^3+5*x)*log(-x^2+5)*log(log(-x^2+5))+(4*x^2-20)*log(-x^2+5)+2*x^3)*(-x*log(log(-x^2+5))+2)^(1/2
)+(2*x^5-10*x^3)*log(-x^2+5)*log(log(-x^2+5))+(-4*x^4+20*x^2)*log(-x^2+5))/((2*x^5-10*x^3)*log(-x^2+5)*log(log
(-x^2+5))+(-4*x^4+20*x^2)*log(-x^2+5)),x, algorithm="fricas")
Exception raised: TypeError >> Error detected within library code: integrate: implementation incomplete (co
nstant residues)

-----------------------
integrate(((-log(exp(x)*x)+x+9)*((-25*log(exp(x)*x)+200)/x)^(1/2)-2*log(exp(x)*x)+16)*exp(((-25*log(exp(x)*x)+
200)/x)^(1/2))/(2*x^2*log(exp(x)*x)-16*x^2),x, algorithm="fricas")

Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel

-------------------------------
integrate((((-10*x*exp(3)-50)*exp((x^2*exp(3)^2+10*x*exp(3)+25)/x^2)*log(x)+x^2*exp((x^2*exp(3)^2+10*x*exp(3)+
25)/x^2)-x^3)*exp(1/3*log(exp((x^2*exp(3)^2+10*x*exp(3)+25)/x^2)*log(x)-x)-5/3)+3*x^3*exp((x^2*exp(3)^2+10*x*e
xp(3)+25)/x^2)*log(x)-3*x^4)/(3*x^3*exp((x^2*exp(3)^2+10*x*exp(3)+25)/x^2)*log(x)-3*x^4),x, algorithm="fricas"
)

Exception raised: TypeError >> Error detected within library code: integrate: implementation incomplete (co
nstant residues)

--Nasser

### nob...@nowhere.invalid

Jan 3, 2022, 2:29:15 AM1/3/22
to

"Nasser M. Abbasi" schrieb:
>
> On 12/29/2021 10:18 AM, Валерий Заподовников wrote:
>
> > So can you publish 8 failures for FriCAS?? please!
> >
>
> If you mean the 8 integrals FriCAS did not solve in
> the 10,335 integrals test you are replying to, then
> this is all given in the above link of the message you
>
> Here it is again:
>
> <https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/test_cases/10_Hebisch/report.htm>
>
> They are numbers { 833, 975, 2446, 3878, 5066, 5285, 5642, 8482 }
>
> Here they are
>
> integrate(((4*exp(x^2)-4*x)*log(exp(x)*exp(x^2)-exp(x)*x)*log(log(exp(x)*exp(x^2)-exp(x)*x))+(8*x+4)*exp(x^2)-
> 4*x-4)*(exp(x)*log(log(exp(x)*exp(x^2)-exp(x)*x)))^(2/9)/(9*exp(x^2)-9*x)/log(exp(x)*exp(x^2)-exp(x)*x)/log(lo
> g(exp(x)*exp(x^2)-exp(x)*x)),x, algorithm="giac")
>
> ----------------
>

This one was calling GIAC, not FriCAS. Also no result or error message
is shown.

>
> [...]
>
> integrate((6*exp(4)*log(x)-2*exp(4)^2+(6-4*x)*exp(4)-2*x^2+6*x)*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(
> 4)))-1)*exp(2*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(4)))-1))/((9*x*exp(4)+9*x^2)*log(x)-3*x*exp(4)^2-6
> *x^2*exp(4)-3*x^3),x, algorithm="fricas")
>
> Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel
>
> ----------------------------------
>
> [...]
>
> integrate(((-log(exp(x)*x)+x+9)*((-25*log(exp(x)*x)+200)/x)^(1/2)-2*log(exp(x)*x)+16)*exp(((-25*log(exp(x)*x)+
> 200)/x)^(1/2))/(2*x^2*log(exp(x)*x)-16*x^2),x, algorithm="fricas")
>
> Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel
>
> -------------------------------
>

I am seeing those "do_alg_rde: unimplemented kernel" messages for the
first time, where I take "rde" to mean Risch Differential Equation.
Apparently, the rde-solver of FriCAS may fail for mixed transcendental-
algebraic integrands. Indeed, the first integrand involves:

(- x*(3*LN(x)/(x + #e^4) - 1))^(1/3)

while the second one contains:

SQRT((8 - LN(x))/x - 1)

Martin.

### Nasser M. Abbasi

Jan 3, 2022, 9:13:21 AM1/3/22
to
On 1/3/2022 1:36 AM, clicl...@freenet.de wrote:
>

>> Here it is again:
>>
>> <https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/test_cases/10_Hebisch/report.htm>
>>
>> They are numbers { 833, 975, 2446, 3878, 5066, 5285, 5642, 8482 }
>>
>> Here they are
>>
>> integrate(((4*exp(x^2)-4*x)*log(exp(x)*exp(x^2)-exp(x)*x)*log(log(exp(x)*exp(x^2)-exp(x)*x))+(8*x+4)*exp(x^2)-
>> 4*x-4)*(exp(x)*log(log(exp(x)*exp(x^2)-exp(x)*x)))^(2/9)/(9*exp(x^2)-9*x)/log(exp(x)*exp(x^2)-exp(x)*x)/log(lo
>> g(exp(x)*exp(x^2)-exp(x)*x)),x, algorithm="giac")
>>
>> ----------------
>>
>
> This one was calling GIAC, not FriCAS. Also no result or error message
> is shown.
>

opps, copied the wrong one for the first integral. here it is

===============
integrate(((4*exp(x^2)-4*x)*log(exp(x)*exp(x^2)-exp(x)*x)*log(log(exp(x)*exp(x^2)-exp(x)*x))+(8*x+4)*exp(x^2)-
4*x-4)*(exp(x)*log(log(exp(x)*exp(x^2)-exp(x)*x)))^(2/9)/(9*exp(x^2)-9*x)/log(exp(x)*exp(x^2)-exp(x)*x)/log(lo
g(exp(x)*exp(x^2)-exp(x)*x)),x, algorithm="fricas")
[Out]

Exception raised: TypeError >> Error detected within library code: integrate: implementation incomplete (co
nstant residues)
============

>>
>> [...]
>>
>> integrate((6*exp(4)*log(x)-2*exp(4)^2+(6-4*x)*exp(4)-2*x^2+6*x)*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(
>> 4)))-1)*exp(2*exp(1/3*log((-3*x*log(x)+x*exp(4)+x^2)/(x+exp(4)))-1))/((9*x*exp(4)+9*x^2)*log(x)-3*x*exp(4)^2-6
>> *x^2*exp(4)-3*x^3),x, algorithm="fricas")
>>
>> Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel
>>
>> ----------------------------------
>>
>> [...]
>>
>> integrate(((-log(exp(x)*x)+x+9)*((-25*log(exp(x)*x)+200)/x)^(1/2)-2*log(exp(x)*x)+16)*exp(((-25*log(exp(x)*x)+
>> 200)/x)^(1/2))/(2*x^2*log(exp(x)*x)-16*x^2),x, algorithm="fricas")
>>
>> Exception raised: TypeError >> Error detected within library code: do_alg_rde: unimplemented kernel
>>
>> -------------------------------
>>
>
> I am seeing those "do_alg_rde: unimplemented kernel" messages for the
> first time, where I take "rde" to mean Risch Differential Equation.
> Apparently, the rde-solver of FriCAS may fail for mixed transcendental-
> algebraic integrands. Indeed, the first integrand involves:
>
> (- x*(3*LN(x)/(x + #e^4) - 1))^(1/3)
>
> while the second one contains:
>
> SQRT((8 - LN(x))/x - 1)
>
> Martin.
>

The implementation of do_alg_rde starts at line 1217 in this file

Here is the full function

===================
do_alg_rde(fp : F, lg : List F, x : SE, k : K, lk : LK,
ext : (LK, LF) -> L_Param_F,
logi : (LK, LF) -> Param_Rec_QF) : L_Param_F ==
if #lg = 1 then
cc := lg(1)/fp
if D(cc, x) = 0 then
return [[-cc, [1]]]
is?(k, 'nthRoot) and not(member?(k, kernels(fp))) =>
do_alg_rde0(fp, lg, x, k, lk, ext, logi)
k1 := kmax(lk)
symbolIfCan(k1) case SE =>
res1 := param_RDE(fp, lg, k1, k)$PureAlgebraicIntegration(R, F, F) n := #lg part1 : L_Param_F := [[-be.ratpart, be.coeffs] for be in res1.particular] part2 : L_Param_F := [[f, new(n, 0)$Vector(F)] for f in res1.basis]
concat(part1, part2)
has?(operator k1, ALGOP) =>
rec := primitiveElement(k1::F, k::F
)\$FunctionSpacePrimitiveElement(R, F)
y := rootOf(rec.prim)
ky := retract(y)@K
fp1 := eval(fp, [k1, k], [(rec.pol1) y, (rec.pol2) y])
lg1 := [eval(g, [k1, k], [(rec.pol1) y, (rec.pol2) y]) for g in lg]
res1 := do_alg_rde(fp1, lg1, x, ky, [kk for kk in lk | kk ~= k1],
ext, logi)
[[eval(be.ratpart, ky, rec.primelt), be.coeffs] for be in res1]
error "do_alg_rde: unimplemented kernel"
==============

--Nasser

### anti...@math.uni.wroc.pl

Jan 3, 2022, 1:29:16 PM1/3/22
to
Yes.

> Apparently, the rde-solver of FriCAS may fail for mixed transcendental-
> algebraic integrands.

Currently FriCAS RDE solver is fairly incomplete. It is complete for
algebraic functions and purely transcendental ones, but only
simple mixed cases are handled. Any sufficiently complicated
mixed case will fail. In fact, this is one of most problematic
parts of Risch algorithm, no really good method is known and
what is known requires a lot of code to implement and
if implemented is likely to be quite slow in general case.

> Indeed, the first integrand involves:
>
> (- x*(3*LN(x)/(x + #e^4) - 1))^(1/3)
>
> while the second one contains:
>
> SQRT((8 - LN(x))/x - 1)
>
> Martin.

--
Waldek Hebisch

### anti...@math.uni.wroc.pl

Jan 3, 2022, 4:12:22 PM1/3/22
to
Richard Fateman <fat...@gmail.com> wrote:
> On Monday, December 27, 2021 at 2:48:09 AM UTC-8, Nasser M. Abbasi wrote:
> > On 12/27/2021 2:27 AM, ??????? ???????????? wrote:
> >
> > >
> > > Also please test on Integrate from Wolfram Math. 13.0.0,
> > > since it has IntegrateAlgebraic indide.
> > There should be a new build of CAS independent integration
> > tests which will have Mathematica V 13.0. But waiting for
> > Maple 2022 and sagemath 9.6 and most important for the next
> > version of Rubi to be released with its new test input files
> > with new integrals added.
> >
> > This is because it takes about 2 months and lots of effort and
> > time to run all these tests, and do not want to do this now
> > and then have to do it again few months later.
> >
> > Hopefully sometime next year.
> >
> > --Nasser
> The long expression posted previously that Maxima could not integrate can be expanded and much of it is then integrated.
>
> v:
> (((-2)*x^3+34*x^2+392*x+800)*log((((-25)*x+(-100))*log(x)+(x^2+x))/(25*x+100))+((-6)*x^3+102*x^2+1176*x+2400))/((25*x^3+200*x^2+400*x)*log(x)+((-1)*x^4+(-5)*x^3+(-4)*x^2));
> ((-2*x^3+34*x^2+392*x+800)*log(((-25*x-100)*log(x)+x^2+x)/(25*x+100))-6*x^3+102*x^2+1176*x+2400)/((25*x^3+200*x^2+400*x)*log(x)-x^4-5*x^3-4*x^2)
>
> There's one piece of the expansion that doesn't come out in the wash,
>
> integrate((3*x^6-119*x^5-608*x^4+27320*x^3+339296*x^2+1411200*x+1920000)/((150*x^2+1200*x+2400)*log(x)-6*x^3-30*x^2-24*x),x)
>
> So this after tossing out what I thought were extraneous to come up with a simple
> "bug report" I came to the problem integrate( 1/(log(x)+x), x) which Maxima 5.45.1 apparently cannot do.

I am not sure what you did. However, integral of v is elementary. AFAICS
the two other integrals are not elementary. So, its looks like mistake
in reduction.

> It seems to me that one can generate increasingly more challenging examples in a systematic fashion that would illustrate points of failure more effectively than trying out random algebraic tree generation.
> For instance, irreducible polynomials of increasing degrees; one, two, ... more logarithmic extensions, exponential extensions, both, ..

Well, you can do that for _known_ difficulties. Random examples
generate some unexpected difficulties. Also, in practice
integrator may exhibit nonlinear behaviour: can handle
each difficulty separately, but fails when two are in
single example. Pattern matchers are very sensitive
to exact form of integrand. In particular unsimplified
derivatives leave a lot of hints for integrator. That
is why all expamples I provided are expanded. Related
is that simple integrators frequently split sums term
by term. This is correct in simple "reduced" cases
but easily fails when integrand contains some irrelevant
junk.

Another aspect is that using tilu techinque you can put
whole Rubi testsuite into database of known cases. That
would be cheating, but you could claim 100% success rate
on integrable examples. In case of Risch algorithm probably
100 examples is enough to cover all branches.

With small set of test cases one could easily hide them in
bigger database and claim that database outperforms Risch.
Random examples discourage cheating: the whole pool is so
large that it is probably impractical to put them in
database. And if somebody managed to invent clever
compression scheme, I would consider such compression
as very interesting result...

--
Waldek Hebisch

### Валерий Заподовников

Jan 11, 2022, 6:34:19 AM1/11/22
to
Well, someone should train NN to solve those integrals,
that would be funny. BTW, I made a mistake in my Log[]
function for Mathematica, so

Integrate[Log (1 + x)/x/(1 + (1 + x)^(1/2))^(1/2), x]

should have been
Integrate[Log[1 + x]/x/(1 + (1 + x)^(1/2))^(1/2), x], still
works though even before 13.0, nonelementary, but simple.

Meanwhile
https://github.com/stblake/algebraic_integration/issues/2
is fixed so IntegrateAlgebraic cannot solve it, but Integrate
will be able due to another IntegralAlgebraic hack (in next
version of Mathematica).

To complete FriCAS Risch error branches see
https://github.com/fricas/fricas/issues/78
"residue poly has multiple non-linear factors".

Who can say whether it is elementary? Sam Blake says
it is good enough that it is complex! So may it be that it is
only elementary with complex i inside? I find it improbable.
integrate((1 + x^2)^2/((1 - x^2)*(1 - 6*x^2 + x^4)^(3/4)), x) is
a very dangerous DoS case with fricas anyway. As for Math.
it cannot already solve slightly different
Integrate[(1 + x^2)^2/((1 - x^2)*(1 - 6*x^2 + x^4))^(3/4), x]

### nob...@nowhere.invalid

Jan 15, 2022, 7:15:27 AM1/15/22
to

??????? ???????????? schrieb:
Euler's elementary algebraic integral:

INT((1 + x^2)^2/((1 - x^2)*(1 - 6*x^2 + x^4)^(3/4)), x)

from paper E689 in the Euler Archive has the solution:

- ATANH(2*x*(x^4 - 6*x^2 + 1)^(1/4)/(SQRT(x^4 - 6*x^2 + 1) + x^2 + 1))
+ ATAN(x/((x^4 - 6*x^2 + 1)^(1/4) + 1))
- ATAN(((x^4 - 6*x^2 + 1)^(1/4) - 1)/x)

which is real and continuous where the integrand is real and
continuous. It appears that the awkward ATANH term cannot be decomposed
into simpler ones with real arguments.

Martin.

### Albert Rich

Jan 16, 2022, 11:40:56 PM1/16/22
to
On Saturday, January 15, 2022 at 2:15:27 AM UTC-10, nob...@nowhere.invalid wrote:

> Euler's elementary algebraic integral:
>
> INT((1 + x^2)^2/((1 - x^2)*(1 - 6*x^2 + x^4)^(3/4)), x)
>
> from paper E689 in the Euler Archive has the solution:
>
> - ATANH(2*x*(x^4 - 6*x^2 + 1)^(1/4)/(SQRT(x^4 - 6*x^2 + 1) + x^2 + 1))
> + ATAN(x/((x^4 - 6*x^2 + 1)^(1/4) + 1))
> - ATAN(((x^4 - 6*x^2 + 1)^(1/4) - 1)/x)
>
> which is real and continuous where the integrand is real and
> continuous. It appears that the awkward ATANH term cannot be decomposed
> into simpler ones with real arguments.
>
> Martin.

What's wrong with combining the two arctan terms to get in Mathematica notation:

ArcTan[(1 + x^2 - Sqrt[1 - 6*x^2 + x^4])/(2*x*(1 - 6*x^2 + x^4)^(1/4))] -
ArcTanh[(2*x*(1 - 6*x^2 + x^4)^(1/4))/(1 + x^2 + Sqrt[1 - 6*x^2 + x^4])]

which is also real and continuous where the integrand is real and continuous.

Albert

### nob...@nowhere.invalid

Jan 17, 2022, 3:38:19 AM1/17/22
to

Albert Rich schrieb:
>
> On Saturday, January 15, 2022 at 2:15:27 AM UTC-10, nob...@nowhere.invalid wrote:
>
> > Euler's elementary algebraic integral:
> >
> > INT((1 + x^2)^2/((1 - x^2)*(1 - 6*x^2 + x^4)^(3/4)), x)
> >
> > from paper E689 in the Euler Archive has the solution:
> >
> > - ATANH(2*x*(x^4 - 6*x^2 + 1)^(1/4)/(SQRT(x^4 - 6*x^2 + 1) + x^2 + 1))
> > + ATAN(x/((x^4 - 6*x^2 + 1)^(1/4) + 1))
> > - ATAN(((x^4 - 6*x^2 + 1)^(1/4) - 1)/x)
> >
> > which is real and continuous where the integrand is real and
> > continuous. It appears that the awkward ATANH term cannot be
> > decomposed into simpler ones with real arguments.
> >
>
> What's wrong with combining the two arctan terms to get in
> Mathematica notation:
>
> ArcTan[(1 + x^2 - Sqrt[1 - 6*x^2 + x^4])/(2*x*(1 - 6*x^2 + x^4)^(1/4))] -
> ArcTanh[(2*x*(1 - 6*x^2 + x^4)^(1/4))/(1 + x^2 + Sqrt[1 - 6*x^2 + x^4])]
>
> which is also real and continuous where the integrand is real and
> continuous.
>

Nothing really, only that ATANHs and ATANs broken down as far as
possible typically exhibit fewer unwarranted discontinuities; for the
integral at hand, however, both formulations agree on the real axis.

In fact, Euler himself gives both at the end of §13 in his "Integratio
Formulae Differentialis Maxime Irrationalis quam Tamen per Logarithmos
et Arcus Circulares Expedire Licet" of 1777 (paper E689).

But fusing two ATANHs or two ATANs is easier than recognizing how they
can perhaps be split. So, returning two terms instead of one may be
considered a service to the reader or user.

Martin.

### Albert Rich

Jan 17, 2022, 3:55:32 PM1/17/22
to
Yes, fusing two arctangents into one composite arctangent is easier than splitting one arctangent into two simpler arctangents. This seems analogous to the fact that multiplying two expressions is easier than factoring one expression into two simpler expressions.

There are numerous techniques for factoring expressions (integers, polynomials, etc). Are there techniques for “factoring” a function f(x) into two simpler functions g(x) and h(x) such that

f(x) = (g(x)+h(x)) / (1-g(x)*h(x))

where neither g(x) nor h(x) are constant wrt x?

Albert

### nob...@nowhere.invalid

Jan 21, 2022, 3:29:27 PM1/21/22
to

Albert Rich schrieb:
> Yes, fusing two arctangents into one composite arctangent is easier
> than splitting one arctangent into two simpler arctangents. This
> seems analogous to the fact that multiplying two expressions is
> easier than factoring one expression into two simpler expressions.
>
> There are numerous techniques for factoring expressions (integers,
> polynomials, etc). Are there techniques for “factoring” a
> function f(x) into two simpler functions g(x) and h(x) such that
>
> f(x) = (g(x)+h(x)) / (1-g(x)*h(x))
>
> where neither g(x) nor h(x) are constant wrt x?
>

Some quick remarks:

- restricting f(x), g(x), h(x) to (possibly parametrized) algebraic
functions should cover all cases of interest but makes the splitting
problem more tractable.

- such splittings are not necessarily unique, consider the related
example of:

ATANH((SQRT(x^4 + 6*x^2 + 1) + x^2 - 1)/(2*x*(x^4 + 6*x^2 + 1)^(1/4)))

= ATANH((1 + x)/(1 + 6*x^2 + x^4)^(1/4))
- ATANH((1 - x)/(1 + 6*x^2 + x^4)^(1/4))

= ATANH(x/((x^4 + 6*x^2 + 1)^(1/4) + 1))
+ ATANH(x/((x^4 + 6*x^2 + 1)^(1/4) - 1))

- one of the resulting functions g(x) or h(x) may be constant, in which
case the corresponding ATANH or ATAN can simply be ignored.

- the problem reduces to that of algebraic factorization if the ATANH
or ATAN to be split is expressed in terms of a (complex) logarithm.

- FriCAS permits to factor algebraic expressions, but can it be used to
split the ATANHs and ATANs of its own antiderivatives systematically?

Martin.
0 new messages