Opened 19 months ago
Last modified 3 months ago
#31222 new defect
Many integrals fail now using sagemath 9.2 using giac algorithm
Reported by:  ghnasser1  Owned by:  

Priority:  major  Milestone:  sage9.7 
Component:  symbolics  Keywords:  integrate, giac, interface 
Cc:  chapoton, charpent, frederichan, ghmwageringel, ghnasser1, slelievre  Merged in:  
Authors:  Reviewers:  
Report Upstream:  Reported upstream. Developers acknowledge bug.  Work issues:  
Branch:  Commit:  
Dependencies:  Stopgaps: 
Description (last modified by )
Edit: the root cause of the problem described here is very high
sensitivity of giac to the form of the input to its integrator: e.g.
different order of terms in a product to be integrated may lead to
huge slowdowns/hands,cf Example 8, and Sage does rewriting of terms before passing them to an
external integrator. Namely, if F
is the original input then giac
gets F._giac_init_()
, which is often not exacly F
, although equavalent to F
. In this sense, passing a string to giac might be more robust.
Hello. I am working on a new build and new reports for the independent CAS integration tests https://www.12000.org/my_notes/CAS_integration_tests/index.htm.
Now using sagemath 9.2 on Linux to test thousands of integrals using fricas, maxima and giac among other CAS systems.
I found that hundreds of integrals now fail when using giac version 1.6, which all work on giac itself, and also which all worked using sagemath 8.9 using giac 1.5 which I did last year.
It fails either by now hanging or not evaluating. The ones that hang in sagemath, complete immediately in giac.
Since there so many integrals that now fail, I will only show few examples below. Hopefully the cause of the failure is the same for all. If not, I can provide more examples.
Example 1, do not evaluate any more
>sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 20201024 │ │ Using Python 3.8.6. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: x,a = var('x a') sage: integrate(sin(2*x)/(a^24*sin(x)^2)^(1/3),x, algorithm="giac") integrate(sin(2*x)/(a^2  4*sin(x)^2)^(1/3), x) sage: Using giac directly >giac // Using locale /usr/share/locale/ // en_US.utf8 // /usr/share/locale/ // giac // UTF8 // Maximum number of parallel threads 2 Help file /usr/share/giac/doc/en/aide_cas not found Added 26 synonyms Welcome to giac readline interface (c) 2001,2020 B. Parisse & others Homepage http://wwwfourier.ujfgrenoble.fr/~parisse/giac.html Released under the GPL license 3.0 or above See http://www.gnu.org for license details May contain BSD licensed software parts (lapack, atlas, tinymt)  Press CTRL and D simultaneously to finish session Type ?commandname for help 0>> integrate(sin(2*x)/(a^24*sin(x)^2)^(1/3),x) 3/4*((a^22*(2*cos(2*x)/2+1))^(1/3))^2/2 // Time 0.01 1>>
Example 2. Hangs now in sagemath
sage: x,a,b = var('x a b') sage: integrate(x^(5/2)/(b*x+a)^(5/2),x, algorithm="giac") While in giac, completes right away >> integrate(x^(5/2)/(b*x+a)^(5/2),x) 2*(2*((9*b^4*a*1/36/b^5/a*sqrt(x)*sqrt(x)+60*b^3*a^2*1/36/b^5/a)*sqrt(x)*sqrt(x)+45*b^2*a^3*1/36/b^5/a)*sqrt(x)*sqrt(a+b*x)/(a+b*x)^2+10*a/4/b^3/sqrt(b)*ln(abs(sqrt(a+b*x)sqrt(b)*sqrt(x)))) // Time 0.02
Example 3, hangs
integrate(x^(3/2)/(b*x+a)^(5/2),x, algorithm="giac") Using giac directly, it completes right away 14>> integrate(x^(3/2)/(b*x+a)^(5/2),x) 2*(2*(12*b^2*a*1/18/b^3/a*sqrt(x)*sqrt(x)9*b*a^2*1/18/b^3/a)*sqrt(x)*sqrt(a+b*x)/(a+b*x)^21/b^2/sqrt(b)*ln(abs(sqrt(a+b*x)sqrt(b)*sqrt(x)))) // Time 0.03
Most of the ones that fail now looks like due to hang. But also some fail because the integral do not evaluate in sagemath, but it does using giac directly.
Version information
which giac /bin/giac > > >giac version // Using locale /usr/share/locale/ // en_US.utf8 // /usr/share/locale/ // giac // UTF8 // Maximum number of parallel threads 2 // (c) 2001, 2018 B. Parisse & others 1.6.0 > > >which sage /bin/sage >sage version SageMath version 9.2, Release Date: 20201024 > Linux Manjaro running inside Oracle Virtual Box >uname r 5.4.802MANJARO >uname a Linux mevirtualbox 5.4.802MANJARO #1 SMP PREEMPT Sat Nov 28 09:58:18 UTC 2020 x86_64 GNU/Linux > >lsb_release a LSB Version: n/a Distributor ID: ManjaroLinux Description: Manjaro Linux Release: 20.2 Codename: Nibia
Because of this, I stopped the tests. And will wait for next version of sagemath, hopefully it have a fix for this, as giac result are now looking not good due to this.
Please feel free to add any fields for the ticket if needed. I filled the ones I know about.
Thank you, Nasser
Adding more examples
EXAMPLE 4 (hangs in sagemath)
>giac // Using locale /usr/share/locale/ // en_US.utf8 // /usr/share/locale/ // giac // UTF8 // Maximum number of parallel threads 2 Help file /usr/share/giac/doc/en/aide_cas not found Added 26 synonyms Welcome to giac readline interface (c) 2001,2020 B. Parisse & others Homepage http://wwwfourier.ujfgrenoble.fr/~parisse/giac.html Released under the GPL license 3.0 or above See http://www.gnu.org for license details May contain BSD licensed software parts (lapack, atlas, tinymt)  Press CTRL and D simultaneously to finish session Type ?commandname for help 0>> integrate(x*(b*x^2+a)*(B*x^2+A),x) 1/2*(1/3*x^6*b*B+1/2*x^4*b*A+1/2*x^4*a*B+x^2*a*A) // Time 0 >sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 20201024 │ │ Using Python 3.8.6. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: x,a,b,B,A = var('x a b B A') sage: integrate(x*(b*x^2+a)*(B*x^2+A),x, algorithm="giac")
EXAMPLE 5 (hangs in sagemath)
GIAC: 3>> integrate(x^m*(b*x^2+a)^3*(B*x^2+A),x) (A*a^3*m^4*x*exp(m*ln(x))+24*A*a^3*m^3*x*exp(m*ln(x))+206*A*a^3*m^2*x*exp(m*ln(x))+744*A*a^3*m*x*exp(m*ln(x))+945*A*a^3*x*exp(m*ln(x))+3*A*a^2*b*m^4*x^3*exp(m*ln(x))+66*A*a^2*b*m^3*x^3*exp(m*ln(x))+492*A*a^2*b*m^2*x^3*exp(m*ln(x))+1374*A*a^2*b*m*x^3*exp(m*ln(x))+945*A*a^2*b*x^3*exp(m*ln(x))+3*A*a*b^2*m^4*x^5*exp(m*ln(x))+60*A*a*b^2*m^3*x^5*exp(m*ln(x))+390*A*a*b^2*m^2*x^5*exp(m*ln(x))+900*A*a*b^2*m*x^5*exp(m*ln(x))+567*A*a*b^2*x^5*exp(m*ln(x))+A*b^3*m^4*x^7*exp(m*ln(x))+18*A*b^3*m^3*x^7*exp(m*ln(x))+104*A*b^3*m^2*x^7*exp(m*ln(x))+222*A*b^3*m*x^7*exp(m*ln(x))+135*A*b^3*x^7*exp(m*ln(x))+B*a^3*m^4*x^3*exp(m*ln(x))+22*B*a^3*m^3*x^3*exp(m*ln(x))+164*B*a^3*m^2*x^3*exp(m*ln(x))+458*B*a^3*m*x^3*exp(m*ln(x))+315*B*a^3*x^3*exp(m*ln(x))+3*B*a^2*b*m^4*x^5*exp(m*ln(x))+60*B*a^2*b*m^3*x^5*exp(m*ln(x))+390*B*a^2*b*m^2*x^5*exp(m*ln(x))+900*B*a^2*b*m*x^5*exp(m*ln(x))+567*B*a^2*b*x^5*exp(m*ln(x))+3*B*a*b^2*m^4*x^7*exp(m*ln(x))+54*B*a*b^2*m^3*x^7*exp(m*ln(x))+312*B*a*b^2*m^2*x^7*exp(m*ln(x))+666*B*a*b^2*m*x^7*exp(m*ln(x))+405*B*a*b^2*x^7*exp(m*ln(x))+B*b^3*m^4*x^9*exp(m*ln(x))+16*B*b^3*m^3*x^9*exp(m*ln(x))+86*B*b^3*m^2*x^9*exp(m*ln(x))+176*B*b^3*m*x^9*exp(m*ln(x))+105*B*b^3*x^9*exp(m*ln(x)))/(m^5+25*m^4+230*m^3+950*m^2+1689*m+945) // Time 0.01 4>> SAGEMATH: sage: x,a,b,B,A,m = var('x a b B A m') sage: integrate(x^m*(b*x^2+a)^3*(B*x^2+A),x, algorithm="giac")
EXAMPLE 6 (hangs in sagemath)
GIAC: 4>> integrate(x^4*log(d*(c*x^2+b*x+a)^n),x) (2/25*n+1/5*ln(d))*x^5+b*n/(20*c)*x^4+(2*a*c*nb^2*n)/(15*c^2)*x^3+(3*a*b*c*n+b^3*n)/(10*c^3)*x^2+(2*a^2*c^2*n+4*a*b^2*c*nb^4*n)/(5*c^4)*x+1/5*n*x^5*ln(a+b*x+c*x^2)+integrate((x*n*b^55*x*n*b^3*c*a+5*x*n*b*c^2*a^2+n*b^4*a4*n*b^2*c*a^2+2*n*c^2*a^3)/(5*x^2*c^5+5*x*b*c^4+5*c^4*a),x) // Time 0.01 5>> SAGEMATH: sage: x,a,b,B,A,m,n,d,c = var('x a b B A m n d c') sage: integrate(x^4*log(d*(c*x^2+b*x+a)^n),x, algorithm="giac")
EXAMPLE 7 (hangs in sagemath)
5>> integrate(x^3*log(d*(c*x^2+b*x+a)^n),x) (1/8*n+1/4*ln(d))*x^4+b*n/(12*c)*x^3+(2*a*c*nb^2*n)/(8*c^2)*x^2+(3*a*b*c*n+b^3*n)/(4*c^3)*x+1/4*n*x^4*ln(a+b*x+c*x^2)+integrate((x*n*b^4+4*x*n*b^2*c*a2*x*n*c^2*a^2n*b^3*a+3*n*b*c*a^2)/(4*x^2*c^4+4*x*b*c^3+4*c^3*a),x) // Time 0.02 sage: x,a,b,B,A,m,n,d,c = var('x a b B A m n d c') sage: integrate(x^3*log(d*(c*x^2+b*x+a)^n),x, algorithm="giac")
EXAMPLE 8 (hangs in sagemath)
0>> integrate(exp(b*xa)*(b*x+a)^4*(d*x+c)^3,x) Done // Time 0.01 sage: x,a,b,B,A,m,n,d,c = var('x a b B A m n d c') sage: integrate(exp(b*xa)*(b*x+a)^4*(d*x+c)^3,x, algorithm="giac")
EXAMPLE 9 (hangs in sagemath)
1>> integrate(exp(b*xa)*(b*x+a)^4*(d*x+c),x) (x^5*d*b^94*x^4*a*d*b^8x^4*c*b^95*x^4*d*b^86*x^3*a^2*d*b^74*x^3*a*c*b^816*x^3*a*d*b^74*x^3*c*b^820*x^3*d*b^74*x^2*a^3*d*b^66*x^2*a^2*c*b^718*x^2*a^2*d*b^612*x^2*a*c*b^748*x^2*a*d*b^612*x^2*c*b^760*x^2*d*b^6x*a^4*d*b^54*x*a^3*c*b^68*x*a^3*d*b^512*x*a^2*c*b^636*x*a^2*d*b^524*x*a*c*b^696*x*a*d*b^524*x*c*b^6120*x*d*b^5a^4*c*b^5a^4*d*b^44*a^3*c*b^58*a^3*d*b^412*a^2*c*b^536*a^2*d*b^424*a*c*b^596*a*d*b^424*c*b^5120*d*b^4)/b^6*exp((a+b*x)) // Time 0 sage: x,a,b,B,A,m,n,d,c = var('x a b B A m n d c') sage: integrate(exp(b*xa)*(b*x+a)^4*(d*x+c),x, algorithm="giac")
Attachments (1)
Change History (39)
comment:1 Changed 19 months ago by
 Description modified (diff)
