bug report: integrate(acos(x^2), x) returns incorrect antiderivative (FriCAS 1.3.12)

9 views
Skip to first unread message

Fabian

unread,
Jan 27, 2026, 12:42:53 PM (16 hours ago) Jan 27
to FriCAS - computer algebra system
Hello FriCAS group,

It looks like I found a bug in FriCAS:
F:=integrate(acos(x^2),x)
gives:
      +--------+
     |   4         2      2
- 2 \|- x  + 1  + x acos(x )
----------------------------
              x

D(F,x)-acos(x^2)
gives the following instead of 0:
       2
-------------
   +--------+
 2 |   4
x \|- x  + 1

I use FriCAS via https://sagecell.sagemath.org/ . Here is some Sage-code that produces the above output:

from sage.interfaces.fricas import fricas
fricas.eval(
    "F:=integrate(acos(x^2),x)"
)
print("F=\n",fricas("F"))
fricas.eval("f:=D(F,x)-acos(x^2)")
print("F'-acos(x^2)=\n",fricas("f"))

The FriCAS version is 1.3.12. (print(fricas.eval(")lisp |$build_version|") tells me this.)

The SageMath version is 10.8, Release Date: 2025-12-18. (version() tells me this.)

Fabian

Dima Pasechnik

unread,
Jan 27, 2026, 12:52:13 PM (16 hours ago) Jan 27
to fricas...@googlegroups.com
I can add that I can repeat this at Fricas prompt, it has nothing to
do with Sage per se.
It's for me on Gentoo Linux, with

$ fricas
Checking for foreign routines
FRICAS="/usr/lib64/fricas/target/x86_64-pc-linux-gnu"
spad-lib="/usr/lib64/fricas/target/x86_64-pc-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
FriCAS Computer Algebra System
Version: FriCAS 1.3.12 built with sbcl 2.5.11
Timestamp: Thu Dec 11 00:10:42 CST 2025
> --
> 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 visit https://groups.google.com/d/msgid/fricas-devel/e5fde980-d9d7-4e5d-9fb9-d1cc5c45c021n%40googlegroups.com.

Fabian

unread,
Jan 27, 2026, 1:25:33 PM (15 hours ago) Jan 27
to FriCAS - computer algebra system
Hello Dima,

This was a fast reply!

Fabian
Message has been deleted

Kurt Pagani

unread,
Jan 27, 2026, 5:28:35 PM (11 hours ago) Jan 27
to FriCAS - computer algebra system
The integral cannot be expressed in terms of elementary functions. When you take 'complexIntegrate' it should work, although Google KI says that it requires the Hypergeometric function [2]F[1] to evaluate the second integral "integrate(x^2/sqrt(1-x^4),x)" which is left after partial integration, so *no* guarantees if (1) below is correct 😉 However, I think it is ...

To verify the result below, one has also to use the
fact that

acos(x) = -%i * log(x+sqrt(x^2-1)) holds.


(1) -> complexIntegrate(acos(x^2),x)

   (1)
                      +------+
                      | 4         2             +------+
        2 +---+    - \|x  - 1  - x        +---+ | 4
       x \|- 1 log(----------------) - 4 \|- 1 \|x  - 1
                     +------+
                     | 4         2
                    \|x  - 1  - x
     +
           +---+          1            +---+          1
       4 x\|- 1 ellipticF(-,- 1) - 4 x\|- 1 ellipticE(-,- 1)
                          x                           x
  /
     2 x
                                                    Type: Expression(Integer)

Qian Yun

unread,
Jan 27, 2026, 9:09:02 PM (8 hours ago) Jan 27
to fricas...@googlegroups.com
Thanks for the report.

Git bisect points to
https://github.com/fricas/fricas/commit/1f42999f91ce516a8d027a61be4ecbf32ad2ada4

"Handle some elliptic integrals", June 14, 2022.
(Between 1.3.7 and 1.3.8)

Before this commit, the result is a integral sign
which means fricas proves it does not have elemental
integral, which is correct.

- Best,
- Qian
> --
> 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 <mailto:fricas-
> devel+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-
> devel/e5fde980-d9d7-4e5d-9fb9-d1cc5c45c021n%40googlegroups.com <https://
> groups.google.com/d/msgid/fricas-devel/e5fde980-d9d7-4e5d-9fb9-
> d1cc5c45c021n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Waldek Hebisch

unread,
Jan 27, 2026, 9:33:46 PM (7 hours ago) Jan 27
to fricas...@googlegroups.com
On Wed, Jan 28, 2026 at 10:09:14AM +0800, Qian Yun wrote:
> Thanks for the report.
>
> Git bisect points to
> https://github.com/fricas/fricas/commit/1f42999f91ce516a8d027a61be4ecbf32ad2ada4
>
> "Handle some elliptic integrals", June 14, 2022.
> (Between 1.3.7 and 1.3.8)
>
> Before this commit, the result is a integral sign
> which means fricas proves it does not have elemental
> integral, which is correct.

The reason is that transformations used in postprocessing result
of integration may incorrectly transform elliptic integrals to
0.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/e34f4198-37cd-463a-9c65-fba93aa7f97f%40gmail.com.

--
Waldek Hebisch

Fabian

unread,
3:11 AM (2 hours ago) 3:11 AM
to FriCAS - computer algebra system
Hello FriCAS group,

Thank you Kurt, Qian, and Waldek for your prompt replies. I have tried out the suggestion by Kurt to use complexIntegrate. The following check indicates that this does not work for acos(x^2):


from sage.interfaces.fricas import fricas
fricas.eval(
    "f:=acos(x^2);"
    "F:=complexIntegrate(f,x);"
)
print(fricas("complexNumeric(eval(D(F,x)-f,x=1/2))"))

This produces the output - 2.63..., which is not close to desired value 0.

Fabian
Reply all
Reply to author
Forward
0 new messages