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.Wed, 17 Feb 2016 14:56:39 +0100Prevent Sage from executing symbolic computationhttps://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/Hi.
I would like to ask Sage not to perform a certain symbolic computation until I tell it to. This is because I would like first to show with `view` the thing I am typing, and then execute it later. So, for instance, I would like something like
sage: view(noexec(sum(1/k^4, k, 1, oo)))
(which should show the summation formula without executing it) and
sage: view(sum(1/k^4, k, 1, oo))
(which should show the result, as it actually does).
Is this possible?Tue, 16 Feb 2016 12:08:54 +0100https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/Comment by giomasce for <p>Hi.</p>
<p>I would like to ask Sage not to perform a certain symbolic computation until I tell it to. This is because I would like first to show with <code>view</code> the thing I am typing, and then execute it later. So, for instance, I would like something like</p>
<pre><code>sage: view(noexec(sum(1/k^4, k, 1, oo)))
</code></pre>
<p>(which should show the summation formula without executing it) and</p>
<pre><code>sage: view(sum(1/k^4, k, 1, oo))
</code></pre>
<p>(which should show the result, as it actually does).</p>
<p>Is this possible?</p>
https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32568#post-id-32568I notice that some operations have a `hold` property that does it. But `sum` apparently has not. Is there a general solution?Tue, 16 Feb 2016 14:19:18 +0100https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32568#post-id-32568Comment by ndomes for <p>Hi.</p>
<p>I would like to ask Sage not to perform a certain symbolic computation until I tell it to. This is because I would like first to show with <code>view</code> the thing I am typing, and then execute it later. So, for instance, I would like something like</p>
<pre><code>sage: view(noexec(sum(1/k^4, k, 1, oo)))
</code></pre>
<p>(which should show the summation formula without executing it) and</p>
<pre><code>sage: view(sum(1/k^4, k, 1, oo))
</code></pre>
<p>(which should show the result, as it actually does).</p>
<p>Is this possible?</p>
https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32570#post-id-32570What's about typesetting the expression with latex?
var('k')
pretty_print(html( r'$$\sum_{k=1}^\infty \frac{1}{k^4} $$'))
pretty_print(sum(1/k^4, k, 1, oo))Tue, 16 Feb 2016 17:29:00 +0100https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32570#post-id-32570Comment by giomasce for <p>Hi.</p>
<p>I would like to ask Sage not to perform a certain symbolic computation until I tell it to. This is because I would like first to show with <code>view</code> the thing I am typing, and then execute it later. So, for instance, I would like something like</p>
<pre><code>sage: view(noexec(sum(1/k^4, k, 1, oo)))
</code></pre>
<p>(which should show the summation formula without executing it) and</p>
<pre><code>sage: view(sum(1/k^4, k, 1, oo))
</code></pre>
<p>(which should show the result, as it actually does).</p>
<p>Is this possible?</p>
https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32582#post-id-32582Sure, that's a possibility, but I hoped not having to type the expression twice (my main aim was actually that of proof reading expressions in a more natural writing). Thanks anyway!Wed, 17 Feb 2016 14:56:39 +0100https://ask.sagemath.org/question/32566/prevent-sage-from-executing-symbolic-computation/?comment=32582#post-id-32582