translation errors from fricas to sage

reported at https://trac.sagemath.org/ticket/25628

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 close merge delete

The result of

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


looks like a list of 2 elements.

( 2018-06-20 17:01:28 +0200 )edit

Sort by » oldest newest most voted

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.

more