Ask Your Question
3

How to set an option for algorithm used by Integrate

asked 2018-06-17 14:46:02 +0100

Nasser gravatar image

updated 2018-06-18 10:08:25 +0100

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

https://groups.google.com/forum/#!topic/fricas-devel/aV7uLH8plZM

Thank you

--Nasser

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-06-17 15:17:16 +0100

eric_g gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-06-17 14:46:02 +0100

Seen: 448 times

Last updated: Jun 18 '18