Ask Your Question

latex problem using result obtained from Fricas integrate

asked 2019-12-27 20:41:42 +0200

Nasser gravatar image

updated 2019-12-27 22:12:07 +0200

sagemath 8.9.

I do not remember if I mentioned this before or not. I googled and did not find anything. If this is already mentioned and known issue, I am sorry and please feel free to close this.

Fricas returns li in one result, which gets translated log_integral by sagemath. Which is OK. But the latex translation still uses log_integral.

since in Latex, the _ is important , it looks bad when typeset.

I asked about this in the tex forum, and they say that using underscore in math names is not recommended.

So I think the translation of log_integral to latex should be changed to \li or \logintegral. Then one can always make it a math operator using \DeclareMathOperator{\li}{log\_integral} but one can't do this, if the math name itself has _ in it. Latex gives an error.

In non-latex, it is ok to use log_integral.

Here is an example.

sage: var('t')
sage: result=integrate(1/log(t)^2,t, algorithm="fricas")
sage: result
(log(t)*log_integral(t) - t)/log(t)
sage: latex(result)
\frac{\log\left(t\right) log_integral\left(t\right) - t}{\log\left(t\right)}

When compiling the above latex, it shows as


$\frac{\log\left(t\right) log_integral\left(t\right) - t}{\log\left(t\right)}$

image description

Using Fricas directly

(3) -> result:=integrate(1/log(t)^2,t)

        li(t)log(t) - t
   (3)  ---------------
                                         Type: Union(Expression(Integer),...)
(4) -> latex(result)                  

  "{{{li \left( {t} \right)} \  {\log \left( {t} \right)}} -t} \over {\log \lef
  t( {t} \right)}"
                                                                 Type: String
(5) ->

Compiling the above gives


${{{li \left( {t} \right)} \  {\log \left( {t} \right)}} -t} \over {\log \left( {t} \right)}$

image description

Not perfect either (since 'li should have been \li and made an operator) but it looks better that latex from sagemath,

Is this a known issue? Is there a workaround?

Thank you --Nasser

edit retag flag offensive close merge delete


A quick workaround:

Juanjo gravatar imageJuanjo ( 2019-12-28 12:15:09 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-27 22:45:12 +0200

Emmanuel Charpentier gravatar image

updated 2019-12-27 22:46:34 +0200

This is fixed by the definition of log_integral in the library and can't be changed but by changing this definition (i. e. a patch to Sagemath).

Therefore this can be considered as a (minor) defect. Care to report it on Trac and try to fix it yourself ? Look at the Sagemath's developer's guide to have an idea of what this would entail...

edit flag offensive delete link more



thank you for the suggestion. created ticked

Nasser gravatar imageNasser ( 2019-12-27 23:42:34 +0200 )edit

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: 2019-12-27 20:41:42 +0200

Seen: 89 times

Last updated: Dec 27 '19