# How to set an option for algorithm used by Integrate

Update I think this issue is resolved now. Thanks to an answer by Matrin R at Fricas group, doing this from sage works

      sage: fricas.setSimplifyDenomsFlag(fricas.true)


This sets the flag inside sage as I wanted. I verified it works.

## Original question

Hello; When using Fricas directly, I always set

      setSimplifyDenomsFlag(true)


Before calling integrate. For example

        setSimplifyDenomsFlag(true)
integrate((x+(1+x)^(1/2))^(1/2)/(x^2+1)/(1+x)^(1/2),x)


Otherwise, many integrals will hang or take too much time. Since I have a timeout of 3 minutes, it will fail.

But from sage, I could only do

           integrate((x+(1+x)^(1/2))^(1/2)/(x^2+1)/(1+x)^(1/2),x,algorithm="fricas")


Is there a way to somewhere pass this command to fricas along with the integrate command? i.e. is there a way to pass 2 commands to be executed in same transaction to the other CAS? Because without being able to set this flag before calling integrate, this will not work. By default this flag is set to false in Fricas for some reason.

ps. I asked at the Fricas forum if there is a way to rebuild fricas on Linux with this flag set to true. If so, I can rebuild-fricas. But I do not know now. I asked here fyi

Thank you

--Nasser

edit retag close merge delete

Sort by » oldest newest most voted

Unfortunately, at the moment, it does not seem possible to provide an option in integrate for external integrators like Fricas. Indeed, as you can see in lines 812-816 of the code source, only the expression, the variable and the integration bounds are passed to the external integrator:

if algorithm is not None:
integrator = available_integrators.get(algorithm)
if not integrator:
raise ValueError("Unknown algorithm: %s" % algorithm)
return integrator(expression, v, a, b)


Probably, this could easily be improved by adding a keyword argument algorithm_options to integrate. Do not hesitate to open a ticket on SageMath Trac to do so.

more

## Stats

Seen: 82 times

Last updated: Jun 18 '18