Ask Your Question

Latexing, showing or viewing a held integral triggers its evaluation ???

asked 2020-08-09 15:49:52 +0200

Emmanuel Charpentier gravatar image

updated 2020-08-09 17:54:34 +0200

Note : for once, this will be cross-posted on sage-support for ticket advice...

Exploring this question led me to discover what I think is a serious bug : it seems that latexing an expression containing a held (= unevaluated) integral triggers the latter's evaluation ; ditto for viewing or showing...

Minimal case:

sage: Ig=sin(x)
sage: It=Ig.integrate(x,-pi,pi,hold=True)
sage: Cs=1/(2*pi)
sage: latex(It)
\int_{-\pi}^{\pi} \sin\left(x\right)\,{d x}

So far, so good. But :

sage: Ex=Cs*It
sage: Ex
1/2*integrate(sin(x), x, -pi, pi)/pi
sage: latex(Ex)
\frac{0}{2 \, \pi}

Aaaarghh ! And, of course :

sage: show(Ex)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{0}{2 \, \pi}

And view(Ex proudly displays this crap...

IMHO, this is a serious bug, entailing a risk of inadvertently triggering long, impossible or never ending computations.

Advice ?

EDIT : On Cocalc, I have checked that the problem can be reproduced on all available Sage kernels back to 8.2.

Looks more like an error from me, rather than a bug...

Suggestions most welcome !

EDIT : One more data point: calling latex (or show or view) on such an expression containing a held integral in a hold context gives a RecursionError.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-10 11:17:43 +0200

Emmanuel Charpentier gravatar image

This is now Trac#30326.

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: 2020-08-09 15:49:52 +0200

Seen: 767 times

Last updated: Aug 10 '20