ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 09 Aug 2020 15:49:52 +0200Latexing, showing or viewing a held integral triggers its evaluation ???https://ask.sagemath.org/question/52922/latexing-showing-or-viewing-a-held-integral-triggers-its-evaluation/*Note : for once, this will be cross-posted on [sage-support](https://groups.google.com/forum/#!forum/sage-support) for ticket advice...*
Exploring [this question](https://ask.sagemath.org/question/52913/error-during-integration-not-of-type-unsigned-byte-15/) led me to discover what I think is a serious bug : it seems that `latex`ing an expression *containing* a held (= unevaluated) integral triggers the latter's evaluation ; ditto for `view`ing or `show`ing...
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](https://cocalc.com/projects/d9f9cc53-525c-4d92-a0a7-bc5941b8c734/files/?session=default), 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`.
HTH,Emmanuel CharpentierSun, 09 Aug 2020 15:49:52 +0200https://ask.sagemath.org/question/52922/latex Function Prevent Simplificationhttps://ask.sagemath.org/question/9698/latex-function-prevent-simplification/Hi, I am trying to use the latex function without the subject simplifying before it converting to LaTeX. This is similar to the hold=True for algebra functions. For example, I want latex(x/x) to return \frac{x}{x} rather than 1. Thanks so much!bpeacockWed, 09 Jan 2013 00:42:24 +0100https://ask.sagemath.org/question/9698/converting expressions into latex codehttps://ask.sagemath.org/question/8064/converting-expressions-into-latex-code/latex(
(lim((sin(tan(x))-tan(sin(x)))/x^7,x=0)))
returns the latex code of the answer ie -1/30
but I want the latex code of the limit unevaluated so that I can generate an image of the question from it. How can I do this?ebsSat, 09 Apr 2011 07:36:47 +0200https://ask.sagemath.org/question/8064/