fyi, update for Fricas 1.3.10 giving zero answer for integrate which is not zero

28 views
Skip to first unread message

Nasser M. Abbasi

unread,
Apr 19, 2024, 3:42:19 AM4/19/24
to FriCAS - computer algebra system
FYI,

This is update for the final summer 2024 edition of CAS integration tests about the issue Fricas giving zero for non zero integrand.

There are 4 such cases found out of 107,000 integrals. 

Here they are

>sqlite3 cas_integration_tests.db
sqlite> select COUNT(*) from main where fricas_anti="0";
6

But only 2 of these 6 cases should give zero. The rest should not.

sqlite> select command_in_fricas  from main where fricas_anti="0";

integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2),x, algorithm="fricas")

integrate(0,x, algorithm="fricas")

integrate((1-x)^3+(-x^2+x)^3-3*(1-x)*(-x^2+x)*(x^2-1)+(x^2-1)^3,x, algorithm="fricas")

integrate(a*(-3*c+2*2^(1/2)*c+6^(1/2)*a*x)/(c^2-3^(1/2)*a*c*x+2^(1/2)*a^2*x^2),x, algorithm="fricas")

integrate((3*7^(1/2)+6*11^(1/2)+(-121*105^(1/2)-98*165^(1/2))*x^4)/(-12*15^(1/2)+10200*x^4-118580*15^(1/2)*x^8),x, algorithm="fricas")

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

 Here is the output from Fricas for the four cases:

                      FriCAS Computer Algebra System
                Version: FriCAS 1.3.10 built with sbcl 2.3.11
                 Timestamp: Wed Jan 10 09:37:52 PM CST 2024


(4) -> setSimplifyDenomsFlag(true)
(5) -> integrate(a*(-3*c+2*2^(1/2)*c+6^(1/2)*a*x)/(c^2-3^(1/2)*a*c*x+2^(1/2)*a^2*x^2),x)                                
   (5)  0
                                 Type: Union(Expression(AlgebraicNumber),...)

(6) -> integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2),x)                                              
   (6)  0
                                         Type: Union(Expression(Integer),...)

(7) -> integrate((3*7^(1/2)+6*11^(1/2)+(-121*105^(1/2)-98*165^(1/2))*x^4)/(-12*15^(1/2)+10200*x^4-118580*15^(1/2)*x^8),x)

   (7)  0
                                 Type: Union(Expression(AlgebraicNumber),...)

(8) -> integrate((-36-2*6^(1/2)*x^2)/(9*3^(1/2)+3*2^(1/2)*x^2-x^4),x)

   (8)  0
                                 Type: Union(Expression(AlgebraicNumber),...)



--Nasser

Waldek Hebisch

unread,
Apr 19, 2024, 10:01:06 AM4/19/24
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
On Fri, Apr 19, 2024 at 12:42:19AM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
> FYI,
>
> This is update for the final summer 2024 edition of CAS integration tests
> about the issue Fricas giving zero for non zero integrand.
>
> There are 4 such cases found out of 107,000 integrals.
>
> Here they are
>
> >sqlite3 cas_integration_tests.db
> sqlite> select COUNT(*) from main where fricas_anti="0";
> 6
>
> But only 2 of these 6 cases should give zero. The rest should not.
>
> Here is the output from Fricas for the four cases:
>
> (4) -> setSimplifyDenomsFlag(true)
>
> (6) -> integrate(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2),x)
>
> (6) 0
> Type:
> Union(Expression(Integer),...)

Well,

(10) -> 1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2)

+-------+
- 2 log(- \|a x - 1 ) + log(a x - 1)
(10) ------------------------------------
+-------+
2 pi\|a x - 1
Type: Expression(Integer)
(11) -> normalize(1/2*(log(a*x-1)-2*log(-(a*x-1)^(1/2)))/pi/(a*x-1)^(1/2))

(11) 0
Type: Expression(Integer)

Here there are 2 dependent logarithms which may combine to 0.
And FriCAS assumes that they will combine to 0. This is a
design choice: I think that current behaviour is more useful than
easy alternatives like signaling error in user input.

The other 3 are plain bugs.

--
Waldek Hebisch

Qian Yun

unread,
Apr 27, 2024, 8:05:35 AM4/27/24
to fricas...@googlegroups.com


On 4/19/24 22:01, Waldek Hebisch wrote:
> On Fri, Apr 19, 2024 at 12:42:19AM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
>> FYI,
>>
>> This is update for the final summer 2024 edition of CAS integration tests
>> about the issue Fricas giving zero for non zero integrand.
>>
>> There are 4 such cases found out of 107,000 integrals.
>>
>> Here they are
>>
>>> sqlite3 cas_integration_tests.db
>> sqlite> select COUNT(*) from main where fricas_anti="0";
>> 6
>>
>> But only 2 of these 6 cases should give zero. The rest should not.
>>
>> Here is the output from Fricas for the four cases:
>>
>
> The other 3 are plain bugs.
>

For those 3 bugs, they are all caused by dependent algebraic kernels.
FriCAS can solve them, if you substitute sqrt(6) to sqrt(2)*sqrt(3).

But is there a way to solve this kind of problems in general?

- Qian

Waldek Hebisch

unread,
Apr 27, 2024, 11:01:43 AM4/27/24
to fricas...@googlegroups.com
Detecting similar dependencies (that is dependencies caused by products
of roots) is easy. I have code to do this. In more general cases
we need factoring, which seem to be acceptable in many cases.

Concerning "solving" this, I think that main problem is fuzzines
of traditional math notation (with infamous phrases liike "reader
will have no trouble to find out what is meant"). I practice
such things seem to come from two sources:
- careless users, who assume that sqrt(x*y) = sqrt(x)*sqrt(y)
and like this
- evaluation of more complicated expressions, when substitution
converts independent roots into dependent ones

The fist case is essentially unsolvable, basicaly it is exercise
in mind reading. In the second case, when expressions are
internally generated, we should try to do better than what we
do now.

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