Ask Your Question

translation errors from fricas to sage

asked 2018-06-20 12:54:12 +0200

Nasser gravatar image

updated 2018-06-21 13:25:00 +0200

reported at

Using Sage version 8.3.beta6

This one seems to be that there is no translation from fricas to sage. Is this due to the atan ?

       sage:  var('x a')
       sage:  integrate(1/(1+a*cos(x)),x,algorithm="fricas")

NotImplementedError: The translation of the FriCAS Expression "atan(((cos(x)+a)*((-1)*a^2+1)^(1/2))/((a^2+(-1))*sin(x)))/(((-1)*a^2+1)^(1/2)) to sage is not yet implemented.

And this one

sage: var('x a b')
sage: anti=integrate(1/(b*x^2+a),x,algorithm="fricas")

NotImplementedError: The translation of the FriCAS Expression "log(((b*x^2+(-1)*a)*((-1)*a*b)^(1/2)+2*a*b*x)/(b*x^2+a))/(2*((-1)*a*b)^(1/2)) to sage is not yet implemented.
edit retag flag offensive close merge delete


The result of

sage: fricas.integrate('1/(1+a*cos(x))','x')

looks like a list of 2 elements.

FrédéricC gravatar imageFrédéricC ( 2018-06-20 17:01:28 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-06-21 00:03:34 +0200

Emmanuel Charpentier gravatar image

updated 2018-06-21 00:15:02 +0200

In this case, the problematic translation is the one for "atan".

There are lots of cases tike this for translations from Fricas, Maple and Mathematica, especially for special functions such as hypergeometric or Fresnel.

Other problematic cases exist for more convoluted cases. For example, Sympy's Piecewise has semantics different from Sage's cases, and some variants can't (yet) be handled.

Some fallback mechanisms exist, for example, in Mathematica's case, where one can add a list of "additional" translations. But even this is insuficient : for example, the Mathematica -> operator is polysemic, in a Sage-unfriendly way. I've started to think about a (semi-)general way of handling this, but I'm not yet at an acceptable solution.

A shameful workaround in a paper is to ask the target interpreter to create a LaTeX representation of the result, use that to print in the paper, and to manually translate in Sage for the rest of the computations. It's ugly but allows you to progress... This, for example, allows to handle the "general" case of Sympy's Piecewise.

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


Asked: 2018-06-20 12:54:12 +0200

Seen: 490 times

Last updated: Jun 21 '18