comment:2 Changed 19 months ago by
 Cc chapoton frederichan ghmwageringel ghnasser1 slelievre added
 Keywords changed from integrate,giac,interface to integrate, giac, interface
 Type changed from PLEASE CHANGE to defect
comment:3 Changed 19 months ago by
comment:4 Changed 19 months ago by
It looks like this is about Sage 9.2 installed, as a system package, on a particular Linux, what is Linux in question?
comment:5 Changed 19 months ago by
version information for linux
>uname a Linux mevirtualbox 5.4.802MANJARO #1 SMP PREEMPT Sat Nov 28 09:58:18 UTC 2020 x86_64 GNU/Linux >uname r 5.4.802MANJARO
I installed 9.2 via Linux package manager and all was installed correctly. sagemath works fine.
comment:6 Changed 19 months ago by
your report indicates that Sage's interface with giac is broken in your installation.
comment:7 followup: ↓ 15 Changed 19 months ago by
@dimpase could you please try the other examples ? On my computer (Sage 9.3.beta5
, compiled by myself, Debian buster), the first example works, but not the other ones.
comment:8 followup: ↓ 11 Changed 19 months ago by
@ghnasser1 if you have interesting examples, you should add them as doctests within Sage so that we could see regressions immediately.
comment:9 Changed 19 months ago by
The second example seems to hand in giac 1.5 itself. Maybe giac 1.6 makes a difference.
comment:10 Changed 19 months ago by
FWIW: My experience matches that of tmonteil in comment:7. This is with 9.3.beta5 on MacOS 10.15.7.
(The result for the 1st integral is the same as reported by dimpasse in comment:3. It looks different from what is reported in the ticket description, but I believe the two expressions are equal, so that is not a problem.)
comment:11 in reply to: ↑ 8 ; followups: ↓ 13 ↓ 31 Changed 19 months ago by
@ghnasser1: Thanks for reporting this problem. It seems to be serious, but I hope it will have an easy solution.
It seems that you have translated the rubi tests to sagemath format. If so, would you be willing to share the zip file, perhaps as an attachment to this ticket?
comment:12 Changed 19 months ago by
 Description modified (diff)
