Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call to integrate with Fricas hangs but works inside Fricas #33344

Open
nasser1 opened this issue Feb 14, 2022 · 5 comments
Open

call to integrate with Fricas hangs but works inside Fricas #33344

nasser1 opened this issue Feb 14, 2022 · 5 comments

Comments

@nasser1
Copy link

nasser1 commented Feb 14, 2022

I think this is a new problem. I asked about it here https://ask.sagemath.org/question/61090/call-to-integrate-with-fricas-hangs-but-works-inside-fricas/ but thought to also enter a ticket on it just in case.

I noticed some calls to integrate using "fricas" algorithm (but possibly others also) hang when run from sagemath but the same integrate command works fast when run directly from Fricas on same computer.

I am running sagemath 9.5 on ArchLinux inside VBox machine. Here is an example

>which sage
/bin/sage
>which fricas
/bin/fricas
>fricas --version
FriCAS 1.3.7
based on sbcl 2.2.1
>sage --version
SageMath version 9.5, Release Date: 2022-01-30
>

Now

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5, Release Date: 2022-01-30                     │
│ Using Python 3.10.2. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: var("a b x d c e")
(a, b, x, d, c, e)
sage: integrand = x*(e *x^3 + d)/(c*x^6 + b*x^3 + a)
sage: fricas.setSimplifyDenomsFlag(fricas.true)
false
sage: anti = integrate(integrand, x, algorithm="fricas")

And the above hangs. I waited for more than 30 minutes. Now I run the same integrate inside Fricas itself, and it completes in less than 10-20 seconds. The output is very large, so I am wondering may be this is why sagemath hangs?

>fricas
Checking for foreign routines
FRICAS="/usr/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
                       FriCAS Computer Algebra System 
                            Version: FriCAS 1.3.7
                 Timestamp: Fri Feb  4 01:39:20 AM CST 2022

(1) -> setSimplifyDenomsFlag(true)
(3) -> integrand := x*(e *x^3 + d)/(c*x^6 + b*x^3 + a);
(4) -> integrate(integrand, x);
                                     Type: Union(Expression(Integer),...)
(5) ->

Is there a limit on the output from integrate command and that is why it hangs?

In sagemath 9.3 this same command worked OK and did not hang. I have few others like this that now hang in 9.5

Any idea what is going on? Is this something I should file a bug report on?

Thanks --Nasser

CC: @sagetrac-tmonteil @EmmanuelCharpentier @mantepse

Component: interfaces

Keywords: symbolic, integrate, fricas

Issue created by migration from https://trac.sagemath.org/ticket/33344

@nasser1 nasser1 added this to the sage-9.6 milestone Feb 14, 2022
@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Feb 15, 2022

comment:2

FWIW, the problem also exists when running in Sage's fricas_console().

HTH,

@mantepse
Copy link
Contributor

comment:5

actually, I also noticed a (very likely new) communication problem between FriCAS and sage recently: https://mathoverflow.net/questions/415887/generating-function-of-the-square-of-jacobi-polynomial/415912#415912

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mantepse
Copy link
Contributor

comment:7

I don't even know how to start debugging this. It does work without fricas.setSimplifyDenomsFlag(fricas.true).

I cannot confirm comment:2:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.7.beta3, Release Date: 2022-06-19               │
│ Using Python 3.10.3. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: fricas.console()
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"
foreign routines found
openServer result 0
                       FriCAS Computer Algebra System 
                         Version: FriCAS 2021-03-06
                   Timestamp: Sa 25 Jun 2022 10:48:45 CEST
-----------------------------------------------------------------------------
   Issue )copyright to view copyright notices.
   Issue )summary for a summary of useful system commands.
   Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------
 

(1) -> setSimplifyDenomsFlag(true)

   (1)  false
                                                                Type: Boolean
(2) -> integrand := x*(e *x^3 + d)/(c*x^6 + b*x^3 + a);

                                          Type: Fraction(Polynomial(Integer))
(3) -> )time on
(3) -> integrate(x, x);

                                          Type: Polynomial(Fraction(Integer))
                           Time: 0.01 (IN) + 0.00 (EV) + 0.03 (OT) = 0.04 sec
(4) -> integrate(integrand, x);

                                         Type: Union(Expression(Integer),...)
                         Time: 0.00 (IN) + 82.89 (EV) + 0.06 (OT) = 82.95 sec

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@fchapoton
Copy link
Contributor

Changed keywords from symbolic integrate fricas to symbolic, integrate, fricas

@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
@oldk1331
Copy link

With sage-10.2 and FriCAS-1.3.9, this returns in less than 1 minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants