Prevent Sage from executing symbolic computation

asked 2016-02-16 12:08:54 +0100

giomasce gravatar image

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?

edit retag flag offensive close merge delete

Comments

I notice that some operations have a hold property that does it. But sum apparently has not. Is there a general solution?

giomasce gravatar imagegiomasce ( 2016-02-16 14:19:18 +0100 )edit

What'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))
ndomes gravatar imagendomes ( 2016-02-16 17:29:00 +0100 )edit

Sure, 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!

giomasce gravatar imagegiomasce ( 2016-02-17 14:56:39 +0100 )edit