comment:13 in reply to: ↑ 11 ; followup: ↓ 14 Changed 19 months ago by
Replying to ghDaveWitteMorris:
@ghnasser1: Thanks for reporting this problem. It seems to be serious, but I hope it will have an easy solution.
It seems that you have translated the rubi tests to sagemath format. If so, would you be willing to share the zip file, perhaps as an attachment to this ticket?
I seem to have lost what I wrote here. WIll try again.
I attached zip file to the ticket. Each file in the zip file, say "Hebisch_Problems.sage" has first line as the var
command, followed by lis
which is a list that contains all the integrals for that specific test.
To run one file you could do
fileName = "Hebisch_Problems.sage" load(fileName) #read the problems into variable lis. This also contains the var('') statement. for problem in lst: #problem[0] is the integrand, problem[1] is the integration variable. integrate(SR(problem[0]),problem[1],algorithm="giac")
Each row in the list has as first field the integrand (as a string) and the second field is the integration variable.
Of you could simply copy the integral from the files and past it to sagemath.
Here is an example of one small complete file. There are about 200 files, some contains thousands of integrals. But they all have this format:
var('x ') lst=[["(x^6x^5+x^4x^3+1)*exp(x)",x,25,"871*exp(x)870*exp(x)*x+435*exp(x)*x^2145*exp(x)*x^3+36*exp(x)*x^47*exp(x)*x^5+exp(x)*x^6"], ["(x^2+2)*exp(x/(x^2+2))/(x^3+2*x)",x,5,"Ei(x/(x^2+2))"], ["(2*x^4x^3+3*x^2+2*x+2)*exp(x/(x^2+2))/(x^3+2*x)",x,5,"exp(x/(x^2+2))*(x^2+2)+Ei(x/(x^2+2))"], ["(1+exp(x))*exp(x+exp(x))/(x+exp(x))",x,2,"Ei(x+exp(x))"], ["(x^3x^23*x+1)*exp(1/(x^21))/(x^3x^2x+1)",x,6,"exp(1/(x^21))*(1+x)"], ["exp(1+1/log(x))*(1+log(x)^2)/log(x)^2",x,1,"exp(1+1/log(x))*x"], ["exp(x+1/log(x))*(1+(1+x)*log(x)^2)/log(x)^2",x,2,"exp(x+1/log(x))*x"]]
Nasser
comment:14 in reply to: ↑ 13 Changed 19 months ago by
Replying to ghnasser1:
I attached zip file to the ticket...
Thanks! Your instructions were very clear, so I had no problem running some tests (until I ran into one that hangs). As suggested by tmonteil in comment:8, I think a bunch of these should be added to the testing framework after this bug is cleared up.
comment:15 in reply to: ↑ 7 Changed 19 months ago by
Replying to tmonteil:
@dimpase could you please try the other examples ? On my computer (Sage
9.3.beta5
, compiled by myself, Debian buster), the first example works, but not the other ones.
oops, indeed, while the 1st example works for me, the 2nd one hangs. Sorry for noise.
comment:16 Changed 19 months ago by
Something silly is happening where the expression to pass to giac is formed. I've added

src/sage/interfaces/giac.py
a b class GiacElement(ExpectElement): 1154 1154 sage: x,y=giac('x'),giac('y');integrate(cos(x+y),'x=0..pi').simplify() 1155 1155 2*sin(y) 1156 1156 """ 1157 print(self.name()) 1158 print(self) 1159 print(var) 1157 1160 if min is None: 1158 1161 return giac('int(%s,%s)' % (self.name(), var)) 1159 1162 else:
and as you see, the expression is malformed, e.g. there is no terminating )
so giac just waits for the end of the expression, which never comes, thus the hang.
sage: sage: x,a,b = var('x a b') ....: sage: integrate((x/(b*x+a))^(5/2),x, algorithm="giac") sage4 sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2 x ^CInterrupting Giac...
comment:17 Changed 19 months ago by
and here is the malformed giac input for Example 2 as given in the ticket description
sage: sage: x,a,b = var('x a b') ....: sage: integrate(x^(5/2)/(b*x+a)^(5/2),x, algorithm="giac") sage0 (sqrt(b*x+a))^1*(b*x+a)^2*sqrt(x)*x^2 x ^CInterrupting Giac...
somebody has damaged handling of noninteger exponents (for giac only?) since Sage 8.9, it seems.
comment:18 Changed 19 months ago by
On the other hand, integrate(x^(5/2)/(b*x+a)^(5/2),x, algorithm="fricas")
works, which gives hope that the bug is specific to giac interface.
comment:19 followup: ↓ 20 Changed 19 months ago by
sorry, but where do you see a missing parenthesis ? The following works fine:
sage: x,a,b = var('x a b') sage: F=(x/(b*x+a))^(5/2) sage: F._fricas_init_() == F._giac_init_() True sage: giac(F).diff() 1/2*(b*(b*x+a)^2*x+(b*x+a)^1)*(sqrt((b*x+a)^1*x))^1*((b*x+a)^1*x)^2+2*sqrt((b*x+a)^1*x)*(b*(b*x+a)^2*x+(b*x+a)^1)*(b*x+a)^1*x sage: giac(F).sage() x^2*sqrt(x/(b*x + a))/(b*x + a)^2
comment:20 in reply to: ↑ 19 Changed 19 months ago by
Replying to chapoton:
sorry, but where do you see a missing parenthesis ? The following works fine:
sage: x,a,b = var('x a b') sage: F=(x/(b*x+a))^(5/2) sage: F._fricas_init_() == F._giac_init_() True sage: giac(F).diff() 1/2*(b*(b*x+a)^2*x+(b*x+a)^1)*(sqrt((b*x+a)^1*x))^1*((b*x+a)^1*x)^2+2*sqrt((b*x+a)^1*x)*(b*(b*x+a)^2*x+(b*x+a)^1)*(b*x+a)^1*x sage: giac(F).sage() x^2*sqrt(x/(b*x + a))/(b*x + a)^2
see the output of the debugging print I inserted:
sage: integral(F,x,algorithm="giac") sage0 sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2 x
there is an attempted conversion to an expression involving sqrt()
, but it does not go through!
Where the hell this is happening in the code, I don't know.
comment:21 followup: ↓ 24 Changed 19 months ago by
once again: sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2
is what's being passed to giac, and of course this does not fly.
comment:22 Changed 19 months ago by
Here it is, in another way:
sage: F._giac_() sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2
I don't know where this is happening, but it is obviously very wrong.
by the way
sage: F._fricas_() ++ 2  x x  \b x + a  2 2 2 b x + 2 a b x + a
comment:23 Changed 19 months ago by
There is indeed a filter between Expression and giac used to convert some keywords so giac(F) may not be the same as giac(str(F))
I guess it is in
sage.symbolic.expression_conversions
comment:24 in reply to: ↑ 21 ; followup: ↓ 25 Changed 19 months ago by
Replying to dimpase:
once again:
sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2
is what's being passed to giac, and of course this does not fly.
No, I do not think so. This is what giac is printing. What giac gets is the string given by _giac_init_
, which is fine.
comment:25 in reply to: ↑ 24 Changed 19 months ago by
Replying to chapoton:
Replying to dimpase:
once again:
sqrt((b*x+a)^1*x)*((b*x+a)^1*x)^2
is what's being passed to giac, and of course this does not fly.No, I do not think so. This is what giac is printing. What giac gets is the string given by
_giac_init_
, which is fine.
"passing" means "what giac tries to integrate". IMHO it is what Sage prepares to pass to giac, giac is not yet involved at this point.
giac is perfectly capable to take this _giac_init_
and integrate it.
comment:26 Changed 19 months ago by
meanwhile I looked at Example 8. The trouble there is that giac is highly sensitive to the expression format; we shuffle the terms around, and all of a sudden it has trouble integrating the expression.
0>> integrate((b*x+a)^4*(d*x+c)^3*exp(b*xa),x) ^CCtrlC pressed (pid 21354) Stopped by user interruption. Error: Bad Argument Value Evaluation time: 50.4 "Stopped by user interruption. Error: Bad Argument Value" // Time 50.4 1>> integrate(exp(b*xa)*(b*x+a)^4*(d*x+c)^3,x) Done
and the first of these forms is what you get by doing
sage: F=exp(b*xa)*(b*x+a)^4*(d*x+c)^3 sage: F._giac_()
so that's why this particular example is stuck in Sage.
So it's more of a giac problem/bug for this example.
comment:27 Changed 19 months ago by
Oops, sorry, you're right, Example 2 is more of a giac problem, too (I took that _giac_init_()
form):
0>> integrate((((((b)*(x))+(a))^(1))*(x))^(5/2),x) Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real): Check [abs(b*x+a)] ^CCtrlC pressed (pid 32350)
comment:28 Changed 19 months ago by
 Report Upstream changed from N/A to Reported upstream. No feedback yet.
Upstream notified in https://xcas.univgrenoblealpes.fr/forum/viewtopic.php?f=3&t=2600
comment:29 Changed 19 months ago by
 Description modified (diff)
comment:30 Changed 19 months ago by
 Description modified (diff)
comment:31 in reply to: ↑ 11 Changed 19 months ago by
Replying to ghDaveWitteMorris:
@ghnasser1: Thanks for reporting this problem. It seems to be serious, but I hope it will have an easy solution.
An easy solution, making sure that giac called from Sage does exactly the same as giac called stanadlone, is to bypass rewriting done by Sage, by using giac.eval()
. E.g.
sage: x,a,b,B,A,m,n,d,c = var('x a b B A m n d c') sage: F='exp(b*xa)*(b*x+a)^4*(d*x+c)^3' sage: giac.eval(F+',x') 'exp(b*xa)*(b*x+a)^4*(d*x+c)^3,x' sage: giac.eval('integrate('+F+',x)') '(x^7*d^3*b^114*x^6*...'
So you pass giac a string and get a string back.
One can convert strings to Sage's symbolic expressions then, by calling SR()
.
comment:32 Changed 19 months ago by
 Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.
the problem of Ex.8 has been fixed upstream: https://dev.geogebra.org/trac/changeset/69729/
comment:33 Changed 16 months ago by
 Milestone changed from sage9.3 to sage9.4
Moving this ticket to 9.4, as it seems unlikely that it will be merged in 9.3, which is in the release candidate stage
comment:34 Changed 15 months ago by
 Cc charpent added
Examples 2, 3, 5, 6, 7 have ln
in Giac's output.
Emmanuel Charpentier's answer to
points to the absence of conversion from
Giac's ln
to Sage's log
being a problem.
comment:35 Changed 13 months ago by
no example [1..9] hangs anymore:
https://asciinema.org/a/kPLdynWBPFraIDEJLvHOKP7xq
try it yourself with https://github.com/sheerluck/ticket31222
comment:36 Changed 12 months ago by
 Milestone changed from sage9.4 to sage9.5
comment:37 Changed 8 months ago by
 Milestone changed from sage9.5 to sage9.6
comment:38 Changed 3 months ago by
 Milestone changed from sage9.6 to sage9.7
everything works in the current beta. I guess your Sage install is broken.