fyi, the problem of zero result for antiderivative instead of not solved

7 views
Skip to first unread message

Nasser M. Abbasi

unread,
Aug 27, 2022, 5:17:02 AM8/27/22
to FriCAS - computer algebra system
Fyi,

I think I mentioned this before at a different forum. 

This is just FYI, that Fricas still gives zero for some integrals instead of returning the input if it can't solve it. This confuses the  CAS integration test program, as it thinks it solved the integral.  I will try to add special check for Fricas to filter these results as not solved. The only legal antiderivative of zero should be when the integrand itself is zero, and there is only one such integral in the whole test suite.

>fricas
Checking for foreign routines
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
(1) -> integrate(x/sqrt(1-x^3),x)
   (1)  0
1) -> integrate(x/(-x^3+1)^(1/2),x)
   (1)  0
(2) -> integrate(x/(-x^3+1)^(1/2),x)
   (2)  0
(3) -> integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2),x)
   (3)  0

etc.. The following is partial list of such integrands.


sqlite> select command_in_sage,fricas_anti from main where fricas_anti="0";

integrate(x/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate(cos(x)*cos(2*x)*sin(3*x)/(-5+4*sin(x)^2)^(5/2),x, algorithm="fricas")|0
integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2),x, algorithm="fricas")|0
integrate(0,x, algorithm="fricas")|0
integrate(1/(-2-3*x)^(1/2)/(2+3*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-b*x-2)^(1/2)/(b*x+2)^(1/2),x, algorithm="fricas")|0
integrate(x^2*(b*x+a)^(1/2)/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate(x*(b*x+a)^(1/2)/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate((b*x+a)^(1/2)/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate((b*x+a)^(1/2)/x/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate((b*x+a)^(1/2)/x^2/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate((b*x+a)^(1/2)/x^3/(-b*x-a)^(1/2),x, algorithm="fricas")|0
integrate(1/x^(1/2)/(-b*x+a)^(1/2)/(b*x+a)^(1/2),x, algorithm="fricas")|0
integrate(1/x^(1/2)/(-b*x+2)^(1/2)/(b*x+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(2-3*x)^(1/2)/x^(1/2)/(2+3*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(1-x)^(1/2)/x^(1/2)/(1+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(1+x)^(1/2)/(-x^2+x)^(1/2),x, algorithm="fricas")|0
integrate((1+x)^(1/2)/(1-x)^(1/2)/x^(1/2),x, algorithm="fricas")|0
integrate((1+x)^(1/2)/(-x^2+x)^(1/2),x, algorithm="fricas")|0
integrate((1-x)^(1/2)/x^(1/2)/(1+x)^(1/2),x, algorithm="fricas")|0
integrate((-1+1/x)^(1/2)*(1/x)^(1/2)*x^(1/2)/(1+x)^(1/2),x, algorithm="fricas")|0
integrate((1-2*x)^(1/2)/(2+3*x)^(1/2)/(3+5*x)^(1/2),x, algorithm="fricas")|0
integrate((3+5*x)^(1/2)/(1-2*x)^(1/2)/(2+3*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(3-x)^(1/2)/(1+x)^(1/2)/(2+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(2-x)^(1/2)/(1+x)^(1/2)/(3+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(1-x)^(1/2)/(2+x)^(1/2)/(3+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(1-x)^(1/2)/(2-x)^(1/2)/(3-x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-3-x)^(1/2)/(-2+x)^(1/2)/(-1+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-2-x)^(1/2)/(-3+x)^(1/2)/(-1+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-1-x)^(1/2)/(-3+x)^(1/2)/(-2+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-3-x)^(1/2)/(-2-x)^(1/2)/(-1-x)^(1/2),x, algorithm="fricas")|0
integrate((2+3*x)^(1/2)/(1-2*x)^(1/2)/(3+5*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(1-2*x)^(1/2)/(2+3*x)^(1/2)/(3+5*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(6-x)^(1/2)/(-2+x)^(1/2)/(-1+x)^(1/2),x, algorithm="fricas")|0
integrate(1/((6-x)*(-2+x))^(1/2)/(-1+x)^(1/2),x, algorithm="fricas")|0
integrate(1/(-1+x)^(1/2)/(-x^2+8*x-12)^(1/2),x, algorithm="fricas")|0
integrate((2-3*x)^(1/2)/(-5+2*x)^(1/2)/(1+4*x)^(1/2),x, algorithm="fricas")|0
integrate((7+5*x)/(2-3*x)^(1/2)/(-5+2*x)^(1/2)/(1+4*x)^(1/2),x, algorithm="fricas")|0
integrate(1/(2-3*x)^(1/2)/(-5+2*x)^(1/2)/(1+4*x)^(1/2),x, algorithm="fricas")|0
integrate(1/x^(1/2)/(-a^2*x^2+1)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(5*x^2+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(4*x^2+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(3*x^2+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(2*x^2+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(x^2+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(-x^2+2)^(1/2)/(x^2-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(-3*x^2+2)^(1/2)/(x^2-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(-4*x^2+2)^(1/2)/(x^2-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(-5*x^2+2)^(1/2)/(x^2-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(-x^2+1)^(1/2)/(2*x^2-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^2-1)^(1/2)/(7+x^2-4*3^(1/2))^(1/2),x, algorithm="fricas")|0
integrate(1/(3+x^2*(-3+3^(1/2)))^(1/2)/(3-3*3^(1/2)+2*3^(1/2)*x^2)^(1/2),x, algorithm="fricas")|0
integrate(1/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate(x/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate(1/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate(x/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(x^4-1)^(1/2),x, algorithm="fricas")|0
integrate((1-x+3^(1/2))/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate((1+x+3^(1/2))/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate((1-x-3^(1/2))/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate((1+x-3^(1/2))/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate((-1+x+3^(1/2))/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate((-1-x+3^(1/2))/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate((d*x+c)/(-x^3+1)^(1/2),x, algorithm="fricas")|0
integrate((d*x+c)/(-x^3-1)^(1/2),x, algorithm="fricas")|0
integrate(1/(3-2*x)^(1/2)/(x^2-3*x+1)^(1/2),x, algorithm="fricas")|0
integrate((3-2*x)^(1/2)/(x^2-3*x+1)^(1/2),x, algorithm="fricas")|0
integrate((3+5*x)^(1/2)/(-12*x^2+5*x+2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4+5*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4+4*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4+3*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4+2*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4+x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-2*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-3*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-4*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(3*x^4-5*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+7*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+6*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+5*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+4*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+3*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+2*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4+x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-2*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-3*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-4*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(2*x^4-5*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(-2*x^4+7*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(-2*x^4+6*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(-2*x^4+5*x^2-3)^(1/2),x, algorithm="fricas")|0
integrate(1/(-3*x^4+6*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(-3*x^4+5*x^2-2)^(1/2),x, algorithm="fricas")|0
integrate(1/(-x^4+5*x^2-1)^(1/2),x, algorithm="fricas")|0
etc..


--Nasser

Qian Yun

unread,
Aug 27, 2022, 6:55:13 AM8/27/22
to fricas...@googlegroups.com
I tested some of the integrals, not all.

It seems that for integrals contain only x (no a/b), failure is caused
by commit 1f42999f91ce516a8d027a61be4ecbf32ad2ada4 on Jun 13 2022,
"Handle some elliptic integrals".

BTW, for FriCAS, pi is typed as "%pi", is the usage correct in your
other tests?

- Qian

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

Nasser M. Abbasi

unread,
Aug 27, 2022, 7:02:22 AM8/27/22
to FriCAS - computer algebra system
" BTW, for FriCAS, pi is typed as "%pi", is the usage correct in your
other tests?"

I just copied the result as given to sagemath interface which uses pi and not %pi ofcourse, and just forgot to use %pi when I used the command directly inside fricas to confirm.

1) -> integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/%pi/(a*x-1)^(1/2),x)

   (1)  0
                                         Type: Union(Expression(Integer),...)
(2) ->

Yes, all in the list are correct, they are called from sagemath, not fricas, so syntax might need to be manually adjusted as needed to run them inside Fricas as you showed.
 
Thanks
--Nasser

Waldek Hebisch

unread,
Aug 27, 2022, 11:15:54 AM8/27/22
to fricas...@googlegroups.com
On Sat, Aug 27, 2022 at 06:53:24PM +0800, Qian Yun wrote:
> I tested some of the integrals, not all.
>
> It seems that for integrals contain only x (no a/b), failure is caused
> by commit 1f42999f91ce516a8d027a61be4ecbf32ad2ada4 on Jun 13 2022,
> "Handle some elliptic integrals".

The actual problem is use of 'real' by integrator. With the
attached patch I get:

(7) -> integrate(x/sqrt(1-x^3),x)

2 weierstrassZeta(0,4,weierstrassPInverse(0,4,x))
(7) - -------------------------------------------------
+---+
\|- 1
Type: Union(Expression(Integer),...)

Integrator thinks that function under integral is real, and 'real'
considers result as purely imaginary, so replaces it by 0.

Unfortunately, disabling use of 'real' in integrator causes trouble
in other places. This is similar to use of 'rootSum', once
other parts are ready we can put the patches in.

--
Waldek Hebisch
sum6a1.diff

Waldek Hebisch

unread,
Aug 28, 2022, 11:06:13 AM8/28/22
to fricas...@googlegroups.com
On Sat, Aug 27, 2022 at 03:15:56PM +0000, Waldek Hebisch wrote:
> On Sat, Aug 27, 2022 at 06:53:24PM +0800, Qian Yun wrote:
> > I tested some of the integrals, not all.
> >
> > It seems that for integrals contain only x (no a/b), failure is caused
> > by commit 1f42999f91ce516a8d027a61be4ecbf32ad2ada4 on Jun 13 2022,
> > "Handle some elliptic integrals".
>
> The actual problem is use of 'real' by integrator.

ANd to elaborate a bit: this is old problem and can be shown
using elementary functions. Notable example is:

(1) -> f := 1/acosh(sin(x))

1
(1) -------------
acosh(sin(x))
Type: Expression(Integer)
(2) -> integrate(D(f, x), x)

(2) 0


Interestingly:

(3) -> normalize(f)

1
(3) --------------------------------------
+---+ x 2 x +---+
\|- 1 tan(-) + 2 tan(-) - \|- 1
2 2
log(---------------------------------)
x 2
tan(-) + 1
2
Type: Expression(Integer)
(4) -> complexNormalize(f)

1
(4) ---------------------
+---+ +---+
log(\|- 1 ) - x\|- 1
Type: Expression(Integer)

which shows that there is algebraic dependency which is only
discoverd over complex numbers. That add twist to real version
of Risch structure theorem (which says that for real function
it is enough to look at dependencies over real numbers):
in Risch structure theorem function must be expressed in
terms on exp, log, tan and atan. acosh(sin(x)) looks
real, but when re-expressed in terms of basic functions
it turn out complex, so we need to use complex version to
handle it.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages