_SAGE_VAR_minus and Maxima limit direction

35 views
Skip to first unread message

Jan Marucha

unread,
Apr 11, 2022, 8:17:22 AM4/11/22
to sage-devel
`integrate()' function on non-elementary integrals outputs sometimes a limit function, ie:
In: k = var("m", domain='positive', latex_name=r"\hat k" );
In: N_nr = integrate(k^2/(exp(k)+1), (k, 0, oo))
Out: `limit(1/3*k^3 - k^2*log(e^k + 1) - 2*k*dilog(-e^k) + 2*polylog(3, -e^k), k, +Infinity, minus) + 3/2*zeta(3)`

Analytically, the part under the limit is equal to 0 (compare to mathematica's  N_nr = Integrate[k^2/(Exp[k] + 1), {k, 0, Infinity}]

On simplify, the engine tries to evaluate the limit using maxima and fails
In: N_nr.simplify()
Out: TypeError: ECL says: Error executing code in Maxima: limit: direction must be either 'plus' or 'minus'; found: _SAGE_VAR_minus

Something seems to be off from putting this sage expression to maxima.

Version: Sage 9.3
OS: Windows 10 Pro, 21H2, x64

Nils Bruin

unread,
Apr 11, 2022, 6:38:28 PM4/11/22
to sage-devel
That's a fairly straightforward thing to fix: it just means that the sage-to-maxima interface needs to learn how to translate "plus" and "minus" in limit expressions.

The easiest way would be to tell the interface that "plus" and "minus" are symbols that need a hardcoded translation. A more subtle version would put a special translation in place for a symbolic "limit" to treat the direction argument separately.

Perhaps a slightly cleaner way of triggering the error:

function('f')
limit(f(x),x=0,dir="-").simplify()

Someone should file a bug report.

kcrisman

unread,
Apr 12, 2022, 8:04:20 AM4/12/22
to sage-devel
Reply all
Reply to author
Forward
0 new messages